Skip to content

gnosisguild/zodiac-module-siphon

Repository files navigation

Zodiac Siphon Module

Build Status Coverage Status Contributor Covenant

The Siphon Module belongs to the Zodiac collection of tools, which can be accessed through the Zodiac App available on Gnosis Safe.

If you have any questions about Zodiac, join the Gnosis Guild Discord. Follow @GnosisGuild on Twitter for updates.

About the Siphon Module

This module exposes a public interface which allows anyone to trigger an Avatar to withdraw from a designated liquidity position in order to pay down some of its debt in a designated debt position, thereby improving the health of the position.

The module owner can set a target and trigger collateral ratios for the debt position. If the collateral ratio of the debt position falls below the trigger ratio, anyone can call siphon() to trigger the withdrawal of enough capital from the liquidity position to return the debt position to the target ratio.

This contract should be used in concert with a bot that periodically queries ratio() on the debt position adapter and calls siphon() on the Siphon module any time ratio() falls below the current ratioTarget().

Siphon also exposes some MEV in the parity and slippage tolerance defined by the user in the liquidity adapter. Setting these variables relatively higher provides an incentive for those seeking to capture MEV to call siphon() on the user's behalf whenever ratio() falls below ratioTarget(). This could be used in concert with the bot mentioned above to add a layer of redundancy to the monitoring payment of unhealthy debt positions.

Features

  • Pay down debt from assets being productively used elsewhere in one atomic transaction.
  • Automate debt repayment via bots and/or MEV to ensure debt positions stay healthy.
  • Generalized interface can be adapted for many debt and liquidity positions.
  • Use existing adapters to monitor Maker Vaults and pay down debt from capital deployed to Balancer Boosted Stable Pools.

Flow

  • Deploy a debt position adapter along with a liquidity position adapter from which asset to pay down debt can be drawn.
  • Set a target collateral ratio and a trigger collateral ratio on the debt position.
  • Set parity and slippage tolerance for your liquidity position; higher means exposing more MEV.
  • Connect a tube between the debt position and the liquidity position with connectTube().
  • Monitor ratio() and ratioTrigger() on the debt adapter and call siphon() on the Siphon module whenever the former falls below the latter.

Development environment setup

  1. Copy the content of the .env.sampl file into a .env file at the same location and populate it with your keys, etc.
  2. From the repo root run yarn
  3. From the repo root run yarn build

Solidity Compiler

The contracts have been developed with Solidity 0.8.6. This version of Solidity made all arithmetic checks by default, therefore eliminating the need for explicit overflow or underflow (or other arithmetic) checks.

Security and Liability

All contracts are WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

License

Created under the LGPL-3.0+ license.

TODO:

  1. missing events
  2. missing natspac
  3. the balancer specific LP adapter could be contained within contracts/adapters/lp/balancer/*. However balancer specific helper and lib functions are present in contracts/lib and contracts/helpers.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published