OCL_ZVE.sol
OCL -> On-Chain Liquidity (Sushi, Uniswap)
Introduction
This contract manages liquidity provisioning for a Uniswap V2 or Sushi pool.
This contract has the following responsibilities:
Allocate capital to a $ZVE/pairAsset pool.
Remove capital from a $ZVE/pairAsset pool.
Forward yield (profits) every 30 days to the YDL with compounding mechanisms.
State Variables
Type | Name | Description |
---|---|---|
address | GBL | The ZivoeGlobals contract. |
address | factory | Address for the Factory (Uniswap v2 or Sushi). |
address | pairAsset | ERC20 that will be paired with $ZVE for Sushi pool. |
address | router | Address for the Router (Uniswap v2 or Sushi). |
address | OCT_YDL | Facilitates swaps and forwards distributedAsset() to YDL. |
uint256 | basis | The basis used for forwardYield() accounting. |
uint256 | compoundingRateBIPS | The % of returns to retain, in BIPS. |
uint256 | nextYieldDistribution | Determines next available forwardYield() call. |
uint256 | BIPS | Private constant, |
Sections
canPushMulti() - Permission for owner to call
pushToLockerMulti()
. See ZivoeLocker.solcanPull() - Permission for owner to call
pullFromLocker()
. See ZivoeLocker.solcanPullPartial() - Permission for owner to call
pullFromLockerPartial()
. See ZivoeLocker.solfetchBasis() - Returns amount of pairAsset redeemable with current LP position.
pushToLockerMulti() - This pulls capital from the DAO and adds liquidity into a $ZVE/pairAsset pool.
pullFromLocker() - This burns all LP tokens owned by the contract from the $ZVE/pairAsset pool and returns them to the DAO.
pullFromLockerPartial() - This burns LP tokens from the $ZVE/pairAsset pool and returns them to the DAO.
forwardYield() - This forwards yield to the YDL in the form of pairAsset.
updateCompoundingRateBIPS() - Updates the compounding rate of this contract.
updateOCTYDL() - Updates the OCT_YDL endpoint.
Read Functions
canPushMulti()
canPushMulti()
Permission for owner to call pushToLockerMulti()
. See ZivoeLocker.sol
canPull()
canPull()
Permission for owner to call pullFromLocker()
. See ZivoeLocker.sol
canPullPartial()
canPullPartial()
Permission for owner to call pullFromLockerPartial()
. See ZivoeLocker.sol
fetchBasis()
fetchBasis()
Returns amount of pairAsset redeemable with current LP position.
Returns
Type | Name | Description |
---|---|---|
uint256 | amount | Current pairAsset harvestable. |
uint256 | lp | Current ZVE/pairAsset LP tokens. |
Write Functions
pushToLockerMulti()
pushToLockerMulti()
This pulls capital from the DAO and adds liquidity into a $ZVE/pairAsset pool.
Type | Name | Description |
---|---|---|
address[] | assets | The assets to pull from the DAO. |
uint256[] | amounts | The amount to pull of each asset respectively. |
bytes[] | data | Accompanying transaction data. |
Emits the LiquidityTokensMinted() event
pullFromLocker()
pullFromLocker()
This burns all LP tokens owned by the contract from the $ZVE/pairAsset pool and returns them to the DAO.
Type | Name | Description |
---|---|---|
address | asset | The asset to burn. |
bytes | data | Accompanying transaction data. |
Emits the LiquidityTokensBurned() event
pullFromLockerPartial()
pullFromLockerPartial()
This burns LP tokens from the $ZVE/pairAsset pool and returns them to the DAO.
Type | Name | Description |
---|---|---|
address | asset | The asset to burn. |
uint256 | amount | The amount of "asset" to burn. |
bytes | data | Accompanying transaction data. |
Emits the LiquidityTokensBurned() event
forwardYield()
forwardYield()
This forwards yield to the YDL in the form of pairAsset. Requires that the block timestamp is greater than nextYieldDistribution
variable, see above.
Emits the YieldForwarded() event
updateCompoundingRateBIPS()
updateCompoundingRateBIPS()
Updates the compounding rate of this contract. A value of 2,000 represent 20% of the earnings stays in this contract, compounding.
Type | Name | Description |
---|---|---|
uint256 | _compoundingRateBIPS | The new compounding rate value. |
Emits the UpdatedCompoundingRateBIPS() event
updateOCTYDL()
updateOCTYDL()
Updates the OCT_YDL endpoint.
Type | Name | Description |
---|---|---|
address |
| The new address for OCT_YDL. |
Emits the UpdatedOCTYDL() event
Events
LiquidityTokensBurned()
LiquidityTokensBurned()
Emitted during pullFromLocker(), pullFromLockerPartial(), and forwardYield()
Type | Indexed | Name | Description |
---|---|---|---|
uint256 | False | amountBurned | Amount of liquidity tokens burned. |
uint256 | False | claimedZVE | Amount of ZVE claimed. |
uint256 | False | claimedPairAsset | Amount of pairAsset claimed. |
LiquidityTokensMinted()
LiquidityTokensMinted()
Emitted during pushToLockerMulti()
Type | Indexed | Name | Description |
---|---|---|---|
uint256 | False | amountMinted | Amount of liquidity tokens minted. |
uint256 | False | depositedZVE | Amount of ZVE deposited. |
uint256 | False | depositedPairAsset | Amount of pairAsset deposited. |
UpdatedCompoundingRateBIPS()
UpdatedCompoundingRateBIPS()
Emitted during updateCompoundingRateBIPS()
Type | Indexed | Name | Description |
---|---|---|---|
uint256 | False | oldValue | The old value of compoundingRateBIPS. |
uint256 | False | newValue | The new value of compoundingRateBIPS. |
UpdatedOCTYDL()
UpdatedOCTYDL()
Emitted during updateOCTYDL()
Type | Indexed | Name | Description |
---|---|---|---|
address | True | newOCT | The new OCT_YDL contract. |
address | True | oldOCT | The old OCT_YDL contract. |
YieldForwarded()
YieldForwarded()
Emitted during forwardYield()
Type | Indexed | Name | Description |
---|---|---|---|
address | True | asset | The "asset" being distributed. |
uint256 | False | amount | The amount distributed. |
Last updated