zeriontech / defi-sdk

DeFi SDK Makes Money Lego Work
https://docs.zerion.io/defi-sdk/
GNU Lesser General Public License v3.0
790 stars 249 forks source link

implement G-UNI interactive adapter #160

Closed kassandraoftroy closed 3 years ago

kassandraoftroy commented 3 years ago

G-UNI tokens are single LP positions on Uniswap V3 token pairs that are fractionalized and thus made fungible. Anyone can add or remove their liquidity to this shared position and is entitled to their portion of the fees earned. Gelato bot network can call a method to automatically reinvest any fees earned by the position (only once enough fees have accured) to create compounding effect. The position range of any G-UNI position is static and cannot be changed by the gelato bots (however a permissioned 'manager' role can be assigned on pools and this manager has the power to adjust the range with an executiveRebalance() call)

one note: I basically followed as closely as possible the patterns of the UniswapV2AssetInteractiveAdapter, which doesn't use the uniswap router but mints and burns directly on the pool. So we did the same thing with G-UNI (did not use guni router but mint/burn directly on the pool) but this way things like WETH/ETH support or swapping some inventory of user inputs before deposit (so that they can deposit maximal liquidity) must be handled natively.

sobolev-igor commented 3 years ago

Hey @superarius I've fixed tests, now npm run test:interactiveAdapters runs the tests and they pass successfully! I've made some fix suggestions, but they are mostly code-style level.