ExampleStaking
ExampleStaking
_ExampleStaking is used to show how to use the IOCPRouter.
ExampleStaking will set the router
, remoteChainId
, and depositToken
variables in the constructor. And these variables will be immutable. Staking will use the router
to mint and redeem OmniTokens for the depositToken
. Staking will use the remoteChainId
to mint and redeem OmniTokens on the remote chain.
The stakingDepositCall
function is used to deposit tokens into the pool. The stakingDepositCall
function will call the omniMint
function on the router.
The withdraw
function is used to withdraw tokens from the pool. The withdraw
function will call the omniRedeem
function on the router.
The claimRewards
function is used to claim rewards from the pool. The claimRewards
function will call the omniRedeem
function on the router. The claimRewards
function will call the omniMint
function on the router for the rewards.
The IOCPRouter is used to mint and redeem OmniTokens. OmniTokens are minted when tokens are deposited into the pool. OmniTokens are redeemed when tokens are withdrawn from the pool._
router
depositToken
remoteChainId
constructor
_constructor is used to set the router
, remoteChainId
, and depositToken
variables.
The router
variable is the address of the OCP Router. The remoteChainId
variable is the chainId of the remote chain. The depositToken
variable is the address of the token to deposit. The router
, remoteChainId
, and depositToken
variables are immutable._
Parameters
_router
address
The address of the OCP Router.
_remoteChainId
uint16
The chainId of the remote chain.
_depositToken
address
The address of the token to deposit.
stakingDepositCall
_stakingDepositCall is used to deposit tokens into the pool.
The stakingDepositCall
function will call the omniMint
function on the router. The omniMint
function will mint OmniTokens for the depositToken
to the address specified in the omniMint
function. The omniMint
function will mint OmniTokens for the depositToken
using the convertRate
function._
Parameters
_amountIn
uint256
The amount of tokens to deposit.
withdraw
_withdraw is used to withdraw tokens from the pool.
The withdraw
function will call the omniRedeem
function on the router. The omniRedeem
function will redeem OmniTokens for the depositToken
to the address specified in the omniRedeem
function._
Parameters
_amountIn
uint256
The amount of tokens to withdraw.
claimRewards
_claimRewards is used to claim rewards from the pool.
The claimRewards
function will call the omniRedeem
function on the router. The omniRedeem
function will redeem OmniTokens for the depositToken
to the address specified in the omniRedeem
function. The claimRewards
function will call the omniMint
function on the router for the rewards._
Last updated