stabilitydao / stability-contracts Goto Github PK
View Code? Open in Web Editor NEWSmart contracts of DeFi Asset Management Platform
Home Page: https://stability.farm
License: MIT License
Smart contracts of DeFi Asset Management Platform
Home Page: https://stability.farm
License: MIT License
Status will be changed soon.
Earn Merkl rewards by DefiEdge vault with MerklVeBooster's boost.
//nosemgrep
or/and // slither-disable-next-line detector
to each false positive alertLet's improve the overall percentage of project test coverage.
This method was not implemented in these implementation. Need to fix.
platform.addBoostTokens(address[] memory allowedBoostRewardToken, address[] memory defaultBoostRewardToken);
swapper.setThreshold
to swapper.setThresholds(address[] memory tokenIn, uint[] memory thresholdAmount);
factory.addFarm
to factory.addFarms(Farm[] memory farms_);
The strategy was developed.
Earn MERKL rewards by DefiEdge strategy.
Being developed.
Earn MERKL rewards by Steer vault.
We need our own unique implementation of a universal Automatic Liquidity Manager for UniswapV3-based AMMs.
We started similar development in the fall of 2023 in the form of Active strategies #14 #48, which are ALMs, but the concept has changed. Previously, we intended to manage the provision of liquidity completely on-chain, and create a separate strategy for each liquidity management algorithm (Fill-Up/Follow/Swap), but now we decided to shift part of the work to the off-chain environment and transfer already calculated tick ranges to the strategy when rebalancing. In general, we are now following the path of most existing ALMs.
ALM
is a single base strategy contract for all rebalancing algorithms and all supported DeXes.Liquidity can be provided and rebalanced in the form of a dynamic number of ranges.
The calculation of the new position for rebalancing will be done off-chain, but the type of algorithm and its specifics will be requested from this contract. This specificity and algorithm can be changed through Governance and Multisig.
Rebalancing algorithms that will be supported by Stability Server Pro.
Must be tested within this issue through the implemented methods of UniversalTest
.
Currently, the platform core contracts have redundant and unused functionality, the deployment of which in other networks will consume extra gas.
Need to implement IFarmingStrategy.stakingPool
to StrategyBase and to final farming strategies with classic farm mechanics.
We need this address in UI etc.
Status will be changed soon.
Earn Merkl rewards by static liquidity position on Retro with MerklVeBooster's boost.
The idea of the strategy is that supplying liquidity to full range is suitable for many Retro pools due to the peculiarities of Mrekl rewarding parameters (example: 10% fee/45% asset0/45% asset1). I assume that such rewarding parameters in many of their pools are associated with the integration of Ichi for both assets of the pair.
getSpecificName()
method for Ichi strategies must return only allowed deposit asset symbol.
The strategy cannot be implemented now until the base contracts and interfaces are implemented.
Like #9 a good way to get acquainted with swap strategies is to read the thesis Providing Liquidity in Uniswap V3.
Basically, this strategy is needed to make money in stable pools with tickspacing 1 (0.01%). Moreover, unlike other strategies, this requires the presence of a sufficient amount of liquidity in the pool and in the network as a whole.
Since Uniswap v3 does not have farming, there is no need to use NFT (NonfungiblePositionManager) when developing the strategy. Working with UniswapV3Pool directly without minting NFTs will help reduce gas costs.
LPStrategyBase
AmmAdapterIdLib.UNISWAPV3
A zapping solution is required for deposits into vaults and withdrawals from vaults through any blue chip token.
The exchange of an input asset for vault assets upon deposit and the exchange of vault assets for an output token during withdrawal must be done by whitelisted dex aggregator routers.
Use custom errors instead reverts with strings.
There is no point in storing strings with errors in the blockchain; we will only store them in the code and ABI.
Developed
Earn MERKL rewards by ICHI vault.
Developed
Hold Yearn V3 vault shares and emit APR.
MultiStrategyBase
No.
Now Retro strategies are liquidating oRETRO rewards through the oRETRO/RETRO pool by Swapper. This is a flawed implementation. This method is neither profitable nor reliable, because there is practically no liquidity in this pool.
It is required to liquidate options similarly to the Transmutation contract, through flash loans.
Deployed
Earn rewards by staking Curve LP to Convex.
Developed.
Earn Merkl rewards by Gamma LP.
Protocol: LayerZero
Interface: IInterChainAdapter
Adapter string ID: LayerZero
An active strategy is a dynamic position of liquidity burned and minted during rebalancing.
Rebalancing is performed by a server script, which can use various API services, have a rebalancing state for each strategy to implement delays and other rebalancing functionality.
Rebalancing may include swaps through dex aggregators. In this case, the strategy must inform the rebalancing script of the assets and amounts for swaps.
Status will be changed soon.
Earn rewards by staking ECLP to Aura.
VaultBase
RVaultBase
Implemented
Earn Merkl rewards and pool swap fees by static liquidity position on QuickSwap.
Can be implemented with Boosted base strategy development.
Earn Merkl rewards by Gamma LP.
Strategy need ability to create veNFT and increase lock time and amount.
IStrategy.isReadyForHardWork
IStrategy.isHardWorkOnDepositAllowed
IFarmingStrategy.farmMechanics
IStrategy.autoCompoundingByUnderlyingProtocol()
The strategy cannot be implemented now until the base contracts and interfaces are implemented.
Strategy must working like Maverck's Mode Both.
Widths: 48%, 24%, 12%, 6%, 2%, 0.02%, 0.01%
LPStrategyBase
AmmAdapterIdLib.UNISWAPV3
Liquidity providing strategies need common method for view concentrated position.
Position can be composed of few ranges.
For each range we need to know:
Vaults - Stability Book: Rewarding (RVault)
RVaultBase.sol
revert "SPL" on HardWork and deposits need to be resolved
Developed
Earning MERKL rewards by Gamma LP on QuickSwapV3
The storage of each core contract must be formed using the Namespaced Storage pattern.
Need to refactor the contract state variables (and getters) to get rid of gaps. This will make contract upgrades more convenient and safer.
Also, in any case, it is more profitable for us to form the state in structures, pointers to which can be passed to libraries in order to save space in the main contract.
Previously, upgradeable contracts used to have a
__gap
variable in storage between inherited contracts in order to reserve space for supporting new variables added between upgrades. But, in this new version storage locations are namespaced using ERC-7201 so that variables can be added without compromising previously stored variables.
-- Introducing OpenZeppelin Contracts 5.0
Base ERC7201 contract cant be implemented at this time while solidity has no generics. Read more OpenZeppelin/openzeppelin-contracts#4696
To develop a subgraph, we need the most complete information about the operation of all parts of the system in the logs.
If the data is of interest to analytics and can be sent to logs, then it should be sent there.
Some required events are described in // todo
comments in the code.
Rekt vault expected.
Earn Merkl rewards by Gamma LP.
Strategy need ability to create veNFT and increase lock time and amount.
Deployed.
Earn Merkl rewards by Ichi Yield IQ strategy.
Protocol: Synapse Interchain Network
Interface: IInterChainAdapter
Adapter string ID: Synapse
Docs: Build on the Synapse Interchain Network
When creating a vault, the gas reserve for hardworks and rebalances must be contributed by the creator.
The boosted strategy receives increased rewards when staking liquidity in Gauges or holding LPs with using veTOKEN power for boost.
This is implemented by staking/holding liquidity through single contract (is IBooster) to which the VE-boost power is delegated or holded veTOKEN management supported.
Such logic was implemented in Tetu V1 GaugeDepositor for Balancer DeX.
This base strategy must be universal.
Booster can be implemented with linked ERC20 liquid staking token that represents shares of locked RETRO.
Booster ownership liquid staking voting escrow token.
The view functions needs to be implemented and refactored to effectively integrate with the frontend (stability-ui).
IPlatform.getData
bcAssets
(for ZAP)dexAggregators
IVaultManager.vaults()
totalApr
strategyApr
name
IVaultManager.vaultInfo(address vault)
assetsWithApr
, assetsAprs
AMM adapter for GyroECLP pools.
Protocol: Gyroscope
Interface: IAMMAdapter
Adapter string ID: Gyroscope
The strategy cannot be implemented now until the base contracts and interfaces are implemented.
A good way to get acquainted with fill-up strategies is to read the thesis Providing Liquidity in Uniswap V3. Then itβs worth reading the implementation code, for example, in the Gamma's Hypervisor.sol.
While Gamma sets fill-up parameters during rebalancing in the parameters by its authorized address, in our implementation we must set the primary value of the fill-up liquidity proportion and direction, and rebalancing must be carried out entirely based on the on-chain logic of the strategy.
At the same time, we can use a highly rounded proportion of fill-up liquidity and its direction to uniqueize the vaults working with the current strategy.
Setting the initial values of the proportion and direction of the fill-up will be used when creating vaults, which are the underlying tokens of ve-tokens.
LPStrategyBase
AmmAdapterIdLib.UNISWAPV3
VaultBase + IVault
previewWithdraw
address receiver
paramIVault.uniqueInitParamLength() external view returns (uint uiniqueInitAddresses, uint uniqueInitNumvs)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.