WConvexPools
The WConvexPools
contract is a wrapper for Convex Finance LP token positions, allowing leverage to be applied to the LP tokens. The contract is designed to hold the leveraged LP tokens in the BlueberryBank and does not generate yields. LP tokens are identified by tokenIds encoded from the LP token address.
The contract inherits from ERC1155Upgradeable
, ReentrancyGuardUpgradeable
, OwnableUpgradeable
, EnsureApprove
, IERC20Wrapper
, and IWConvexPools
.
Contract Initialization
The initialize
function initializes the contract with the addresses of the CVX token and Convex Pools contract.
Functions
encodeId
The encodeId
function encodes the pool id (pid) and CVX amount per share (cvxPerShare) into an ERC1155 token id.
decodeId
The decodeId
function decodes an ERC1155 token id into the pool id (pid) and CVX amount per share (cvxPerShare).
getUnderlyingToken
The getUnderlyingToken
function returns the underlying ERC20 token for the given ERC1155 token id.
getPoolInfoFromPoolId
The getPoolInfoFromPoolId
function returns the pool information (LP token, token, gauge, CRV rewards, stash, and shutdown status) for the given pool id.
pendingRewards
The pendingRewards
function returns the pending rewards for the given ERC1155 token id and amount. Rewards can be multiple tokens.
mint
The mint
function mints an ERC1155 token for the given LP token. It takes the Convex Pool id and token amount to wrap as input.
burn
The burn
function burns the ERC1155 token to redeem the underlying ERC20 token. It takes the token id and amount to burn as input.
Last updated