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
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, 10000
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
function canPushMulti() public override pure returns (bool) { return true; }
canPull()
canPull()
Permission for owner to call pullFromLocker()
. See ZivoeLocker.sol
function canPull() public override pure returns (bool) { return true; }
canPullPartial()
canPullPartial()
Permission for owner to call pullFromLockerPartial()
. See ZivoeLocker.sol
function canPullPartial() public override pure returns (bool) { return true; }
fetchBasis()
fetchBasis()
Returns amount of pairAsset redeemable with current LP position.
function pairAssetConvertible() public view returns (uint256 amout, uint256 lp);
Returns
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.
function pushToLockerMulti(
address[] calldata assets,
uint256[] calldata amounts,
bytes[] calldata data
) external override onlyOwner nonReentrant;
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.
function pullFromLocker(
address asset,
bytes calldata data
) external override onlyOwner nonReentrant;
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.
function pullFromLockerPartial(
address asset,
uint256 amount,
bytes calldata data
) external override onlyOwner nonReentrant;
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.
function forwardYield() external;
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.
function updateCompoundingRateBIPS(uint256 _compoundingRateBIPS) external;
uint256
_compoundingRateBIPS
The new compounding rate value.
Emits the UpdatedCompoundingRateBIPS() event
updateOCTYDL()
updateOCTYDL()
Updates the OCT_YDL endpoint.
function updateOCTYDL(address _OCT_YDL) external;
address
_OCT_YDL
The new address for OCT_YDL.
Emits the UpdatedOCTYDL() event
Events
LiquidityTokensBurned()
LiquidityTokensBurned()
Emitted during pullFromLocker(), pullFromLockerPartial(), and forwardYield()
event LiquidityTokensBurned(
uint256 amountBurned,
uint256 claimedZVE,
uint256 claimedPairAsset
);
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()
event LiquidityTokensMinted(
uint256 amountMinted,
uint256 depositedZVE,
uint256 depositedPairAsset
);
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()
event UpdatedCompoundingRateBIPS(uint256 oldValue, uint256 newValue);
uint256
False
oldValue
The old value of compoundingRateBIPS.
uint256
False
newValue
The new value of compoundingRateBIPS.
UpdatedOCTYDL()
UpdatedOCTYDL()
Emitted during updateOCTYDL()
event UpdatedOCTYDL(address indexed newOCT, address indexed oldOCT);
address
True
newOCT
The new OCT_YDL contract.
address
True
oldOCT
The old OCT_YDL contract.
YieldForwarded()
YieldForwarded()
Emitted during forwardYield()
event YieldForwarded(address indexed asset, uint256 amount);
address
True
asset
The "asset" being distributed.
uint256
False
amount
The amount distributed.
Last updated