APE Staking
This documentation aims to summarize all the related APE staking contract interfaces and their roles.
APE staking at Parallel is offered in multiple forms:
APE only staking with AutoCompounding (cAPE)
Staking APE with a supplied collateral (BAYC/MAYC) with or without a paired BAKC
P2P APE staking matching APE and BAYC/MAYC/BAKC listings
APE only staking with AutoCompounding (cAPE)
To stake APE only in the auto compounding pool, user will use the AutoCompoundApe
smart contract to deposit their APE. In return, the user will be minted cAPE token shares, which will represented their staking position.
Interfaces
This interface allows users to deposit their APE tokens into the auto-compounding pool. The onBehalf
parameter can be used to deposit tokens on behalf of another address. The amount
parameter specifies the amount of APE tokens to deposit.
To deposit APE into AutoCompounding pool and supply the cAPE to the money market in one transaction, we have developed a contract called HelperContract
that has the function mentioned above.
This function is to withdraw the pcAPE (supplied cAPE ino the money market) back to APE. Which is also in the HelperContract
This interface allows users to withdraw their deposited APE tokens from the auto-compounding pool. The amount
parameter specifies the amount of cAPE tokens to withdraw, which will be burned upon withdrawal and the corresponding amount of APE tokens will be transferred back to the user.
The getShareByPooledApe
interface can be used to get the amount of shares that corresponds to a specified amount of protocol-controlled APE.
This is useful when a user wants to know how many cAPE token shares they will receive for a certain amount of APE tokens before depositing them into the auto-compounding pool.
For more test cases and examples, checkout our github repo
Staking APE with a supplied collateral (BAYC/MAYC) with or without a paired BAKC
After supplying their BAYC/MAYC, users can then stake any amount of APE with their supplied collateral. The contract used for all collateral staking is the Parallel’s main Pool
contract.
Interfaces
This interface can be used to stake APE specific supplied collaterals. The APE to be staked can be either provided directly from the user wallet, borrowed from Parallel or a combination of both. this can be specified in the stakingInfo
param as outlined above. example of staking info can be:
The withdrawApeCoin
interface can be used to withdraw staked ApeCoin from the BAYC/MAYC pool. The nftAsset
parameter specifies the contract address of BAYC/MAYC, while the _nfts
parameter is an array of BAYC/MAYC NFT's with staked amounts. A user needs to have a health factor greater than 1 after the withdraw in order to withdraw their staked ApeCoin successfully.
The claimApeCoin
interface can be used to claim rewards for an array of tokenIds from the BAYC/MAYC pool. The nftAsset
parameter specifies the contract address of BAYC/MAYC, while the _nfts
parameter is an array of NFTs owned and committed by the msg.sender. A user needs to have a health factor greater than 1 after the claim in order to successfully claim their rewards.
The withdrawBAKC
interface can be used to withdraw staked BAKC from the BAYC/MAYC pool. The nftAsset
parameter specifies the contract address of BAYC/MAYC, while the _nftPairs
parameter is an array of paired BAYC/MAYC NFT's with staked amounts. A user needs to have a health factor greater than 1 after the withdraw in order to withdraw their staked BAKC successfully.
The claimBAKC
interface can be used to claim rewards for an array of paired BAYC/MAYC NFT's from the BAYC/MAYC pool. The nftAsset
parameter specifies the contract address of BAYC/MAYC, while the _nftPairs
parameter is an array of paired BAYC/MAYC NFT's. A user needs to have a health factor greater than 1 after the claim in order to successfully claim their rewards.
The unstakeApePositionAndRepay
interface allows users to unstake their ApeCoin staking position and repay their debt. The nftAsset
parameter specifies the contract address of BAYC/MAYC, while the tokenId
parameter specifies the token id of the ape staking position. The position owner can call this at anytime. However, anyone can also call this function if the owner’s HF us below 1.
The claimApeAndCompound
interface can be used to claim user Ape coin rewards and deposit them to ape compound to get cApe, then deposit cApe to lending pool for users. The nftAsset
parameter specifies the contract address of BAYC/MAYC, while the users
and tokenIds
parameters are arrays of user addresses and user tokenId arrays, respectively.
This interface can be used to claim user BAYC/MAYC paired Ape coin rewards and deposit them to ape compound to get cApe, then deposit cApe to lending pool for users. The nftAsset
parameter specifies the contract address of BAYC/MAYC, while the users
and _nftPairs
parameters are arrays of user addresses and paired BAYC/MAYC NFT's arrays, respectively.
For more test cases and examples, checkout our github repo
P2P APE staking matching APE and BAYC/MAYC/BAKC listings
Data Structures
Interfaces
The matchPairStakingList
interface can be used to match an apeOrder(BAYC/MAYC) with an apeCoinOrder (APE) to pair staking. The apeOrder
parameter specifies the BAYC/MAYC owner's listing order, while the apeCoinOrder
parameter specifies the APE Coin owner's listing order. The function returns a matched order hash.
The matchBAKCPairStakingList
interface can be used to match an apeOrder(BAYC/MAYC) and a bakcOrder(BAKC) with an apeCoinOrder (APE) to pair staking. The apeOrder
parameter specifies the BAYC/MAYC owner's listing order, while the bakcOrder
parameter specifies the BAKC owner's listing order. The apeCoinOrder
parameter specifies the APE Coin owner's listing order. The function returns a matched order hash.
The cancelListing
interface allows users to cancel a listing order, which cannot be matched after it has been canceled. The listingOrder
parameter specifies the details of the order to be canceled.
The breakUpMatchedOrder
interface allows a participant of a matched pair staking order to break it up. The orderHash
parameter specifies the hash of the matched order to be broken up. Once broken up, the staking positions will be returned to their original owners.
The claimForMatchedOrderAndCompound
interface can be used to claim pending rewards for matched pair staking orders and deposit them as cApe for users to compound. The orderHashes
parameter is an array of the hash of the matched orders to be claimed.
The claimCApeReward
interface can be used to claim user compounded cApe. The receiver
parameter specifies the address of the cApe receiver. This function can be used to claim cApe rewards that have been compounded from user's APE rewards from staking APE with supplied collateral.
The pendingCApeReward
interface can be used to check the pending cAPE reward owned by a user. The user
parameter specifies the address of the user, while the function returns the amount of cAPE owned by the user that has not yet been claimed. This function can be useful for users who want to keep track of their pending rewards before claiming them.
For more test cases and examples, checkout our github repo
Last updated