Contract Integration

Interfaces

All of the necessary interfaces to interact with Verio protocol functions (staking and re-staking) can be found in the Integration repositoryarrow-up-right.

Staking Examples

The following are some example contract integrations that utilize the staking function ComponentSelector and various protocol components.

Setup

import { IComponentSelector } from "path/to/staking/IComponentSelector.sol";
import { IStakePool } from "path/to/staking/IStakePool.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
// ...
address private constant VERIO_IP_COMPONENT_SELECTOR = address(0); // fill me in
// ...
IComponentSelector componentSelector = IComponentSelector(VERIO_IP_COMPONENT_SELECTOR);

Calculating vIP : IP Ratio

function _calculateVIPMintForStakeAmount(uint256 _ip) internal returns (uint256) {
    // calculate the amount of vIP to mint given an amount of IP
    return componentSelector.stakePool().calculateVIPMint(_ip);
}

Check vIP balance

Staking

Last updated