vsuite-integrations
Documentation of vsuite-integrations
The vsuite-integrations are contracts built on top of vsuite to offer ethereum staking services to end users
Dependencies
You can then install all the other dependencies by running
make install
Installation
git clone git@github.com:kilnfi/vsuite.git --recurse-submodules
Testing
Unit Testing
Unit tests can be found in most of the files inside the test directory. You can run all the unit tests by doing.
make test
E2E Testing
A suite of E2E test files can be found in test/e2e. This test suite will use the deployment scripts found in scripts to run the deployment process inside a local anvil node. Then it will run tests on top of that state. You will need a running instance of anvil to run these tests.
You can run all the E2E tests by doing
# In one terminal that we leave opened
anvil
# In another terminal
make test-e2e
Gas Snapshotting
Some tests contain manual gas snapshots. You can usually find these tests inside the E2E test suites. The generated gas snapshots can be found in .forge-snapshots.
Tests will fail if the resulting gas snapshot value does not match the one stored on file. In order to override the files on disk, you can run
# In one terminal that we leave opened
anvil
# In another terminal
make test-force-snapshots test-e2e-force-snapshots
Static Analysis
You can run slither on the repository by running
make analyze
Formatting
You can format the repository by using
make format
and verify the formatting by running
make test-format
Deployment
The deployment uses the deploy.sol library to create artifacts using solidity.
Configuring a deployment
The configuration for a deployment can be made in a dedicated file that contains all the configuration variables required to deploy the system. Here is the example for the goerli configuration
And the Deploy.s.sol contract must be tweaked to add the network in the setUp() method.
Required variables to deploy integration contracts
admin: This address is the administrator of the integration deployment factory.proxyAdmin: This address is required to be a different one than the admin as we use a Transparent Proxy pattern.
Fixes
The same steps found in the kilnfi/vsuite repository README can be applied to deploy a fix to an integration contract.
Contents
Contents
- Native20FORKFIXTest
- Native20_Fix_09_12_Invalid_Fork.t constants
- Native20_Fix_09_12_Oracle_Report_Test_FORK
- Native20_Fix_09_12_Oracle_Report_CDC
- Native20_Fix_09_12_Oracle_Report_Ledger
Native20FORKFIXTest
Inherits: Test
State Variables
fixL
address fixL;
fixC
address fixC;
hatchersAdmin
address internal constant hatchersAdmin = 0x418c1F1F83Cf34C0eA8bCfCe951c5D7531789754;
vPoolHatcher
Hatcher internal constant vPoolHatcher = Hatcher(0x1D6103243d0507a9d1314bAC09379Bf57a5CF155);
vps
address internal constant vps = 0x00a0BE1BBC0C99898dF7e6524Bf16e893c1e3bB9;
ledger
Native20 internal constant ledger = Native20(0x5DB5235b5C7e247488784986e58019fFFd98FdA4);
ledger_admin
address internal constant ledger_admin = 0x06647B1C6286772d376b923e85623a39172DE7d1;
crypto
Native20 internal constant crypto = Native20(0x437636e4b984EAe19045626AA269a89f906cf96c);
crypto_admin
address internal constant crypto_admin = 0x208e5eF8ABD863fCBDDF60ad4Bb7d0913fA4F968;
native20_impl
address internal constant native20_impl = 0x0843359caE1187b432eEb26E1B40c3a2B2374D7E;
Functions
setUp
function setUp() external;
test_fixed_ledger
function test_fixed_ledger(uint256 amount) external;
test_fixed_cdc
function test_fixed_cdc(uint256 amount) external;
Constants
NATIVE20_IMPLEM
address constant NATIVE20_IMPLEM = 0xd0A52e4e860e34B44994842F09758A0A06b02506;
EXIT_QUEUE
vExitQueue constant EXIT_QUEUE = vExitQueue(0x8d6Fd650500f82c7D978a440348e5a9b886943bF);
PROXY_ADMIN
address constant PROXY_ADMIN = 0x06647B1C6286772d376b923e85623a39172DE7d1;
Native20_Fix_09_12_Oracle_Report_Test_FORK
Inherits: Test
State Variables
hatchersAdmin
address internal constant hatchersAdmin = 0x418c1F1F83Cf34C0eA8bCfCe951c5D7531789754;
ledger
address internal constant ledger = 0x5DB5235b5C7e247488784986e58019fFFd98FdA4;
ledger_admin
address internal constant ledger_admin = 0x06647B1C6286772d376b923e85623a39172DE7d1;
crypto
address internal constant crypto = 0x437636e4b984EAe19045626AA269a89f906cf96c;
crypto_admin
address internal constant crypto_admin = 0x208e5eF8ABD863fCBDDF60ad4Bb7d0913fA4F968;
native20_impl
address internal constant native20_impl = 0x0843359caE1187b432eEb26E1B40c3a2B2374D7E;
vPoolHatcher
Hatcher internal constant vPoolHatcher = Hatcher(0x1D6103243d0507a9d1314bAC09379Bf57a5CF155);
vps
address internal constant vps = 0x00a0BE1BBC0C99898dF7e6524Bf16e893c1e3bB9;
native20FixLedger
Native20_Fix_09_12_Oracle_Report_Ledger internal native20FixLedger;
native20FixCDC
Native20_Fix_09_12_Oracle_Report_CDC internal native20FixCDC;
Functions
setUp
function setUp() external;
test_Fix_Ledger
function test_Fix_Ledger() external;
test_Fix_CDC
function test_Fix_CDC() external;
Native20_Fix_09_12_Oracle_Report_CDC
Inherits: MultiPool20, Implementation, Initializable
Native20 with fix for CDC
Functions
fix
function fix() external;
_stake_fix
copy paste of multiPool20._stake() with customizable staker
function _stake_fix(uint256 totalAmount, address staker) internal notPaused returns (bool);
Events
CommissionSharesReturnedFix091223
event CommissionSharesReturnedFix091223(uint256 shares, uint256 poolId, uint256 eth);
Native20_Fix_09_12_Oracle_Report_Ledger
Inherits: MultiPool20, Implementation, Initializable
Native20 with fix for ledger
Functions
fix
function fix() external;
_stake_fix
function _stake_fix(uint256 totalAmount, address staker) internal notPaused returns (bool);
Events
CommissionSharesReturnedFix091223
event CommissionSharesReturnedFix091223(uint256 shares, uint256 poolId, uint256 eth);
Contents
- IERC4907
- IExitQueueClaimHelper
- IFeeDispatcher
- IIntegrationFactory
- ILiquid1155
- ILiquid20
- IMerkleVault
- PoolStakeDetails
- PoolExitDetails
- IMultiPool
- IMultiPool1155
- IMultiPool20
- Native1155Configuration
- INative1155
- Native20Configuration
- INative20
- IvNFT
IERC4907
Author: mortimr @ Kiln
Allows NFT owners to rent without changing the NFT ownership, only renting the utility of the NFT
Functions
setUser
Set the user and expires of an NFT. Once the rent is defined, only the rentee can edit or revoke the rent
function setUser(uint256 tokenId, address user, uint64 expires) external;
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | The id of the token to rent |
user | address | The new user of the NFT |
expires | uint64 | UNIX timestamp, The new user could use the NFT before expires |
userOf
Get the user address of an NFT
The zero address indicates that there is no user or the user is expired
function userOf(uint256 tokenId) external view returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | The NFT to get the user address for |
Returns
| Name | Type | Description |
|---|---|---|
<none> | address | The user address for this NFT |
userExpires
Get the user expires of an NFT
The zero value indicates that there is no user
function userExpires(uint256 tokenId) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | The NFT to get the user expires for |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The user expires for this NFT |
Events
UpdateUser
Emitted when the user of an NFT or the expires of the user is changed
event UpdateUser(uint256 indexed tokenId, address indexed user, uint64 expires);
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | The ID of the token |
user | address | The new user of the token |
expires | uint64 | The expiration timestamp of the rental |
IExitQueueClaimHelper
Author: gauthiermyr @ Kiln
Functions
multiResolve
Resolve a list of casksIds for given exitQueues and tickets
function multiResolve(address[] calldata exitQueues, uint256[][] calldata ticketIds)
external
view
returns (int64[][] memory caskIdsOrErrors);
Parameters
| Name | Type | Description |
|---|---|---|
exitQueues | address[] | List of exit queues |
ticketIds | uint256[][] | List of tickets in each exit queue |
multiClaim
Claim caskIds for given tickets on each exit queue
function multiClaim(address[] calldata exitQueues, uint256[][] calldata ticketIds, uint32[][] calldata casksIds)
external
returns (IvExitQueue.ClaimStatus[][] memory statuse);
Parameters
| Name | Type | Description |
|---|---|---|
exitQueues | address[] | List of exit queues |
ticketIds | uint256[][] | List of tickets in each exit queue |
casksIds | uint32[][] | List of caskIds to claim with each ticket |
IFeeDispatcher
Author: 0xvv @ Kiln
This contract contains functions to dispatch the ETH in a contract upon withdrawal.
Functions
withdrawCommission
Allows the integrator to withdraw the ETH in the contract.
function withdrawCommission() external;
Events
NewCommissionSplit
Emitted when the commission split is changed.
event NewCommissionSplit(address[] recipients, uint256[] splits);
Parameters
| Name | Type | Description |
|---|---|---|
recipients | address[] | The addresses of recipients |
splits | uint256[] | The percentage of each recipient in basis points |
CommissionWithdrawn
Emitted when the integrator withdraws ETH
event CommissionWithdrawn(address indexed withdrawer, uint256 amountWithdrawn);
Parameters
| Name | Type | Description |
|---|---|---|
withdrawer | address | address withdrawing the ETH |
amountWithdrawn | uint256 | amount of ETH withdrawn |
Errors
UnequalLengths
Thrown when functions are given lists of different length in batch arguments
error UnequalLengths(uint256 lengthA, uint256 lengthB);
Parameters
| Name | Type | Description |
|---|---|---|
lengthA | uint256 | First argument length |
lengthB | uint256 | Second argument length |
Reentrancy
Thrown when a function is called while the contract is locked
error Reentrancy();
IIntegrationFactory
Author: gauthiermyr @ Kiln
IntegrationFactory deploys predefined integrations contracts through a ProxyFactory.
Functions
initialize
Initializes the contract with the given parameters.
function initialize(address admin_) external;
Parameters
| Name | Type | Description |
|---|---|---|
admin_ | address | Factory admin |
deployNative20vPoolIntegration
Deploy a proxy for the implementation of a Native vPool integration contract
function deployNative20vPoolIntegration(address proxyOwner, bytes calldata cdata) external returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
cdata | bytes | The initial calldata |
deployNative20vPoolIntegration
Deploy a proxy for the implementation of a Native vPool integration contract
function deployNative20vPoolIntegration(address proxyOwner, Native20Configuration calldata config) external returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
config | Native20Configuration | The parameters to initialize the contract. |
deployLiquid20AvPoolIntegration
Deploy a proxy for the implementation of a liquid ERC20 aToken vPool integration contract
function deployLiquid20AvPoolIntegration(address proxyOwner, Native20Configuration calldata config) external returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
config | Native20Configuration | The parameters to initialize the contract. |
deployLiquid20CvPoolIntegration
Deploy a proxy for the implementation of a liquid ERC20 cToken vPool integration contract
function deployLiquid20CvPoolIntegration(address proxyOwner, Native20Configuration calldata config) external returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
config | Native20Configuration | The parameters to initialize the contract. |
deployLiquid20AvPoolIntegration
Deploy a proxy for the implementation of a liquid ERC20 aToken vPool integration contract
function deployLiquid20AvPoolIntegration(address proxyOwner, bytes calldata cdata) external returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
cdata | bytes | The initial calldata |
deployLiquid20CvPoolIntegration
Deploy a proxy for the implementation of a liquid ERC20 cToken vPool integration contract
function deployLiquid20CvPoolIntegration(address proxyOwner, bytes calldata cdata) external returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
cdata | bytes | The initial calldata |
deployNative1155vPoolIntegration
Deploy a proxy for the implementation of a native 1155 vPool integration contract
function deployNative1155vPoolIntegration(address proxyOwner, Native1155Configuration calldata config) external returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
config | Native1155Configuration | The parameters to initialize the contract. |
deployLiquid1155vPoolIntegration
Deploy a proxy for the implementation of a liquid 1155 vPool integration contract
function deployLiquid1155vPoolIntegration(address proxyOwner, Native1155Configuration calldata config) external returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
config | Native1155Configuration | The parameters to initialize the contract |
deployNative1155vPoolIntegration
Deploy a proxy for the implementation of a native 1155 vPool integration contract
function deployNative1155vPoolIntegration(address proxyOwner, bytes calldata cdata) external returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
cdata | bytes | The initial calldata |
deployLiquid1155vPoolIntegration
Deploy a proxy for the implementation of a liquid 1155 vPool integration contract
function deployLiquid1155vPoolIntegration(address proxyOwner, bytes calldata cdata) external returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
cdata | bytes | The initial calldata |
deployVNFTIntegration
Deploy a proxy for the implementation of a vNFT integration contract
function deployVNFTIntegration(address proxyOwner, bytes calldata cdata) external returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
cdata | bytes | The initial calldata |
deployVNFTIntegration
function deployVNFTIntegration(address proxyOwner, IvNFT.VNFTConfiguration calldata config) external returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
config | IvNFT.VNFTConfiguration | The parameters to initialize the contract. |
updateImplementation
Update the channel implementation address
function updateImplementation(bytes32 channel, address implem, bool updateRequired) external;
Parameters
| Name | Type | Description |
|---|---|---|
channel | bytes32 | Channel to update |
implem | address | New implementation address for the channel |
updateRequired | bool | If true it will prevent from deploying an instance with the old implementation parameters |
setDeployer
Allow or disallow an address to deploy integration contracts
function setDeployer(address deployer, bool allowed) external;
Parameters
| Name | Type | Description |
|---|---|---|
deployer | address | Address of the deployer |
allowed | bool | Allowed or not |
factory
retrieve the proxy factory address
function factory(bytes32 channel) external view returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
channel | bytes32 | channel identifier |
implementation
retrieve the implementation address for a channel
function implementation(bytes32 channel) external view returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
channel | bytes32 | channel identifier |
outdated
retrieve whether the implementation for a channel is outdated
function outdated(bytes32 channel) external view returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
channel | bytes32 | channel identifier |
Events
DeployerUpdated
Emitted when a deployer is allowed or disallowed
event DeployerUpdated(address indexed deployer, bool allowed);
Parameters
| Name | Type | Description |
|---|---|---|
deployer | address | Deployer allowed/disallowed |
allowed | bool | Allowed or not |
ChannelImplementationUpdated
Emitted when an implementation is updated
event ChannelImplementationUpdated(bytes32 indexed channel, address implem, bool updateRequired);
Parameters
| Name | Type | Description |
|---|---|---|
channel | bytes32 | Channel to update |
implem | address | New implementation |
updateRequired | bool | True for a channel if the related implementation requires a factory update |
ProxyFactoryDeployed
Emitted when a ProxyFactory is deployed for a channel
event ProxyFactoryDeployed(bytes32 indexed channel, address factory);
Parameters
| Name | Type | Description |
|---|---|---|
channel | bytes32 | Channel to update |
factory | address | New implementation |
Errors
NotAnAllowedDeployer
Thrown when someone not allowed is trying to deploy an integration
error NotAnAllowedDeployer();
FactoryUpdateRequired
Thrown when we try to deploy an outdated implementation
error FactoryUpdateRequired(bytes32 channel);
Parameters
| Name | Type | Description |
|---|---|---|
channel | bytes32 | The channel that requires an update |
ChannelNotInitialized
Thrown when we try to deploy an integration for a channel that is not initialized
error ChannelNotInitialized(bytes32 channel);
Parameters
| Name | Type | Description |
|---|---|---|
channel | bytes32 | The channel that requires initialization |
ILiquid1155
Inherits: IERC165
Author: 0xvv @ Kiln
This contract allows users to stake in any of the vPools with any amount of ETH and track their position. Users are given transferable shares to track their stake, shares of different pools are not equivalent. Users can interact with the contract using the ERC-1155 interface.
Functions
setApprovalForAll
Give the right to an operator to transfer all tokens of the sender.
function setApprovalForAll(address operator, bool approved) external;
Parameters
| Name | Type | Description |
|---|---|---|
operator | address | The address of the operator. |
approved | bool | The status of the operator. |
isApprovedForAll
Returns the operator status of an operator for a given owner.
function isApprovedForAll(address account, address operator) external view returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The address of the owner. |
operator | address | The address of the operator. |
safeTransferFrom
Transfers amount tokens of token type id from from to to with extra data.
The caller must be operator of 'from' or 'from' & 'from' must have a balance of at least amount.
function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;
Parameters
| Name | Type | Description |
|---|---|---|
from | address | The address of the sender. |
to | address | The address of the receiver. |
id | uint256 | The id of the token. |
amount | uint256 | The token amount. |
data | bytes | The data passed to the receiver. |
safeBatchTransferFrom
Batched version of safeTransferFrom.
function safeBatchTransferFrom(address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data)
external;
Parameters
| Name | Type | Description |
|---|---|---|
from | address | The address of the sender. |
to | address | The address of the receiver. |
ids | uint256[] | The ids of the tokens. |
amounts | uint256[] | The token amounts. |
data | bytes | The data passed to the receiver. |
Events
ApprovalForAll
Emitted when the status of an operator is changed.
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The account of the owner. |
operator | address | The operator whose status is being updated. |
approved | bool | The new status of the operator. |
Errors
ApprovalForSelf
Emitted when a user trier to approve themselves.
error ApprovalForSelf();
ReceiverRejected
Emitted when a the ERC-1155 receiver rejects the transfer.
error ReceiverRejected(address receiver, uint256 id, uint256 amount, bytes data);
Parameters
| Name | Type | Description |
|---|---|---|
receiver | address | The address of the receiver. |
id | uint256 | The id of the token. |
amount | uint256 | The token amount. |
data | bytes | The data passed to the receiver. |
ReceiverRejectedBatch
Emitted when a the ERC-1155 receiver rejects a batch of transfers.
error ReceiverRejectedBatch(address receiver, uint256[] ids, uint256[] amounts, bytes data);
Parameters
| Name | Type | Description |
|---|---|---|
receiver | address | The address of the receiver. |
ids | uint256[] | The ids of the tokens. |
amounts | uint256[] | The token amounts. |
data | bytes | The data passed to the receiver. |
NotAnERC1155Receiver
Emitted when a transfer is attempted but the sender is not a receiver.
error NotAnERC1155Receiver(address receiver);
Parameters
| Name | Type | Description |
|---|---|---|
receiver | address | The address of the receiver. |
ILiquid20
Author: 0xvv @ Kiln
Contains functions to make the token liquid
Functions
transfer
Transfers token from the caller to another address
function transfer(address to, uint256 amount) external returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
to | address | The address to transfer to |
amount | uint256 | The amount to transfer |
allowance
Retrieves the amount of tokens that an owner allowed to a spender
function allowance(address owner, address spender) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
owner | address | The address of the owner |
spender | address | The address of the spender |
approve
Approves a spender to transfer tokens on the caller's behalf
function approve(address spender, uint256 amount) external returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
spender | address | The address of the spender |
amount | uint256 | The amount to approve |
transferFrom
Transfers tokens from one address to another, using the allowance mechanism
function transferFrom(address from, address to, uint256 amount) external returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
from | address | The address to transfer from |
to | address | The address to transfer to |
amount | uint256 |
IMerkleVault
Inherits: IAdministrable
Author: mortimr @ Kiln
Funds distribution vault using merkle proofs to authorize withdrawals
Functions
initialize
function initialize(address admin, bytes32 initialRoot, string calldata initialIpfsHash, uint256 initialFrameSize) external;
Parameters
| Name | Type | Description |
|---|---|---|
admin | address | The address able to update the merkle root |
initialRoot | bytes32 | The initial merkle root |
initialIpfsHash | string | The initial report ipfs hash |
initialFrameSize | uint256 | The initial frame size |
totalClaimedForAccount
Retrieve the total claimed amount for an account
function totalClaimedForAccount(address account) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The account to inspect |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The total claimed amount for the account |
totalClaimed
Retrieve the total claimed on the contract
function totalClaimed() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The total claimed amount |
root
Retrieve the current merkle root
function root() external view returns (bytes32);
Returns
| Name | Type | Description |
|---|---|---|
<none> | bytes32 | Current merkle root |
ipfsHash
Retrieve the ipfs hash holding the merkle tree + extra data
function ipfsHash() external view returns (string memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | string | The ipfs hash |
setRootAndIpfsHash
Set the current merkle root
function setRootAndIpfsHash(bytes32 newRoot, string calldata newIpfsHash) external;
Parameters
| Name | Type | Description |
|---|---|---|
newRoot | bytes32 | The new merkle root value |
newIpfsHash | string |
claim
Claims funds based on total claimed and current amount
function claim(address account, uint256 amount, bytes32[] calldata proofs) external;
Parameters
| Name | Type | Description |
|---|---|---|
account | address | |
amount | uint256 | The total amount of rewards claimable for the caller |
proofs | bytes32[] | The array of proofs to verify before claim |
frameSize
Retreive the number of epochs between two reports
function frameSize() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The number of epochs |
setFrameSize
Update the number of epochs between two reports
function setFrameSize(uint256 newFrameSize) external;
Parameters
| Name | Type | Description |
|---|---|---|
newFrameSize | uint256 | The new frame size |
fallback
fallback() external payable;
receive
receive() external payable;
Events
Claimed
Emitted when claim action occured
event Claimed(address account, uint256 amount, uint256 totalClaimed);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The account that claimed the rewards |
amount | uint256 | The amount claimed during the claim action |
totalClaimed | uint256 | The total amount claimed |
SetFrameSize
Emitted a new frame size is set
event SetFrameSize(uint256 frameSize);
Parameters
| Name | Type | Description |
|---|---|---|
frameSize | uint256 | The new frame size |
SetRootAndIpfsHash
Emitted when root and ipfs hash are updated
event SetRootAndIpfsHash(bytes32 root, string ipfsHash);
Parameters
| Name | Type | Description |
|---|---|---|
root | bytes32 | The new merkle tree root |
ipfsHash | string | The new ipfs hash |
Errors
InvalidProofs
Thrown when the provided proofs are invalid
error InvalidProofs(address account, uint256 amount, bytes32[] proofs);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The account upon which claim is performed |
amount | uint256 | The amount that was claimed |
proofs | bytes32[] | The proofs that were provided |
NothingToClaim
Thrown when nothing to claim
error NothingToClaim(address account);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The account that has nothing to claim |
PoolStakeDetails
PoolStakeDetails contains the details of a stake
struct PoolStakeDetails {
uint128 poolId;
uint128 ethToPool;
uint128 ethToIntegrator;
uint128 pSharesFromPool;
uint128 pSharesFromIntegrator;
}
Properties
| Name | Type | Description |
|---|---|---|
poolId | uint128 | Id of the pool |
ethToPool | uint128 | ETH amount sent to the pool |
ethToIntegrator | uint128 | ETH amount going to the integrator |
pSharesFromPool | uint128 | Amount of pool shares received from the pool |
pSharesFromIntegrator | uint128 | Amount of pool shares received from the integrator |
PoolExitDetails
PoolExitDetails contains the details of an exit
struct PoolExitDetails {
uint128 poolId;
uint128 exitedPoolShares;
}
Properties
| Name | Type | Description |
|---|---|---|
poolId | uint128 | Id of the pool |
exitedPoolShares | uint128 | Amount of pool shares exited |
IMultiPool
Inherits: IFeeDispatcher, IvPoolSharesReceiver
Author: 0xvv @ Kiln
This contract contains the common functions to all integration contracts. Contains the functions to add pools, activate/deactivate a pool, change the fee of a pool and change the commission distribution.
Functions
pools
Returns the list of vPools.
function pools() external view returns (address[] memory vPools);
Returns
| Name | Type | Description |
|---|---|---|
vPools | address[] | The addresses of the pool contract. |
getFee
Returns the current fee in basis points for the given pool.
function getFee(uint256 id) external view returns (uint256 feeBps);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint256 | Id of the pool |
Returns
| Name | Type | Description |
|---|---|---|
feeBps | uint256 | The current fee in basis points. |
changeFee
Allows the integrator to change the fee.
Reverts if there are unsold integrator shares.
function changeFee(uint256 poolId, uint256 newFeeBps) external;
Parameters
| Name | Type | Description |
|---|---|---|
poolId | uint256 | vPool id |
newFeeBps | uint256 | The new fee in basis points. |
changeSplit
Allows the admin to change the fee sharing upon withdrawal.
function changeSplit(address[] calldata recipients, uint256[] calldata splits) external;
Parameters
| Name | Type | Description |
|---|---|---|
recipients | address[] | The list of fee recipients. |
splits | uint256[] | List of each recipient share in basis points. |
addPool
Allows the integrator to add a vPool.
Reverts if the pool is already in the pools list.
function addPool(address newPool, uint256 fee) external;
Parameters
| Name | Type | Description |
|---|---|---|
newPool | address | The address of the new vPool. |
fee | uint256 | The fee to be applied to rewards from this vPool, in basis points. |
getPoolActivation
Returns true if the pool is active, false otherwise
function getPoolActivation(uint256 poolId) external view returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
poolId | uint256 | The id of the vPool. |
integratorCommissionOwed
Returns the ETH value of integrator shares left to sell.
function integratorCommissionOwed(uint256 poolId) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
poolId | uint256 | The id of the vPool. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The ETH value of unsold integrator shares. |
exitCommissionShares
Allows the integrator to exit the integrator shares of a vPool.
function exitCommissionShares(uint256 poolId) external;
Parameters
| Name | Type | Description |
|---|---|---|
poolId | uint256 | The id of the vPool. |
pauseDeposits
Allows the integrator to pause and unpause deposits only.
function pauseDeposits(bool isPaused) external;
Parameters
| Name | Type | Description |
|---|---|---|
isPaused | bool | Whether the deposits are paused or not. |
depositsPaused
Returns true if deposits are paused, false otherwise
function depositsPaused() external view returns (bool);
Events
VPoolSharesReceived
Emitted when vPool shares are received
event VPoolSharesReceived(address vPool, uint256 poolId, uint256 amount);
Parameters
| Name | Type | Description |
|---|---|---|
vPool | address | Address of the vPool sending the shares |
poolId | uint256 | Id of the pool in the integrations contract |
amount | uint256 | The amount of vPool shares received |
PoolActivation
Emitted when a vPool in enabled or disabled
event PoolActivation(address poolAddress, uint256 id, bool isActive);
Parameters
| Name | Type | Description |
|---|---|---|
poolAddress | address | The new pool address |
id | uint256 | Id of the pool |
isActive | bool | whether the pool can be staked to or not |
PoolAdded
Emitted when a vPool address is added to vPools
event PoolAdded(address poolAddress, uint256 id);
Parameters
| Name | Type | Description |
|---|---|---|
poolAddress | address | The new pool address |
id | uint256 | Id of the pool |
SetFee
Emitted when the integrator fee is changed
event SetFee(uint256 poolId, uint256 operatorFeeBps);
Parameters
| Name | Type | Description |
|---|---|---|
poolId | uint256 | Id of the pool |
operatorFeeBps | uint256 | The new fee in basis points |
SetName
Emitted when the display name is changed
event SetName(string name);
Parameters
| Name | Type | Description |
|---|---|---|
name | string | The new name |
SetSymbol
Emitted when the display symbol is changed
event SetSymbol(string symbol);
Parameters
| Name | Type | Description |
|---|---|---|
symbol | string | The new display symbol |
SetMaxCommission
Emitted when the max commission is set
event SetMaxCommission(uint256 maxCommission);
Parameters
| Name | Type | Description |
|---|---|---|
maxCommission | uint256 | The new max commission |
SetDepositsPaused
Emitted when the deposits are paused or unpaused
event SetDepositsPaused(bool isPaused);
Parameters
| Name | Type | Description |
|---|---|---|
isPaused | bool | Whether the deposits are paused or not |
Stake
Emitted when staking occurs, contains the details for all the pools
event Stake(address indexed staker, uint128 depositedEth, uint128 mintedTokens, PoolStakeDetails[] stakeDetails);
Parameters
| Name | Type | Description |
|---|---|---|
staker | address | The address staking |
depositedEth | uint128 | The amount of ETH staked |
mintedTokens | uint128 | The amount of integrator shares minted |
stakeDetails | PoolStakeDetails[] | Array of details for each pool, contains the pool id, the amount of ETH sent to the pool, the amount of ETH sent to the integrator, the amount of pool shares received from the pool and the amount of pools shares bought from the integrator |
Exit
Emitted when an exit occurs, contains the details for all the pools
event Exit(address indexed staker, uint128 exitedTokens, PoolExitDetails[] exitDetails);
Parameters
| Name | Type | Description |
|---|---|---|
staker | address | The address exiting |
exitedTokens | uint128 | The amount of integrator shares exited |
exitDetails | PoolExitDetails[] | Array of details for each pool, contains the pool id and the amount of pool shares exited |
ExitedCommissionShares
Emitted when the commission is distributed via a manual call
event ExitedCommissionShares(uint256 indexed poolId, uint256 shares, uint256[] weights, address[] recipients);
Parameters
| Name | Type | Description |
|---|---|---|
poolId | uint256 | Id of the pool |
shares | uint256 | Amount of pool shares exited |
weights | uint256[] | Array of weights for each recipient |
recipients | address[] | Array of recipients |
Errors
DepositsPaused
Thrown on stake if deposits are paused
error DepositsPaused();
InvalidAmounts
Thrown when trying to stake but the sum of amounts is not equal to the msg.value
error InvalidAmounts(uint256 sum, uint256 msgValue);
Parameters
| Name | Type | Description |
|---|---|---|
sum | uint256 | Sum of amounts in the list |
msgValue | uint256 | Amount of ETH sent |
EmptyPoolList
Thrown when trying to init the contract without providing a pool address
error EmptyPoolList();
OutstandingCommission
Thrown when trying to change the fee but there are integrator shares left to sell
error OutstandingCommission(uint256 ethLeft, uint256 id);
Parameters
| Name | Type | Description |
|---|---|---|
ethLeft | uint256 | The ETH value of shares left to sell |
id | uint256 | Id of the pool |
PoolAlreadyRegistered
Thrown when trying to add a Pool that is already registered in the contract
error PoolAlreadyRegistered(address newPool);
Parameters
| Name | Type | Description |
|---|---|---|
newPool | address | The pool address |
PoolDisabled
Thrown when trying to deposit to a disabled pool
error PoolDisabled(uint256 poolId);
Parameters
| Name | Type | Description |
|---|---|---|
poolId | uint256 | Id of the pool |
NotARegisteredPool
Thrown when trying the pool shares callback is called by an address that is not registered
error NotARegisteredPool(address poolAddress);
Parameters
| Name | Type | Description |
|---|---|---|
poolAddress | address | The pool address |
PoolTransferFailed
Emitted when a pool transfer does not return true.
error PoolTransferFailed(uint256 id);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint256 | The id of the pool. |
InvalidPoolId
Thrown when passing an invalid poolId
error InvalidPoolId(uint256 poolId);
Parameters
| Name | Type | Description |
|---|---|---|
poolId | uint256 | Invalid pool id |
CommissionPaidUnderflow
Thrown when the commission underflow when lowering the fee
To avoid this, the integrator can call exitCommissionShares before lowering the fee or wait for the integrator shares to be sold
error CommissionPaidUnderflow();
ZeroSharesMint
Thrown when minting a null amount of shares
error ZeroSharesMint();
FeeOverMax
Thrown when trying to see a fee over the max fee set at initialization
error FeeOverMax(uint256 maxFeeBps);
CallbackNotFromMinting
Thrown when trying to call the callback outside of the minting process
error CallbackNotFromMinting();
NoSharesToExit
Thrown when trying to exit the commission shares but there are no shares to exit
error NoSharesToExit(uint256 poolId);
IMultiPool1155
Author: 0xvv @ Kiln
This contract contains internal functions to stake and track positions in multiple pools. It also exposes supply getters and pool addition.
Functions
totalUnderlyingSupply
Returns the amount of pool shares owned by the users.
function totalUnderlyingSupply(uint256 id) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint256 | Id of the pool |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | Total amount of shares. |
totalSupply
Returns the total amount of vStakes shares.
function totalSupply(uint256 id) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint256 | Id of the pool |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | Total amount of shares. |
requestExit
Sends the given number of shares to the exit queue, the user receives the NFT ticket
function requestExit(uint256 id, uint256 amount) external;
Parameters
| Name | Type | Description |
|---|---|---|
id | uint256 | Id of the pool |
amount | uint256 | Amount of shares to add to the exit queue |
batchRequestExit
Batched version of requestExit
function batchRequestExit(uint256[] calldata ids, uint256[] calldata amounts) external;
Parameters
| Name | Type | Description |
|---|---|---|
ids | uint256[] | Ids of the pools |
amounts | uint256[] | Amount of shares to add to the exit queue |
poolRate
Returns the poolShare to ETH conversion rate for the given ID
function poolRate(uint256 id) external returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint256 | Id of the pool |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | ETH value of a pool share |
setPoolActivation
Allows the integrator to prevent users from depositing to a vPool.
function setPoolActivation(uint256 poolId, bool status) external;
Parameters
| Name | Type | Description |
|---|---|---|
poolId | uint256 | The id of the vPool. |
status | bool | Whether the users can deposit to the pool. |
Events
TransferSingle
Emitted when a transfer occurs.
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
Parameters
| Name | Type | Description |
|---|---|---|
operator | address | The address of the operator. |
from | address | The address of the sender. |
to | address | The address of the recipient. |
id | uint256 | The id of the pool. |
value | uint256 | The amount of staking shares. |
TransferBatch
Emitted when a batch transfer occurs, sending shares of multiple pools to the same recipient.
event TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values);
Parameters
| Name | Type | Description |
|---|---|---|
operator | address | The address of the operator. |
from | address | The address of the sender. |
to | address | The address of the recipient. |
ids | uint256[] | The ids of the pools. |
values | uint256[] | The amounts of staking shares. |
CommissionSharesSold
Emitted when some integrator shares are sold
event CommissionSharesSold(uint256 pSharesSold, uint256 id, uint256 amountSold);
Parameters
| Name | Type | Description |
|---|---|---|
pSharesSold | uint256 | ETH amount of vPool shares sold |
id | uint256 | Id of the pool |
amountSold | uint256 | ETH amount of shares sold |
Errors
InsufficientBalance
Emitted when a transfer is attempted but the sender does not have enough balance.
error InsufficientBalance(uint256 id, uint256 amount, uint256 balance);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint256 | The id of the token. |
amount | uint256 | The token amount. |
balance | uint256 | The balance of user. |
IMultiPool20
Author: 0xvv @ Kiln
This contract contains the internal logic for an ERC-20 token based on one or multiple pools.
Functions
setPoolPercentages
Set the percentage of new stakes to route to each pool
If a pool is disabled it needs to be set to 0 in the array
function setPoolPercentages(uint256[] calldata split) external;
Parameters
| Name | Type | Description |
|---|---|---|
split | uint256[] | Array of values in basis points to route to each pool |
requestExit
Burns the sender's shares and sends the exitQueue tickets to the caller.
function requestExit(uint256 amount) external;
Parameters
| Name | Type | Description |
|---|---|---|
amount | uint256 | Amount of shares to add to the exit queue |
rate
Returns the share to ETH conversion rate
function rate() external returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | ETH value of a share |
setPoolActivation
Allows the integrator to prevent users from depositing to a vPool.
function setPoolActivation(uint256 poolId, bool status, uint256[] calldata newPoolPercentages) external;
Parameters
| Name | Type | Description |
|---|---|---|
poolId | uint256 | The id of the vPool. |
status | bool | Whether the users can deposit to the pool. |
newPoolPercentages | uint256[] | Array of value in basis points to route to each pool after the change |
Events
Transfer
Emitted when a stake is transferred.
event Transfer(address indexed from, address indexed to, uint256 value);
Parameters
| Name | Type | Description |
|---|---|---|
from | address | The address sending the stake |
to | address | The address receiving the stake |
value | uint256 | The transfer amount |
Approval
Emitted when an allowance is created.
event Approval(address indexed owner, address indexed spender, uint256 value);
Parameters
| Name | Type | Description |
|---|---|---|
owner | address | The owner of the shares |
spender | address | The address that can spend |
value | uint256 | The allowance amount |
CommissionSharesSold
Emitted when some integrator shares are sold
event CommissionSharesSold(uint256 pSharesSold, uint256 id, uint256 amountSold);
Parameters
| Name | Type | Description |
|---|---|---|
pSharesSold | uint256 | ETH amount of vPool shares sold |
id | uint256 | Id of the pool |
amountSold | uint256 | ETH amount of shares sold |
SetPoolPercentages
Emitted when new split is set.
event SetPoolPercentages(uint256[] split);
Parameters
| Name | Type | Description |
|---|---|---|
split | uint256[] | Array of value in basis points to route to each pool |
Errors
InsufficientBalance
Thrown when a transfer is attempted but the sender does not have enough balance.
error InsufficientBalance(uint256 amount, uint256 balance);
Parameters
| Name | Type | Description |
|---|---|---|
amount | uint256 | The token amount. |
balance | uint256 | The balance of user. |
InsufficientAllowance
Thrown when a transferFrom is attempted but the spender does not have enough allowance.
error InsufficientAllowance(uint256 amount, uint256 allowance);
NonZeroPercentageOnDeactivatedPool
Thrown when trying to set a pool percentage != 0 to a deactivated pool
error NonZeroPercentageOnDeactivatedPool(uint256 id);
Native1155Configuration
Configuration for the Native-1155 contract.
struct Native1155Configuration {
string name;
string symbol;
address admin;
address[] pools;
uint256[] poolFees;
address[] commissionRecipients;
uint256[] commissionDistribution;
string baseUri;
uint256 maxCommissionBps;
}
Properties
| Name | Type | Description |
|---|---|---|
name | string | The display name of the token. |
symbol | string | The display symbol of the token. |
admin | address | The address of the admin. |
pools | address[] | List of pool addresses. |
poolFees | uint256[] | List of fee for each pool, in basis points. |
commissionRecipients | address[] | List of recipients among which the withdrawn fees are shared. |
commissionDistribution | uint256[] | Share of each fee recipient, in basis points, must add up to 10 000. |
baseUri | string | The base URI for all tokens. |
maxCommissionBps | uint256 |
INative1155
Author: 0xvv @ Kiln
This contract allows users to stake in any of the vPools with any amount of ETH and track their position. Users are given non transferable shares to track their stake, shares of different pools are not equivalent. Users can interact with the contract using the ERC-1155 style interface, but the contract is not ERC-1155 compliant as it does not support transfers.
Functions
initialize
Initializes the contract with the given parameters.
function initialize(Native1155Configuration calldata args) external;
Parameters
| Name | Type | Description |
|---|---|---|
args | Native1155Configuration | The arguments to initialize the contract with. |
uri
Returns the URI for token type id.
function uri(uint256 id) external view returns (string memory);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint256 | The id of the token. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | string | The URI of the token. |
setPrefixUri
Sets the base URI for all tokens.
Ony callable by the admin.
function setPrefixUri(string calldata _uri) external;
Parameters
| Name | Type | Description |
|---|---|---|
_uri | string | The base URI. |
name
Returns the name of the token.
function name() external view returns (string memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | string | The name of the token. |
symbol
Returns the symbol of the token.
function symbol() external view returns (string memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | string | The symbol of the token. |
balanceOf
Returns the amount of staking shares of a given pool for an account.
function balanceOf(address account, uint256 id) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The address of the account. |
id | uint256 | The id of the pool. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | amount of staking shares. |
balanceOfBatch
Batch version of balanceOf().
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory);
Parameters
| Name | Type | Description |
|---|---|---|
accounts | address[] | The addresses of the accounts. |
ids | uint256[] | The ids of the pool. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256[] | list of amounts of staking shares. |
balanceOfUnderlying
Returns the amount of pool shares for an account in a given pool.
function balanceOfUnderlying(address account, uint256 id) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The address of the account. |
id | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | amount of pool shares. |
balanceOfUnderlyingBatch
Batch version of balanceOfUnderlying().
function balanceOfUnderlyingBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory);
Parameters
| Name | Type | Description |
|---|---|---|
accounts | address[] | The addresses of the accounts. |
ids | uint256[] | The ids of the pool. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256[] | list of amounts of pool shares. |
stake
Stake the given amounts of ETH in the given pools.
Sum of amounts must be equal to msg.value.
The length of amounts and ids must be equal.
function stake(uint256[] calldata amounts, uint256[] calldata ids) external payable returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
amounts | uint256[] | List of amount for each pool |
ids | uint256[] | List of pool ids |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | Whether the staking was successful. |
Events
SetURIPrefix
Emitted when the base uri is changed
event SetURIPrefix(string uri);
Parameters
| Name | Type | Description |
|---|---|---|
uri | string | The new base uri |
Native20Configuration
Configuration parameters for the Native20 contract.
struct Native20Configuration {
string name;
string symbol;
address admin;
address[] pools;
uint256[] poolFees;
address[] commissionRecipients;
uint256[] commissionDistribution;
uint256[] poolPercentages;
uint256 maxCommissionBps;
uint256 monoTicketThreshold;
}
Properties
| Name | Type | Description |
|---|---|---|
name | string | ERC-20 style display name. |
symbol | string | ERC-20 style display symbol. |
admin | address | The address of the admin. |
pools | address[] | List of pool addresses. |
poolFees | uint256[] | List of fee for each pool, in basis points. |
commissionRecipients | address[] | List of recipients among which the withdrawn fees are shared. |
commissionDistribution | uint256[] | Share of each fee recipient, in basis points, must add up to 10 000. |
poolPercentages | uint256[] | The amount of ETH to route to each pool when staking, in basis points, must add up to 10 000. |
maxCommissionBps | uint256 | |
monoTicketThreshold | uint256 |
INative20
Author: 0xvv @ Kiln
This contract allows users to stake any amount of ETH in the vPool(s). Users are given non transferable ERC-20 type shares to track their stake.
Functions
initialize
Initializes the contract with the given parameters.
function initialize(Native20Configuration calldata args) external;
Parameters
| Name | Type | Description |
|---|---|---|
args | Native20Configuration | The initialization arguments. |
name
Returns the name of the token.
function name() external view returns (string memory);
symbol
Returns the symbol of the token, usually a shorter version of the name.
function symbol() external view returns (string memory);
decimals
Returns the number of decimals used to get its user representation.
function decimals() external view returns (uint8);
totalSupply
Returns the total amount of staking shares.
function totalSupply() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | Total amount of shares. |
totalUnderlyingSupply
Returns the amount of ETH owned by the users in the pool(s).
function totalUnderlyingSupply() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | Total amount of shares. |
balanceOf
Returns the amount of staking shares for an account.
function balanceOf(address account) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The address of the account. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | amount of staking shares. |
balanceOfUnderlying
Returns the ETH value of the account balance.
function balanceOfUnderlying(address account) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The address of the account. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | amount of ETH. |
stake
Function to stake ETH.
function stake() external payable;
IvNFT
Inherits: INFT, IAdministrable
Author: mortimr @ Kiln
Mint or Purchase 1 NFT = own 1 validator
Functions
initialize
function initialize(VNFTConfiguration calldata config) external;
Parameters
| Name | Type | Description |
|---|---|---|
config | VNFTConfiguration | The configuration for the vNFT |
factory
Retrieve the factory address
function factory() external view returns (address);
Returns
| Name | Type | Description |
|---|---|---|
<none> | address | The current factory address |
integrator
Retrieve the integrator address
function integrator() external view returns (address);
Returns
| Name | Type | Description |
|---|---|---|
<none> | address | The current integrator address |
beneficiaryOf
Retriver the current beneficiary of EL and CL rewards
function beneficiaryOf(uint256 tokenId) external view returns (address beneficiary);
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | Id of the vNFT |
Returns
| Name | Type | Description |
|---|---|---|
beneficiary | address | The current rewards beneficiary address |
operatorCommission
Retrieve the operator commission
This value is not used inside the contract but only in the off-chain accounting engine building the exec layer vault merkle tree
function operatorCommission() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The current operator commission |
integratorCommission
Retrieve the integrator commission
This value is not used inside the contract but only in the off-chain accounting engine building the exec layer vault merkle tree
function integratorCommission() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The current integrator commission |
soulboundMode
Retrieve the soulbound mode status
if active, thansfers are disabled
function soulboundMode() external view returns (bool);
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | The current soulbound mode status |
startTokenId
Retrieve the starting token id
function startTokenId() external pure returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The starting token id |
execLayerVault
Retrieve the exec layer vault address
function execLayerVault() external view returns (address);
Returns
| Name | Type | Description |
|---|---|---|
<none> | address | The current exec layer vault address |
extraData
Retrieve the extra data used for each deposit
function extraData() external view returns (string memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | string | The currently used extra data |
resolve
Retrieve the associated validator ids for the given token ids
function resolve(uint256[] calldata tokenIds) external view returns (uint256[] memory);
Parameters
| Name | Type | Description |
|---|---|---|
tokenIds | uint256[] | The list of token ids to lookup |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256[] | The list of associated validator ids |
uriPrefix
Retrieve the uri prefix used for all token uris
function uriPrefix() external view returns (string memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | string | The current uri prefix |
isExited
Retrieve if the token is exited
function isExited(uint256 tokenId) external view returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | The token id to lookup |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | True if the token is exited or false otherwise |
purchasable
Retrieve the amount of purchasable validators
function purchasable() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The currently purchasable validator amount |
purchasePaused
Retrieve the purchase function status
function purchasePaused() external view returns (bool);
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | True if the purchase function is paused or false otherwise |
setIntegrator
Sets the integrator address
function setIntegrator(address newIntegrator) external;
Parameters
| Name | Type | Description |
|---|---|---|
newIntegrator | address | The new integrator address to use |
setIntegratorCommission
Sets the integrator commission
function setIntegratorCommission(uint256 newIntegratorCommission) external;
Parameters
| Name | Type | Description |
|---|---|---|
newIntegratorCommission | uint256 | The new integrator commission to use |
setOperatorCommission
Sets the operator commission
function setOperatorCommission(uint256 newOperatorCommission) external;
Parameters
| Name | Type | Description |
|---|---|---|
newOperatorCommission | uint256 | The new operator commission to use |
setName
Sets the ERC721 contract name
function setName(string calldata newName) external;
Parameters
| Name | Type | Description |
|---|---|---|
newName | string | The new name of the contract |
setSymbol
Sets the ERC721 contract symbol
function setSymbol(string calldata newSymbol) external;
Parameters
| Name | Type | Description |
|---|---|---|
newSymbol | string | The new symbol of the contract |
setUriPrefix
Sets the uri prefix of the contract
function setUriPrefix(string calldata newUriPrefix) external;
Parameters
| Name | Type | Description |
|---|---|---|
newUriPrefix | string | The new uri prefix to use |
purchase
Purchase one or several validators
The msg.value should be a multiple of 32 ETH > 0
function purchase() external payable returns (uint256[] memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256[] | The list of minted NFT ids |
withdraw
Triggers a withdrawal action on the underlying validators
function withdraw(uint256[] calldata tokenIds, address recipient) external returns (uint256[] memory);
Parameters
| Name | Type | Description |
|---|---|---|
tokenIds | uint256[] | The list of token ids upon which to perform the withdrawal |
recipient | address | The address that should receive the pulled funds |
exit
Triggers an exit action on the underlying validators
function exit(uint256[] calldata tokenIds) external;
Parameters
| Name | Type | Description |
|---|---|---|
tokenIds | uint256[] | The list of token ids upon which to perform the exits |
clearUsership
Withdraw rewards if any for the user and clears the usership
function clearUsership(uint256 tokenId) external returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | The token id to clear the usership for |
pausePurchase
Pause the purchase function
function pausePurchase() external;
unpausePurchase
Unpause the purchase function
function unpausePurchase() external;
claimDebt
Claim the rewards due to the user
function claimDebt() external;
debt
Retrieve the debt due to an user
function debt(address user) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | The user to lookup |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The debt due to the user |
Events
SetFactory
Emitted when the factory is changed
event SetFactory(address factory);
Parameters
| Name | Type | Description |
|---|---|---|
factory | address | The new factory address |
SetExtraData
Emitted when the extraData value is changed
event SetExtraData(string extraData);
Parameters
| Name | Type | Description |
|---|---|---|
extraData | string | The new extraData value |
SetURIPrefix
Emitted when the uri prefix value is changed
event SetURIPrefix(string uriPrefix);
Parameters
| Name | Type | Description |
|---|---|---|
uriPrefix | string | The new uri prefix value |
SetExecLayerVault
Emitted when the exec layer vault address is changed
event SetExecLayerVault(address execLayerVault);
Parameters
| Name | Type | Description |
|---|---|---|
execLayerVault | address | The new exec layer vault address |
SetIntegratorCommission
Emitted when the integrator commission is changed
event SetIntegratorCommission(uint256 integratorCommission);
Parameters
| Name | Type | Description |
|---|---|---|
integratorCommission | uint256 | The new integrator commission |
SetOperatorCommission
Emitted when the operator commission is changed
event SetOperatorCommission(uint256 operatorCommission);
Parameters
| Name | Type | Description |
|---|---|---|
operatorCommission | uint256 | The new operator commission |
SetIntegrator
Emitted when the integrator address is changed
event SetIntegrator(address integrator);
Parameters
| Name | Type | Description |
|---|---|---|
integrator | address | The new integrator address |
SetSoulboundMode
Emitted when the soulbound mode is changed
event SetSoulboundMode(bool active);
Parameters
| Name | Type | Description |
|---|---|---|
active | bool | Whether or not the soulbound mode is enabled |
PurchasedValidator
Emitted when a validator has been purchased by the contract
event PurchasedValidator(address indexed owner, uint256 tokenId, uint256 validatorId);
Parameters
| Name | Type | Description |
|---|---|---|
owner | address | The address owning the newly created validator |
tokenId | uint256 | The id of the NFT representation |
validatorId | uint256 | The id of the validator in the vFactory |
UsershipCleared
Emitted when owner claims back the usership of the NFT
event UsershipCleared(uint256 indexed tokenId);
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | The id of the NFT representation |
SetPurchasePause
Emitted when the purchase function is paused or unpaused
event SetPurchasePause(bool isPaused);
Parameters
| Name | Type | Description |
|---|---|---|
isPaused | bool | The status of the pause |
DebtClaimed
Emitted when an user claims its debt
event DebtClaimed(address indexed user, uint256 amount);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | The address of the user |
amount | uint256 | The amount of debt claimed |
TokenIdUpdated
Emitted when a NFT is reminted for a validator
event TokenIdUpdated(uint256 indexed oldTokenId, uint256 indexed newTokenId, uint256 validatorId);
Parameters
| Name | Type | Description |
|---|---|---|
oldTokenId | uint256 | The id of the NFT representation |
newTokenId | uint256 | The new id of the NFT representation |
validatorId | uint256 | The id of the validator in the vFactory |
Errors
InvalidAmount
Thrown when the provided amount is invalid
error InvalidAmount(uint256 amount);
Parameters
| Name | Type | Description |
|---|---|---|
amount | uint256 | The provided amount |
ValidatorCountUnavailable
Thrown when the requested validator count to purchase is unavailable
error ValidatorCountUnavailable(uint256 requestedAmount, uint256 availableAmount);
Parameters
| Name | Type | Description |
|---|---|---|
requestedAmount | uint256 | The amount of validators requested |
availableAmount | uint256 | The amount of validators available |
InvalidDepositCount
Thrown when the validator count retrieved by the factory is invalid
error InvalidDepositCount(uint256 requestedAmount, uint256 depositedAmount);
Parameters
| Name | Type | Description |
|---|---|---|
requestedAmount | uint256 | The amount of validators that was initially requested |
depositedAmount | uint256 | The amount of validators actually deposited by the vFactory |
EmptyTokenIdArray
Thrown when the provided token id array is empty
error EmptyTokenIdArray();
PurchasePaused
Thrown when purchase function is paused
error PurchasePaused();
ClearUsershipError
Thrown when usership cannot be claimed (no user is set or not expired yet)
error ClearUsershipError();
IllegalTransferWhileInSoulboundMode
Thrown when the soulbound mode is enabled and a transfer is attempted
error IllegalTransferWhileInSoulboundMode();
IllegalTransferOfExitedToken
Thrown when the a user tries to transfer an exited token
error IllegalTransferOfExitedToken(uint256 tokenId);
IllegalExpirationExtensionAttempt
Thrown when a user tries to change the expiration for a greater value
error IllegalExpirationExtensionAttempt(address user, uint64 initialExpiration, uint64 proposedExpiration);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | The address of the user |
initialExpiration | uint64 | The expiration before the setUser attempt |
proposedExpiration | uint64 | The expiration proposed |
IllegalExpirationValue
Thrown when a user tries to set an expiration in the past
error IllegalExpirationValue(uint64 expiration);
Parameters
| Name | Type | Description |
|---|---|---|
expiration | uint64 | The expiration proposed |
WithdrawError
Thrown when a withdrawal fails
error WithdrawError();
ValidatorAlreadyExited
Thrown when a validator is already exited
error ValidatorAlreadyExited(uint256 tokenId);
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | The id of the NFT representation |
CannotExitWhileRented
Thrown when a validator is already rented and the owner wants to exit
error CannotExitWhileRented(uint256 tokenId);
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | The id of the NFT representation |
Structs
VNFTConfiguration
Struct containing the configuration for the vNFT
struct VNFTConfiguration {
string name;
string symbol;
string uriPrefix;
string extraData;
address[4] actors;
uint256[2] commissions;
bool soulboundMode;
}
Properties
| Name | Type | Description |
|---|---|---|
name | string | The name of the ERC721 token |
symbol | string | The symbol of the ERC721 token |
uriPrefix | string | The uri prefix to use for every token |
extraData | string | The extra data to use upon validator deposits |
actors | address[4] | Array containing the linked addresses = [factory, execLayerVault, owner, integrator] |
commissions | uint256[2] | Array containing the commissions = [operatorCommission, integratorCommission] |
soulboundMode | bool |
Contents
ExitedEthIncrementer
Author: 0xvv @ Kiln
This contract allows to increment the exited Eth for a pool
State Variables
$exitedEth
The mapping of exited Eth for different pools
Type: mapping(uint256 => uint256)
Slot: keccak256(bytes("multiPool.1.exitedEth")) - 1
types.Mapping internal constant $exitedEth = types.Mapping.wrap(0x76a0ecda094c6ccf2a55f6f1ef41b98d3c1f2dfcb9c1970701fe842ce778ff9b);
$commissionPaid
The mapping of commission paid for different pools
Type: mapping(uint256 => uint256)
Slot: keccak256(bytes("multiPool.1.commissionPaid")) - 1
types.Mapping internal constant $commissionPaid = types.Mapping.wrap(0x6c8f9259db4f6802ea7a1e0a01ddb54668b622f1e8d6b610ad7ba4d95f59da29);
Functions
migrate
function migrate() external;
Contents
LBalance
Functions
get
function get(victypes.BalanceMapping position) internal pure returns (mapping(address => uint256) storage data);
LUser4907Mapping
Functions
get
function get(victypes.User4907Mapping position) internal pure returns (mapping(uint256 => victypes.User4907) storage data);
victypes
Structs
User4907
struct User4907 {
address user;
uint64 expiration;
}
ExitQueueClaimHelper
Inherits: IExitQueueClaimHelper
Author: gauthiermyr @ Kiln
This contract contains functions to resolve and claim casks on several exit queues.
Functions
multiResolve
Resolve a list of casksIds for given exitQueues and tickets
function multiResolve(address[] calldata exitQueues, uint256[][] calldata ticketIds)
external
view
override
returns (int64[][] memory caskIdsOrErrors);
Parameters
| Name | Type | Description |
|---|---|---|
exitQueues | address[] | List of exit queues |
ticketIds | uint256[][] | List of tickets in each exit queue |
multiClaim
Claim caskIds for given tickets on each exit queue
function multiClaim(address[] calldata exitQueues, uint256[][] calldata ticketIds, uint32[][] calldata casksIds)
external
override
returns (IvExitQueue.ClaimStatus[][] memory statuses);
Parameters
| Name | Type | Description |
|---|---|---|
exitQueues | address[] | List of exit queues |
ticketIds | uint256[][] | List of tickets in each exit queue |
casksIds | uint32[][] | List of caskIds to claim with each ticket |
FeeDispatcher
Inherits: IFeeDispatcher
Author: 0xvv @ Kiln
This contract contains functions to dispatch the ETH in a contract upon withdrawal.
State Variables
$feeRecipients
The recipients of the fees upon withdrawal.
Slot: keccak256(bytes("feeDispatcher.1.feeRecipients")) - 1
types.Array internal constant $feeRecipients = types.Array.wrap(0xd681f9d3e640a2dd835404271506ef93f020e2fc065878793505e5ea088fde3d);
$feeSplits
The splits of each recipient of the fees upon withdrawal.
Slot: keccak256(bytes("feeDispatcher.1.feeSplits")) - 1
types.Array internal constant $feeSplits = types.Array.wrap(0x31a3fa329157566a07927d0c2ba92ff801e4db8af2ec73f92eaf3e7f78d587a8);
$locked
The lock to prevent reentrancy
Slot: keccak256(bytes("feeDispatcher.1.locked")) - 1
types.Uint256 internal constant $locked = types.Uint256.wrap(0x8472de2bbf04bc62a7ee894bd625126d381bf5e8b726e5cd498c3a9dad76d85b);
UNLOCKED
The states of the lock, 1 = unlocked, 2 = locked
uint256 internal constant UNLOCKED = 1;
LOCKED
uint256 internal constant LOCKED = 2;
Functions
constructor
constructor();
_initFeeDispatcher
An internal function to set the fee split & unlock the reentrancy lock. Should be called in the initializer of the inheriting contract.
function _initFeeDispatcher(address[] calldata recipients, uint256[] calldata splits) internal;
nonReentrant
Modifier to prevent reentrancy
modifier nonReentrant() virtual;
withdrawCommission
Allows the integrator to withdraw the ETH in the contract.
function withdrawCommission() external nonReentrant;
getCurrentSplit
Returns the current fee split and recipients
This function is not pure as it fetches the current fee split and recipients from storage
function getCurrentSplit() external pure returns (address[] memory, uint256[] memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | address[] | feeRecipients The current fee recipients |
<none> | uint256[] | feeSplits The current fee splits |
_setFeeSplit
Internal utility to set the fee distribution upon withdrawal
function _setFeeSplit(address[] calldata recipients, uint256[] calldata splits) internal;
Parameters
| Name | Type | Description |
|---|---|---|
recipients | address[] | The new fee recipients list |
splits | uint256[] | The new split between fee recipients |
IntegrationFactory
Inherits: IIntegrationFactory, Administrable, Initializable, Implementation
Author: gauthiermyr @ Kiln
IntegrationFactory deploys predefined integrations contracts through a ProxyFactory.
Unstructured Storage Friendly
State Variables
$factories
Mapping of deployed factories for channels
Type: mapping(bytes32 -> address)
Slot: keccak256(bytes("IntegrationFactory.1.factories")) - 1
types.Mapping internal constant $factories = types.Mapping.wrap(0x4e2544bc56f6c4fa0a65524c59b2051825cbd54dcbec5c39527253c4ae3998cb);
$implementations
Implementations mapping. Gives implementation address for a given channel
Type: mapping(bytes32 -> address)
Slot: keccak256(bytes("IntegrationFactory.1.implementations")) - 1
types.Mapping internal constant $implementations = types.Mapping.wrap(0x8185f5197e680e22bd57ca6481ef122b0bbaabba72f7030265b674bc0e43b011);
$outdated
Gives true for a channel if the related implementation requires a factory update
Type: mapping(bytes32 -> address)
Slot: keccak256(bytes("IntegrationFactory.1.outdated")) - 1
types.Mapping internal constant $outdated = types.Mapping.wrap(0xfa6a2da202829c8efa37af360272640192c97d0eaad911d49d5a3827eeb49e23);
$deployers
Mapping of accounts allowed to deploy integrations :
Type: mapping(address -> bool)
Slot: keccak256(bytes("IntegrationFactory.1.deployers")) - 1
types.Mapping internal constant $deployers = types.Mapping.wrap(0xb7fa6aee54ea33d353c1a47f0af14ba42a132b7ecbca87c0f3c74f23231367be);
CHANNEL_NATIVE_20_VPOOL
Channel identifier for Native vPool implementation 0x4e41544956455f32305f76504f4f4c0000000000000000000000000000000000
bytes32 constant CHANNEL_NATIVE_20_VPOOL = bytes32(abi.encodePacked("NATIVE_20_vPOOL"));
CHANNEL_LIQUID_20_A_VPOOL
Channel identifier for liquid ERC20 aToken implementation 0x4c49515549445f32305f415f76504f4f4c000000000000000000000000000000
bytes32 constant CHANNEL_LIQUID_20_A_VPOOL = bytes32(abi.encodePacked("LIQUID_20_A_vPOOL"));
CHANNEL_LIQUID_20_C_VPOOL
Channel identifier for liquid ERC20 cToken implementation 0x4c49515549445f32305f435f76504f4f4c000000000000000000000000000000
bytes32 constant CHANNEL_LIQUID_20_C_VPOOL = bytes32(abi.encodePacked("LIQUID_20_C_vPOOL"));
CHANNEL_NATIVE_1155_VPOOL
Channel identifier for native 1155 implementation 0x4e41544956455f313135355f76504f4f4c000000000000000000000000000000
bytes32 constant CHANNEL_NATIVE_1155_VPOOL = bytes32(abi.encodePacked("NATIVE_1155_vPOOL"));
CHANNEL_LIQUID_1155_VPOOL
Channel identifier for liquid 1155 implementation 0x4c49515549445f313135355f76504f4f4c000000000000000000000000000000
bytes32 constant CHANNEL_LIQUID_1155_VPOOL = bytes32(abi.encodePacked("LIQUID_1155_vPOOL"));
CHANNEL_VNFT
Channel identifier for vNFT implementation
bytes32 constant CHANNEL_VNFT = bytes32(abi.encodePacked("vNFT"));
Functions
onlyAllowedDeployer
This modifier ensures that only an allowed deployer or the contract admin is trying to deploy an integration
modifier onlyAllowedDeployer();
initialize
Initializes the contract with the given parameters.
function initialize(address admin_) external init(0);
Parameters
| Name | Type | Description |
|---|---|---|
admin_ | address | Factory admin |
deployNative20vPoolIntegration
Deploy a proxy for the implementation of a Native vPool integration contract
function deployNative20vPoolIntegration(address proxyOwner, Native20Configuration calldata config)
external
override
onlyAllowedDeployer
returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
config | Native20Configuration |
deployLiquid20AvPoolIntegration
Deploy a proxy for the implementation of a liquid ERC20 aToken vPool integration contract
function deployLiquid20AvPoolIntegration(address proxyOwner, Native20Configuration calldata config)
external
override
onlyAllowedDeployer
returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
config | Native20Configuration | The parameters to initialize the contract. |
deployLiquid20CvPoolIntegration
Deploy a proxy for the implementation of a liquid ERC20 cToken vPool integration contract
function deployLiquid20CvPoolIntegration(address proxyOwner, Native20Configuration calldata config)
external
override
onlyAllowedDeployer
returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
config | Native20Configuration | The parameters to initialize the contract. |
deployNative20vPoolIntegration
Deploy a proxy for the implementation of a Native vPool integration contract
Warning: this method does not check that the the calldata corresponds to the last implementation.
function deployNative20vPoolIntegration(address proxyOwner, bytes calldata cdata) external override onlyAllowedDeployer returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
cdata | bytes | The initial calldata |
deployLiquid20AvPoolIntegration
Deploy a proxy for the implementation of a liquid ERC20 aToken vPool integration contract
Warning: this method does not check that the the calldata corresponds to the last implementation.
function deployLiquid20AvPoolIntegration(address proxyOwner, bytes calldata cdata)
external
override
onlyAllowedDeployer
returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
cdata | bytes |
deployLiquid20CvPoolIntegration
Deploy a proxy for the implementation of a liquid ERC20 cToken vPool integration contract
Warning: this method does not check that the the calldata corresponds to the last implementation.
function deployLiquid20CvPoolIntegration(address proxyOwner, bytes calldata cdata)
external
override
onlyAllowedDeployer
returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
cdata | bytes |
deployNative1155vPoolIntegration
Deploy a proxy for the implementation of a native 1155 vPool integration contract
function deployNative1155vPoolIntegration(address proxyOwner, Native1155Configuration calldata config)
external
override
onlyAllowedDeployer
returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
config | Native1155Configuration | The parameters to initialize the contract. |
deployLiquid1155vPoolIntegration
Deploy a proxy for the implementation of a liquid 1155 vPool integration contract
function deployLiquid1155vPoolIntegration(address proxyOwner, Native1155Configuration calldata config)
external
override
onlyAllowedDeployer
returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
config | Native1155Configuration | The parameters to initialize the contract |
deployNative1155vPoolIntegration
Deploy a proxy for the implementation of a native 1155 vPool integration contract
Warning: this method does not check that the the calldata corresponds to the last implementation.
function deployNative1155vPoolIntegration(address proxyOwner, bytes calldata cdata)
external
override
onlyAllowedDeployer
returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
cdata | bytes |
deployLiquid1155vPoolIntegration
Deploy a proxy for the implementation of a liquid 1155 vPool integration contract
Warning: this method does not check that the the calldata corresponds to the last implementation.
function deployLiquid1155vPoolIntegration(address proxyOwner, bytes calldata cdata)
external
override
onlyAllowedDeployer
returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
cdata | bytes |
deployVNFTIntegration
Deploy a proxy for the implementation of a vNFT integration contract
Warning: this method does not check that the the calldata corresponds to the last vNFT implementation.
function deployVNFTIntegration(address proxyOwner, bytes calldata cdata) external override onlyAllowedDeployer returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
cdata | bytes | The initial calldata |
deployVNFTIntegration
Deploy a proxy for the implementation of a vNFT integration contract
function deployVNFTIntegration(address proxyOwner, IvNFT.VNFTConfiguration calldata config)
external
override
onlyAllowedDeployer
returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
config | IvNFT.VNFTConfiguration |
updateImplementation
Update the channel implementation address
function updateImplementation(bytes32 channel, address implem, bool updateRequired) external onlyAdmin;
Parameters
| Name | Type | Description |
|---|---|---|
channel | bytes32 | Channel to update |
implem | address | New implementation address for the channel |
updateRequired | bool | If true it will prevent from deploying an instance with the old implementation parameters |
setDeployer
Allow or disallow an address to deploy integration contracts
function setDeployer(address deployer, bool allowed) external onlyAdmin;
Parameters
| Name | Type | Description |
|---|---|---|
deployer | address | Address of the deployer |
allowed | bool | Allowed or not |
_factory
Internal methods
function _factory(bytes32 channel) internal view returns (address);
_implementation
function _implementation(bytes32 channel) internal view returns (address);
_isOutdated
function _isOutdated(bytes32 channel) internal view returns (bool);
_checkOutdated
Throw an error if the implementation has been updated and then the factory requires an update too
function _checkOutdated(bytes32 channel) internal view;
Parameters
| Name | Type | Description |
|---|---|---|
channel | bytes32 | channel identifier |
_deploy
function _deploy(bytes32 channel, address owner, bytes memory cdata) internal returns (address);
_deploy20
function _deploy20(bytes32 channel, address owner, Native20Configuration calldata config) internal returns (address);
_deploy1155
function _deploy1155(bytes32 channel, address owner, Native1155Configuration calldata config) internal returns (address);
factory
Getters
function factory(bytes32 channel) external view returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
channel | bytes32 | channel identifier |
implementation
retrieve the implementation address for a channel
function implementation(bytes32 channel) external view returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
channel | bytes32 | channel identifier |
outdated
retrieve whether the implementation for a channel is outdated
function outdated(bytes32 channel) external view returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
channel | bytes32 | channel identifier |
Liquid1155
Inherits: Native1155, ILiquid1155
Author: 0xvv @ Kiln
This contract allows users to stake in any of the vPools with any amount of ETH and track their position
Users are given transferable shares to track their stake, shares of different pools are not equivalent
Users can interact with the contract using the ERC-1155 interface
State Variables
$approvals
Stores the approvals.
Type: mapping(address => mapping(address => bool))
Slot: keccak256(bytes("liquid1155.1.approvals")) - 1
uctypes.OperatorApprovalsMapping internal constant $approvals =
uctypes.OperatorApprovalsMapping.wrap(0xf49f1126f15fa50e7f83c3d26f874246f4209fea59edc2c13d900d8b240b28c5);
Functions
setApprovalForAll
Give the right to an operator to transfer all tokens of the sender.
function setApprovalForAll(address operator, bool approved) external;
Parameters
| Name | Type | Description |
|---|---|---|
operator | address | The address of the operator. |
approved | bool | The status of the operator. |
isApprovedForAll
Returns the operator status of an operator for a given owner.
function isApprovedForAll(address account, address operator) public view returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The address of the owner. |
operator | address | The address of the operator. |
safeTransferFrom
Transfers amount tokens of token type id from from to to with extra data.
The caller must be operator of 'from' or 'from' & 'from' must have a balance of at least amount.
function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes memory data) public virtual override;
Parameters
| Name | Type | Description |
|---|---|---|
from | address | The address of the sender. |
to | address | The address of the receiver. |
id | uint256 | The id of the token. |
amount | uint256 | The token amount. |
data | bytes | The data passed to the receiver. |
safeBatchTransferFrom
Batched version of safeTransferFrom.
function safeBatchTransferFrom(address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data)
public
virtual
override;
Parameters
| Name | Type | Description |
|---|---|---|
from | address | The address of the sender. |
to | address | The address of the receiver. |
ids | uint256[] | The ids of the tokens. |
amounts | uint256[] | The token amounts. |
data | bytes | The data passed to the receiver. |
supportsInterface
function supportsInterface(bytes4 interfaceId) public pure returns (bool);
_safeTransferFrom
Private functions
function _safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes memory data) internal virtual;
_safeBatchTransferFrom
function _safeBatchTransferFrom(address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data)
internal
virtual;
_setApprovalForAll
function _setApprovalForAll(address owner, address operator, bool approved) internal virtual;
_doSafeTransferAcceptanceCheck
function _doSafeTransferAcceptanceCheck(address operator, address from, address to, uint256 id, uint256 amount, bytes memory data)
private;
_doSafeBatchTransferAcceptanceCheck
function _doSafeBatchTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) private;
_isContract
function _isContract(address account) internal view returns (bool);
Liquid20A
Author: 0xvv @ Kiln
This contract allows users to stake any amount of ETH in the vPool(s). Users are given an ERC-20 aToken to track their stake.
Functions
transfer
Transfers token from the caller to another address
function transfer(address to, uint256 amount) external returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
to | address | The address to transfer to |
amount | uint256 | The amount to transfer |
allowance
Retrieves the amount of tokens that an owner allowed to a spender
function allowance(address owner, address spender) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
owner | address | The address of the owner |
spender | address | The address of the spender |
approve
Approves a spender to transfer tokens on the caller's behalf
function approve(address spender, uint256 amount) external returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
spender | address | The address of the spender |
amount | uint256 | The amount to approve |
transferFrom
Transfers tokens from one address to another, using the allowance mechanism
function transferFrom(address from, address to, uint256 amount) external returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
from | address | The address to transfer from |
to | address | The address to transfer to |
amount | uint256 |
totalSupply
function totalSupply() external view override returns (uint256);
balanceOf
function balanceOf(address account) external view override returns (uint256);
requestExit
Burns the sender's shares and sends the exitQueue tickets to the caller.
function requestExit(uint256 amount) external override;
Parameters
| Name | Type | Description |
|---|---|---|
amount | uint256 | Amount of shares to add to the exit queue |
_transfer
function _transfer(address from, address to, uint256 amount) internal override;
_transferFrom
function _transferFrom(address spender, address from, address to, uint256 amount) internal override;
Liquid20C
Author: 0xvv @ Kiln
This contract allows users to stake any amount of ETH in the vPool(s). Users are given an ERC-20 cToken to track their stake.
Functions
transfer
Transfers token from the caller to another address
function transfer(address to, uint256 amount) external returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
to | address | The address to transfer to |
amount | uint256 | The amount to transfer |
allowance
Retrieves the amount of tokens that an owner allowed to a spender
function allowance(address owner, address spender) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
owner | address | The address of the owner |
spender | address | The address of the spender |
approve
Approves a spender to transfer tokens on the caller's behalf
function approve(address spender, uint256 amount) external returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
spender | address | The address of the spender |
amount | uint256 | The amount to approve |
transferFrom
Transfers tokens from one address to another, using the allowance mechanism
function transferFrom(address from, address to, uint256 amount) external returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
from | address | The address to transfer from |
to | address | The address to transfer to |
amount | uint256 |
MerkleVault
Inherits: IMerkleVault, Administrable, Initializable, Implementation
Author: mortimr @ Kiln
Funds distribution vault using merkle proofs to authorize withdrawals
State Variables
$root
The current merkle root used to verify claim requests
Slot: keccak256(bytes("merkleVault.1.root")) - 1
types.Bytes32 internal constant $root = types.Bytes32.wrap(0x1d72bdd8ebb24cdc615789f17c463dfb1fe22d0a9c3e2e83db3203cf4b1f2be0);
$ipfsHash
The current ipfs hash associated with the merkle root
Slot: keccak256(bytes("merkleVault.1.ipfsHash")) - 1
types.String internal constant $ipfsHash = types.String.wrap(0xe9bb128fd68516c65b38522aa2f7739e85d47a3214671ac9273550d2cef5e1a4);
$totalClaimedPerAccount
The mapping of already claimed amounts : mapping(address => uint256)
Slot: keccak256(bytes("merkleVault.1.totalClaimedPerAccount")) - 1
types.Mapping internal constant $totalClaimedPerAccount =
types.Mapping.wrap(0x434b080ec0dc7613d87ca93b5b660083adb8c732eaa35678d5918a3b53d5ff81);
$totalClaimed
The sum of all claimed amounts
Slot: keccak256(bytes("merkleVault.1.totalClaimed")) - 1
types.Uint256 internal constant $totalClaimed = types.Uint256.wrap(0xd861ffae2fee684c1e2f63e370c8ea498da9e58b75f637eeee60d1a01ca75c59);
$frameSize
Amount of epochs per frame
Slot: keccak256(bytes("merkleVault.1.frameSize")) - 1
types.Uint256 internal constant $frameSize = types.Uint256.wrap(0xe906a0ea72c128fe3b63278ff794cbb58f458fcecc52717e792bf287499a0fa7);
Functions
initialize
function initialize(address admin, bytes32 initialRoot, string calldata initialIpfsHash, uint256 initialFrameSize) external init(0);
Parameters
| Name | Type | Description |
|---|---|---|
admin | address | The address able to update the merkle root |
initialRoot | bytes32 | The initial merkle root |
initialIpfsHash | string | The initial report ipfs hash |
initialFrameSize | uint256 | The initial frame size |
totalClaimedForAccount
Retrieve the total claimed amount for an account
function totalClaimedForAccount(address account) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The account to inspect |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The total claimed amount for the account |
totalClaimed
Retrieve the total claimed on the contract
function totalClaimed() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The total claimed amount |
root
Retrieve the current merkle root
function root() external view returns (bytes32);
Returns
| Name | Type | Description |
|---|---|---|
<none> | bytes32 | Current merkle root |
ipfsHash
Retrieve the ipfs hash holding the merkle tree + extra data
function ipfsHash() external view returns (string memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | string | The ipfs hash |
setRootAndIpfsHash
Set the current merkle root
function setRootAndIpfsHash(bytes32 newRoot, string calldata newIpfsHash) external onlyAdmin;
Parameters
| Name | Type | Description |
|---|---|---|
newRoot | bytes32 | The new merkle root value |
newIpfsHash | string |
claim
Claims funds based on total claimed and current amount
function claim(address account, uint256 amount, bytes32[] calldata proofs) external;
Parameters
| Name | Type | Description |
|---|---|---|
account | address | |
amount | uint256 | The total amount of rewards claimable for the caller |
proofs | bytes32[] | The array of proofs to verify before claim |
frameSize
Retreive the number of epochs between two reports
function frameSize() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The number of epochs |
setFrameSize
Update the number of epochs between two reports
function setFrameSize(uint256 newFrameSize) external onlyAdmin;
Parameters
| Name | Type | Description |
|---|---|---|
newFrameSize | uint256 | The new frame size |
fallback
fallback() external payable;
receive
receive() external payable;
_leaf
Converts the account and amount combo to a bytes32 leaf
function _leaf(address account, uint256 amount) internal pure returns (bytes32);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The claimer account |
amount | uint256 | The claimable amount |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bytes32 | The leaf |
_verify
Internal utility to verify if a leaf is part of a merkle tree
function _verify(bytes32 leaf, bytes32[] calldata proofs) internal view returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
leaf | bytes32 | The leaf to verify |
proofs | bytes32[] | The list of proofs to use for the verification |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | True if leaf is in the tree |
_setRootAndIpfsHash
Internal utility to change the stored merkle root
function _setRootAndIpfsHash(bytes32 newRoot, string calldata newIpfsHash) internal;
Parameters
| Name | Type | Description |
|---|---|---|
newRoot | bytes32 | New merkle root value |
newIpfsHash | string |
_setFrameSize
Internal utility to change the frame size
function _setFrameSize(uint256 newFrameSize) internal;
Parameters
| Name | Type | Description |
|---|---|---|
newFrameSize | uint256 | New frame size value |
MultiPool
Inherits: IMultiPool, FeeDispatcher, Administrable, ExitQueueClaimHelper
Author: 0xvv @ Kiln
This contract contains the common functions to all integration contracts
Contains the functions to add pools, activate/deactivate a pool, change the fee of a pool and change the commission distribution
State Variables
$poolMap
The mapping of pool addresses
Type: mapping(uint256 => address)
Slot: keccak256(bytes("multiPool.1.poolMap")) - 1
types.Mapping internal constant $poolMap = types.Mapping.wrap(0xbbbff6eb43d00812703825948233d51219dc930ada33999d17cf576c509bebe5);
$fees
The mapping of fee amounts in basis point to be applied on rewards from different pools
Type: mapping(uint256 => uint256)
Slot: keccak256(bytes("multiPool.1.fees")) - 1
types.Mapping internal constant $fees = types.Mapping.wrap(0x725bc5812d869f51ca713008babaeead3e54db7feab7d4cb185136396950f0e3);
$commissionPaid
The mapping of commission paid for different pools
Type: mapping(uint256 => uint256)
Slot: keccak256(bytes("multiPool.1.commissionPaid")) - 1
types.Mapping internal constant $commissionPaid = types.Mapping.wrap(0x6c8f9259db4f6802ea7a1e0a01ddb54668b622f1e8d6b610ad7ba4d95f59da29);
$injectedEth
The mapping of injected Eth for different pools
Type: mapping(uint256 => uint256)
Slot: keccak256(bytes("multiPool.1.injectedEth")) - 1
types.Mapping internal constant $injectedEth = types.Mapping.wrap(0x03abd4c14227eca60c6fecceef3797455c352f43ab35128096ea0ac0d9b2170a);
$exitedEth
The mapping of exited Eth for different pools
Type: mapping(uint256 => uint256)
Slot: keccak256(bytes("multiPool.1.exitedEth")) - 1
types.Mapping internal constant $exitedEth = types.Mapping.wrap(0x76a0ecda094c6ccf2a55f6f1ef41b98d3c1f2dfcb9c1970701fe842ce778ff9b);
$poolActivation
The mapping storing whether users can deposit or not to each pool
Type: mapping(uint256 => bool)
Slot: keccak256(bytes("multiPool.1.poolActivation")) - 1
types.Mapping internal constant $poolActivation = types.Mapping.wrap(0x17b1774c0811229612ec3762023ccd209d6a131e52cdd22f3427eaa8005bcb2f);
$poolShares
The mapping of pool shares owned for each pools
Type: mapping(uint256 => uint256)
Slot: keccak256(bytes("multiPool.1.poolShares")) - 1
types.Mapping internal constant $poolShares = types.Mapping.wrap(0x357e26a850dc4edaa8b82b6511eec141075372c9c551d3ddb37c35a301f00018);
$poolCount
The number of pools.
Slot: keccak256(bytes("multiPool.1.poolCount")) - 1
types.Uint256 internal constant $poolCount = types.Uint256.wrap(0xce6dbdcc28927f6ed428550e539c70c9145bd20fc6e3d7611bd20e170e9b1840);
$depositPaused
True if deposits are paused
Slot: keccak256(bytes("multiPool.1.depositsPaused")) - 1
types.Bool internal constant $depositPaused = types.Bool.wrap(0xa030c45ae387079bc9a34aa1365121b47b8ef2d06c04682ce63b90b7c06843e7);
$maxCommission
The maximum commission that can be set for a pool, in basis points, to be set at initialization
Slot: keccak256(bytes("multiPool.1.maxCommission")) - 1
types.Uint256 internal constant $maxCommission = types.Uint256.wrap(0x70be78e680b682a5a3c38e305d79e28594fd0c62048cca29ef1bd1d746ca8785);
Functions
notPaused
This modifier reverts if the deposit is paused
modifier notPaused();
pools
Returns the list of vPools.
function pools() public view returns (address[] memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | address[] | vPools The addresses of the pool contract. |
pauseDeposits
Allows the integrator to pause and unpause deposits only.
function pauseDeposits(bool isPaused) external onlyAdmin;
Parameters
| Name | Type | Description |
|---|---|---|
isPaused | bool | Whether the deposits are paused or not. |
depositsPaused
Returns true if deposits are paused, false otherwise
function depositsPaused() external view returns (bool);
getFee
Returns the current fee in basis points for the given pool.
function getFee(uint256 poolId) public view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
poolId | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | feeBps The current fee in basis points. |
changeFee
Allows the integrator to change the fee.
Reverts if there are unsold integrator shares.
function changeFee(uint256 poolId, uint256 newFeeBps) external onlyAdmin;
Parameters
| Name | Type | Description |
|---|---|---|
poolId | uint256 | vPool id |
newFeeBps | uint256 | The new fee in basis points. |
changeSplit
Allows the admin to change the fee sharing upon withdrawal.
function changeSplit(address[] calldata recipients, uint256[] calldata splits) external onlyAdmin;
Parameters
| Name | Type | Description |
|---|---|---|
recipients | address[] | The list of fee recipients. |
splits | uint256[] | List of each recipient share in basis points. |
addPool
Allows the integrator to add a vPool.
Reverts if the pool is already in the pools list.
function addPool(address pool, uint256 feeBps) external onlyAdmin;
Parameters
| Name | Type | Description |
|---|---|---|
pool | address | |
feeBps | uint256 |
getPoolActivation
Returns true if the pool is active, false otherwise
function getPoolActivation(uint256 poolId) external view returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
poolId | uint256 | The id of the vPool. |
integratorCommissionOwed
Returns the ETH value of integrator shares left to sell.
function integratorCommissionOwed(uint256 poolId) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
poolId | uint256 | The id of the vPool. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The ETH value of unsold integrator shares. |
exitCommissionShares
Allows the integrator to exit the integrator shares of a vPool.
function exitCommissionShares(uint256 poolId) external onlyAdmin;
Parameters
| Name | Type | Description |
|---|---|---|
poolId | uint256 | The id of the vPool. |
onvPoolSharesReceived
function onvPoolSharesReceived(address operator, address from, uint256 amount, bytes memory) external returns (bytes4);
_exitCommissionShares
PRIVATE METHODS
Internal utility to exit commission shares
function _exitCommissionShares(uint256 poolId) internal;
Parameters
| Name | Type | Description |
|---|---|---|
poolId | uint256 | The vPool id |
_sendSharesToExitQueue
Internal utility to send pool shares to the exit queue
function _sendSharesToExitQueue(uint256 poolId, uint256 shares, IvPool pool, address ticketOwner) internal;
_findPoolIdOrRevert
Internal utility to find the id of a pool using its address
Reverts if the address is not found
function _findPoolIdOrRevert(address poolAddress) internal view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
poolAddress | address | address of the pool to look up |
_setFee
Internal utility to set the integrator fee value
function _setFee(uint256 integratorFeeBps, uint256 poolId) internal;
Parameters
| Name | Type | Description |
|---|---|---|
integratorFeeBps | uint256 | The new integrator fee in bps |
poolId | uint256 | The vPool id |
_getPool
Internal utility to get get the pool address
function _getPool(uint256 poolId) public view returns (IvPool);
Parameters
| Name | Type | Description |
|---|---|---|
poolId | uint256 | The index of the pool |
Returns
| Name | Type | Description |
|---|---|---|
<none> | IvPool | The pool |
_addPool
Add a pool to the list.
function _addPool(address newPool, uint256 fee) internal;
Parameters
| Name | Type | Description |
|---|---|---|
newPool | address | new pool address. |
fee | uint256 | fees in basis points of ETH. |
_checkPoolIsEnabled
Reverts if the given pool is not enabled.
function _checkPoolIsEnabled(uint256 poolId) internal view;
Parameters
| Name | Type | Description |
|---|---|---|
poolId | uint256 | pool id. |
_stakedEthValue
Returns the ETH value of the vPool shares in the contract.
function _stakedEthValue(uint256 poolId) internal view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | amount of ETH. |
_integratorCommissionEarned
Returns the amount of ETH earned by the integrator.
function _integratorCommissionEarned(uint256 poolId) internal view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | amount of ETH. |
_integratorCommissionOwed
Returns the amount of ETH owed to the integrator.
function _integratorCommissionOwed(uint256 poolId) internal view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | amount of ETH. |
_ethAfterCommission
Returns the ETH value of the vPool shares after subtracting integrator commission.
function _ethAfterCommission(uint256 poolId) internal view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | amount of ETH. |
_poolSharesOfIntegrator
Returns the number of vPool shares owed as commission.
function _poolSharesOfIntegrator(uint256 poolId) internal view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | amount of shares. |
_setMaxCommission
Internal utility to set the max commission value
function _setMaxCommission(uint256 maxCommission) internal;
Parameters
| Name | Type | Description |
|---|---|---|
maxCommission | uint256 | The new max commission in bps |
Constants
MIN_COMMISSION_TO_SELL
uint256 constant MIN_COMMISSION_TO_SELL = 1e9;
MultiPool1155
Inherits: MultiPool, IMultiPool1155
Author: 0xvv @ Kiln
This contract contains internal functions to stake and track positions in multiple pools. It also exposes supply getters and pool addition
State Variables
$totalSupplies
The list of total supply of shares for each pools
Type: mapping(uint256 => uint256).
Slot: keccak256(bytes("multiPool1155.1.totalSupplies")) - 1
types.Mapping internal constant $totalSupplies = types.Mapping.wrap(0xc3fcc6263e71fb1156424f68b5c15d631be5746545fee5eabd101fec6b14066e);
$balances
Stores the balances
Type: mapping(address => uint256).
Slot: keccak256(bytes("multiPool1155.1.balances")) - 1
ctypes.BalanceMapping internal constant $balances =
ctypes.BalanceMapping.wrap(0x60a075ea67904efae3adef8f9db9862c0f2b5216f41595d9833a814777bd689f);
Functions
totalUnderlyingSupply
Returns the amount of pool shares owned by the users.
function totalUnderlyingSupply(uint256 poolId) public view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
poolId | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | Total amount of shares. |
totalSupply
Returns the total amount of vStakes shares.
function totalSupply(uint256 poolId) public view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
poolId | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | Total amount of shares. |
poolRate
Returns the poolShare to ETH conversion rate for the given ID
function poolRate(uint256 id) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint256 | Id of the pool |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | ETH value of a pool share |
setPoolActivation
Allows the integrator to prevent users from depositing to a vPool.
function setPoolActivation(uint256 poolId, bool status) external onlyAdmin;
Parameters
| Name | Type | Description |
|---|---|---|
poolId | uint256 | The id of the vPool. |
status | bool | Whether the users can deposit to the pool. |
requestExit
Sends the given number of shares to the exit queue, the user receives the NFT ticket
function requestExit(uint256 id, uint256 amount) public;
Parameters
| Name | Type | Description |
|---|---|---|
id | uint256 | Id of the pool |
amount | uint256 | Amount of shares to add to the exit queue |
batchRequestExit
Batched version of requestExit
function batchRequestExit(uint256[] calldata ids, uint256[] calldata amounts) external;
Parameters
| Name | Type | Description |
|---|---|---|
ids | uint256[] | Ids of the pools |
amounts | uint256[] | Amount of shares to add to the exit queue |
_stake
PRIVATE METHODS ///
Internal function to stake in one or more pools with arbitrary amounts to each one
function _stake(uint256[] calldata amounts, uint256[] calldata ids) internal notPaused returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
amounts | uint256[] | List of amounts for each pool |
ids | uint256[] | List of pool ids. |
_requestExit
Internal function to request exit from a pool
function _requestExit(uint256 id, uint256 amount, PoolExitDetails memory details) internal;
Parameters
| Name | Type | Description |
|---|---|---|
id | uint256 | Pool id |
amount | uint256 | Amount to exit |
details | PoolExitDetails | Exit details to be logged afterwards |
_balanceOf
Internal function to retrieve the balance of a given account for a token
function _balanceOf(address account, uint256 id) internal view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | Address of the account |
id | uint256 | Token id |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | balance of the account for the given token |
_balanceOfBatch
Internal function to retrieve the balance of a given account for a list of tokens
function _balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) internal view returns (uint256[] memory);
Parameters
| Name | Type | Description |
|---|---|---|
accounts | address[] | List of addresses of the accounts |
ids | uint256[] | List of token ids |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256[] | balances of the accounts for the given tokens |
_balanceOfUnderlying
Internal function to retrieve the balance of a given account for a token in underlying
function _balanceOfUnderlying(address account, uint256 id) internal view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | Address of the account |
id | uint256 | Token id |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | balance of the account for the given token in underlying |
_balanceOfUnderlyingBatch
Internal function to retrieve the balance of a given account for a list of tokens in underlying
function _balanceOfUnderlyingBatch(address[] calldata accounts, uint256[] calldata ids) internal view returns (uint256[] memory);
Parameters
| Name | Type | Description |
|---|---|---|
accounts | address[] | List of addresses of the accounts |
ids | uint256[] | List of token ids |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256[] | balances of the accounts for the given tokens in underlying |
_mint
Internal function for minting
function _mint(address account, uint256 amount, uint256 id) internal;
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The address to mint to |
amount | uint256 | The amount to mint |
id | uint256 |
_burn
Internal function for burning
function _burn(address account, uint256 amount, uint256 id) internal;
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The address to burn from |
amount | uint256 | The amount to burn |
id | uint256 |
MultiPool20
Inherits: MultiPool, IMultiPool20
Author: 0xvv @ Kiln
This contract contains the internal logic for an ERC-20 token based on one or multiple pools.
State Variables
$totalSupply
The total supply of ERC 20.
Slot: keccak256(bytes("multiPool20.1.totalSupply")) - 1
types.Uint256 internal constant $totalSupply = types.Uint256.wrap(0xb24a0f21470b6927dcbaaf5b1f54865bd687f4a2ce4c43edf1e20339a4c05bae);
$poolRoutingList
The list containing the percentages of ETH to route to each pool, in basis points, must add up to 10 000.
Slot: keccak256(bytes("multiPool20.1.poolRoutingList")) - 1
types.Array internal constant $poolRoutingList = types.Array.wrap(0x3803482dd7707d12238e38a3b1b5e55fa6e13d81c36ce29ec5c267cc02c53fe3);
$balances
Stores the balances : mapping(address => uint256).
Slot: keccak256(bytes("multiPool20.1.balances")) - 1
victypes.BalanceMapping internal constant $balances =
victypes.BalanceMapping.wrap(0x4f74125ce1aafb5d1699fc2e5e8f96929ff1a99170dc9bda82c8944acc5c7286);
$approvals
Stores the approvals
Type: mapping(address => mapping(address => bool).
Slot: keccak256(bytes("multiPool20.1.approvals")) - 1
ctypes.ApprovalsMapping internal constant $approvals =
ctypes.ApprovalsMapping.wrap(0xebc1e0a04bae59eb2e2b17f55cd491aec28c349ae4f6b6fe9be28a72f9c6b202);
$monoTicketThreshold
The threshold below which we try to issue only one exit ticket
Slot: keccak256(bytes("multiPool20.1.monoTicketThreshold")) - 1
types.Uint256 internal constant $monoTicketThreshold =
types.Uint256.wrap(0x900053b761278bb5de4eeaea5ed9000b89943edad45dcf64a9dab96d0ce29c2e);
Functions
setPoolPercentages
Set the percentage of new stakes to route to each pool
function setPoolPercentages(uint256[] calldata split) external onlyAdmin;
Parameters
| Name | Type | Description |
|---|---|---|
split | uint256[] | Array of values in basis points to route to each pool |
setMonoTicketThreshold
Sets the threshold below which we try to issue only one exit ticket
function setMonoTicketThreshold(uint256 minTicketEthValue) external onlyAdmin;
Parameters
| Name | Type | Description |
|---|---|---|
minTicketEthValue | uint256 | The threshold |
requestExit
Burns the sender's shares and sends the exitQueue tickets to the caller.
function requestExit(uint256 amount) external virtual;
Parameters
| Name | Type | Description |
|---|---|---|
amount | uint256 | Amount of shares to add to the exit queue |
rate
Returns the share to ETH conversion rate
function rate() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | ETH value of a share |
_requestExit
Private functions
Internal function to requestExit
function _requestExit(uint256 amount) internal;
Parameters
| Name | Type | Description |
|---|---|---|
amount | uint256 | The amount of shares to exit |
_checkCommissionRatio
Internal function to exit the commission shares if needed
function _checkCommissionRatio(uint256 id) internal;
Parameters
| Name | Type | Description |
|---|---|---|
id | uint256 | The pool id |
_sendToExitQueue
Utility function to send a given ETH amount of shares to the exit queue of a pool
function _sendToExitQueue(uint256 poolId, uint256 ethAmount, PoolExitDetails memory details) internal;
_stake
Internal function to stake in one or more pools with arbitrary amounts to each one
function _stake(uint256 totalAmount) internal notPaused returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
totalAmount | uint256 | The amount of ETH to stake |
_setPoolPercentages
Internal function to set the pool percentages
function _setPoolPercentages(uint256[] calldata percentages) internal;
Parameters
| Name | Type | Description |
|---|---|---|
percentages | uint256[] | The new percentages |
setPoolActivation
Allows the integrator to prevent users from depositing to a vPool.
function setPoolActivation(uint256 poolId, bool status, uint256[] calldata newPoolPercentages) external onlyAdmin;
Parameters
| Name | Type | Description |
|---|---|---|
poolId | uint256 | The id of the vPool. |
status | bool | Whether the users can deposit to the pool. |
newPoolPercentages | uint256[] | Array of value in basis points to route to each pool after the change |
_balanceOf
Internal function to retrieve the balance of a given account
function _balanceOf(address account) internal view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The account to retrieve the balance of |
_balanceOfUnderlying
Internal function to retrieve the balance of a given account in underlying
function _balanceOfUnderlying(address account) internal view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The account to retrieve the balance of in underlying |
_totalUnderlyingSupply
Internal function retrieve the total underlying supply
function _totalUnderlyingSupply() internal view returns (uint256);
_totalSupply
Internal function to retrieve the total supply
function _totalSupply() internal view returns (uint256);
_transfer
Internal function to transfer tokens from one account to another
function _transfer(address from, address to, uint256 amount) internal virtual;
Parameters
| Name | Type | Description |
|---|---|---|
from | address | The account to transfer from |
to | address | The account to transfer to |
amount | uint256 | The amount to transfer |
_allowance
Internal function to retrieve the allowance of a given spender
function _allowance(address owner, address spender) internal view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
owner | address | The owner of the allowance |
spender | address | The spender of the allowance |
_approve
Internal function to approve a spender
function _approve(address owner, address spender, uint256 amount) internal;
Parameters
| Name | Type | Description |
|---|---|---|
owner | address | The owner of the allowance |
spender | address | The spender of the allowance |
amount | uint256 | The amount to approve |
_transferFrom
Internal function to transfer tokens from one account to another
function _transferFrom(address spender, address from, address to, uint256 amount) internal virtual;
Parameters
| Name | Type | Description |
|---|---|---|
spender | address | The spender of the allowance |
from | address | The account to transfer from |
to | address | The account to transfer to |
amount | uint256 | The amount to transfer |
_mint
Internal function for minting
function _mint(address account, uint256 amount) internal;
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The address to mint to |
amount | uint256 | The amount to mint |
_burn
Internal function to burn tokens
function _burn(address account, uint256 amount) internal;
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The account to burn from |
amount | uint256 | The amount to burn |
_setMonoTicketThreshold
Internal function to set the mono ticket threshold
function _setMonoTicketThreshold(uint256 minTicketEthValue) internal;
Parameters
| Name | Type | Description |
|---|---|---|
minTicketEthValue | uint256 | The minimum ticket value |
Constants
MIN_SUPPLY
uint256 constant MIN_SUPPLY = 1e14;
COMMISSION_MAX
uint256 constant COMMISSION_MAX = 10;
Native1155
Inherits: INative1155, MultiPool1155, Implementation, Initializable
Author: 0xvv @ Kiln
This contract allows users to stake in any of the vPools with any amount of ETH and track their position
Users are given non transferable shares to track their stake, shares of different pools are not equivalent
Users can interact with the contract using the ERC-1155 style interface, but the contract is not ERC-1155 compliant as it does not support transfers
State Variables
$name
The name of the shares.
Slot: keccak256(bytes("native1155.1.name")) - 1
types.String internal constant $name = types.String.wrap(0xca1397ca23f10c097888f2db1683abfb67f39fdf3f1ac323db83da702196e217);
$symbol
The symbol of the shares.
Slot: keccak256(bytes("native1155.1.symbol")) - 1
types.String internal constant $symbol = types.String.wrap(0x1aafe6fc63278e1251be29ee930745925b8279eab16432ea692c6c0854d3bcf0);
$uriPrefix
The base uri.
Slot: keccak256(bytes("native1155.1.uriPrefix")) - 1
types.String internal constant $uriPrefix = types.String.wrap(0xbfd652c9b61f9a572f0a620571346b2aa3d695d12a83f178e91284c11b7d753c);
Functions
initialize
Initializes the contract with the given parameters.
function initialize(Native1155Configuration calldata args) external init(0);
Parameters
| Name | Type | Description |
|---|---|---|
args | Native1155Configuration | The arguments to initialize the contract with. |
uri
Returns the URI for token type id.
function uri(uint256 id) external view returns (string memory);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint256 | The id of the token. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | string | The URI of the token. |
setPrefixUri
Sets the base URI for all tokens.
Ony callable by the admin.
function setPrefixUri(string calldata uri_) external onlyAdmin;
Parameters
| Name | Type | Description |
|---|---|---|
uri_ | string |
name
Returns the name of the token.
function name() external view returns (string memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | string | The name of the token. |
symbol
Returns the symbol of the token.
function symbol() external view returns (string memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | string | The symbol of the token. |
balanceOf
Returns the amount of staking shares of a given pool for an account.
function balanceOf(address account, uint256 id) public view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The address of the account. |
id | uint256 | The id of the pool. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | amount of staking shares. |
balanceOfBatch
Batch version of balanceOf().
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory);
Parameters
| Name | Type | Description |
|---|---|---|
accounts | address[] | The addresses of the accounts. |
ids | uint256[] | The ids of the pool. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256[] | list of amounts of staking shares. |
balanceOfUnderlying
Returns the amount of pool shares for an account in a given pool.
function balanceOfUnderlying(address account, uint256 id) public view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The address of the account. |
id | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | amount of pool shares. |
balanceOfUnderlyingBatch
Batch version of balanceOfUnderlying().
function balanceOfUnderlyingBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory);
Parameters
| Name | Type | Description |
|---|---|---|
accounts | address[] | The addresses of the accounts. |
ids | uint256[] | The ids of the pool. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256[] | list of amounts of pool shares. |
stake
Stake the given amounts of ETH in the given pools.
Sum of amounts must be equal to msg.value.
function stake(uint256[] calldata amounts, uint256[] calldata ids) public payable returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
amounts | uint256[] | List of amount for each pool |
ids | uint256[] | List of pool ids |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | Whether the staking was successful. |
_setUriPrefix
Internal utility to set the URI prefix to use
function _setUriPrefix(string calldata newUriPrefix) internal;
Parameters
| Name | Type | Description |
|---|---|---|
newUriPrefix | string | The new uri prefix to set |
Native20
Inherits: MultiPool20, INative20, Implementation, Initializable
Author: 0xvv @ Kiln
This contract allows users to stake any amount of ETH in the vPool(s)
Users are given non transferable ERC-20 type shares to track their stake
State Variables
$name
The name of the shares.
Slot: keccak256(bytes("native20.1.name")) - 1
types.String internal constant $name = types.String.wrap(0xeee152275d096301850a53ae85c6991c818bc6bac8a2174c268aa94ed7cf06f1);
$symbol
The symbol of the shares.
Slot: keccak256(bytes("native20.1.symbol")) - 1
types.String internal constant $symbol = types.String.wrap(0x4a8b3e24ebc795477af927068865c6fcc26e359a994edca2492e515a46aad711);
Functions
initialize
Initializes the contract with the given parameters.
function initialize(Native20Configuration calldata args) external init(0);
Parameters
| Name | Type | Description |
|---|---|---|
args | Native20Configuration | The initialization arguments. |
name
Returns the name of the token.
function name() external view returns (string memory);
symbol
Returns the symbol of the token, usually a shorter version of the name.
function symbol() external view returns (string memory);
decimals
Returns the number of decimals used to get its user representation.
function decimals() external view virtual override returns (uint8);
balanceOf
Returns the amount of staking shares for an account.
function balanceOf(address account) external view virtual returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The address of the account. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | amount of staking shares. |
balanceOfUnderlying
Returns the ETH value of the account balance.
function balanceOfUnderlying(address account) external view virtual returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The address of the account. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | amount of ETH. |
totalSupply
Returns the total amount of staking shares.
function totalSupply() external view virtual returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | Total amount of shares. |
totalUnderlyingSupply
Returns the amount of ETH owned by the users in the pool(s).
function totalUnderlyingSupply() external view virtual returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | Total amount of shares. |
stake
Function to stake ETH.
function stake() external payable;
vNFT
Inherits: IvNFT, NFT, IERC4907, Administrable, Initializable, Implementation, WithdrawRecipientLike
Author: mortimr @ Kiln
Mint or Purchase 1 NFT = own 1 validator
State Variables
$uriPrefix
URI prefix used when return the token URI
Slot: keccak256(bytes("nft.1.uriPrefix")) - 1
types.String internal constant $uriPrefix = types.String.wrap(0xb23e3bb81f905722c3794f66661b6f02d2c6087f3a9f12bd1009a955eaad6308);
$users
Internal mapping of ERC4907 users of the vNFTs
Type: mapping(uint256 => User4907)
Slot: keccak256(bytes("nft.1.users")) - 1
victypes.User4907Mapping internal constant $users =
victypes.User4907Mapping.wrap(0x063e58580d7c13f4d3c3ec935e3940c26f6f92139f3a108a5c025f3c3da5f8f9);
$debts
Internal mapping that holds the users claimable amounts
Type: mapping(address => uint256)
Slot: keccak256(bytes("nft.1.debts")) - 1
types.Mapping internal constant $debts = types.Mapping.wrap(0xcf62cc6e8953d10a2b46e09153848eaa59d6d313efd4ecd09e2b83409cc17e35);
$exited
Mapping of exited validators
Type: mapping(uint256 => bool)
Slot: keccak256(bytes("nft.1.exited")) - 1
types.Mapping internal constant $exited = types.Mapping.wrap(0xdc21987bff09d5261da331a08f03af33a49a1c9fe4e372e05137aed79ab72b33);
$factory
The address of the vFactory on which to purchase validators
Slot: keccak256(bytes("nft.1.factory")) - 1
types.Address internal constant $factory = types.Address.wrap(0x69fff1d77a01147a75b9614d339245cc8f1075258f85be20988953987e69783a);
$execLayerVault
The address of the exec layer vault
Slot: keccak256(bytes("nft.1.execLayerVault")) - 1
types.Address internal constant $execLayerVault = types.Address.wrap(0x504c75548da90f3ba5db2f94526211f0da12946a5d5ab4a7b787b3270210514a);
$operatorCommission
The amount of commission for the operator in BPS
Slot: keccak256(bytes("nft.1.operatorCommission")) - 1
types.Uint256 internal constant $operatorCommission = types.Uint256.wrap(0x3ecd15633a9e1be6395424838175447849914b9f35caa0570337a2a0396911ca);
$integratorCommission
The amount of commission for the integrator in BPS
Slot: keccak256(bytes("nft.1.integratorCommission")) - 1
types.Uint256 internal constant $integratorCommission =
types.Uint256.wrap(0x19c4145f70cb99496e96425cc5375ced77e11a35c610c19bd5aec35915951c0e);
$integrator
The address of the integrator
Slot: keccak256(bytes("nft.1.integrator")) - 1
types.Address internal constant $integrator = types.Address.wrap(0xa223bf738f821902c37d691cd3d2245a32d29a94501405b450683b11b37651a9);
$extraData
The extra data to use on deposit
Slot: keccak256(bytes("nft.1.extraData")) - 1
types.String internal constant $extraData = types.String.wrap(0x86632fa758a836bd2779078b54de6c13be658e32417419da0cc171a4d5e3da1f);
$purchasePaused
True if purchase is paused
Slot: keccak256(bytes("nft.1.purchasePaused")) - 1
types.Bool internal constant $purchasePaused = types.Bool.wrap(0xb36aa111209ed0d56f6cc61559fc12c9e3dafc7aed648c08f210659bebb89843);
$soulboundMode
True if soulbound mode is active
Slot: keccak256(bytes("nft.1.soulboundMode")) - 1
types.Bool internal constant $soulboundMode = types.Bool.wrap(0x1fbbb393c185a82e26c2092a2238ba94403f2971f3ed9bcb79897a3b64dc200a);
$internalIds
The mapping of externals ids to internals ids
Type: mapping(uint256 => uint256)
Slot: keccak256(bytes("nft.1.internalsIds")) - 1
types.Mapping internal constant $internalIds = types.Mapping.wrap(0x11b9d9a342fd6e66f51a8fc0110e510978d892e0c91d751b16aeafd1e6e42304);
WITHDRAWAL_CHANNEL
The withdrawal channel to use when purchasing validators from the factory
bytes32 private constant WITHDRAWAL_CHANNEL = bytes32(0);
FACTORY
uint8 private constant FACTORY = 0;
EXEC_LAYER_VAULT
uint8 private constant EXEC_LAYER_VAULT = 1;
OWNER
uint8 private constant OWNER = 2;
INTEGRATOR
uint8 private constant INTEGRATOR = 3;
Functions
notPaused
Check that purchase is not paused
modifier notPaused();
initialize
function initialize(VNFTConfiguration calldata config) external init(0);
Parameters
| Name | Type | Description |
|---|---|---|
config | VNFTConfiguration | The configuration for the vNFT |
tokenURI
function tokenURI(uint256 tokenId) external view override(IERC721Metadata, NFT) returns (string memory);
_onTransfer
Internal hook happening at each transfer
To override
function _onTransfer(address, address, uint256 tokenId) internal view override;
Parameters
| Name | Type | Description |
|---|---|---|
<none> | address | |
<none> | address | |
tokenId | uint256 | The token id |
_onMint
Internal hook happening at each mint
To override
function _onMint(address to, uint256 tokenId) internal override;
Parameters
| Name | Type | Description |
|---|---|---|
to | address | The address receiving the token |
tokenId | uint256 | The token id |
_onBurn
Internal hook happening at each burn
To override
function _onBurn(uint256 tokenId) internal override;
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | The token id |
soulboundMode
Retrieve the soulbound mode status
if active, thansfers are disabled
function soulboundMode() external view override returns (bool);
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | The current soulbound mode status |
execLayerVault
Retrieve the exec layer vault address
function execLayerVault() external view returns (address);
Returns
| Name | Type | Description |
|---|---|---|
<none> | address | The current exec layer vault address |
factory
Retrieve the factory address
function factory() external view returns (address);
Returns
| Name | Type | Description |
|---|---|---|
<none> | address | The current factory address |
integrator
Retrieve the integrator address
function integrator() external view returns (address);
Returns
| Name | Type | Description |
|---|---|---|
<none> | address | The current integrator address |
operatorCommission
Retrieve the operator commission
This value is not used inside the contract but only in the off-chain accounting engine building the exec layer vault merkle tree
function operatorCommission() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The current operator commission |
integratorCommission
Retrieve the integrator commission
This value is not used inside the contract but only in the off-chain accounting engine building the exec layer vault merkle tree
function integratorCommission() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The current integrator commission |
extraData
Retrieve the extra data used for each deposit
function extraData() external view returns (string memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | string | The currently used extra data |
startTokenId
Retrieve the starting token id
function startTokenId() external pure returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The starting token id |
resolve
Retrieve the associated validator ids for the given token ids
function resolve(uint256[] calldata tokenIds) external view returns (uint256[] memory validatorIds);
Parameters
| Name | Type | Description |
|---|---|---|
tokenIds | uint256[] | The list of token ids to lookup |
Returns
| Name | Type | Description |
|---|---|---|
validatorIds | uint256[] | The list of associated validator ids |
userOf
Get the user address of an NFT
The zero address indicates that there is no user or the user is expired
function userOf(uint256 tokenId) external view returns (address currentUser);
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | The NFT to get the user address for |
Returns
| Name | Type | Description |
|---|---|---|
currentUser | address | The user address for this NFT |
userExpires
Get the user expires of an NFT
The zero value indicates that there is no user
function userExpires(uint256 tokenId) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | The NFT to get the user expires for |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The user expires for this NFT |
beneficiaryOf
Retriver the current beneficiary of EL and CL rewards
function beneficiaryOf(uint256 tokenId) external view returns (address beneficiary);
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | Id of the vNFT |
Returns
| Name | Type | Description |
|---|---|---|
beneficiary | address | The current rewards beneficiary address |
uriPrefix
Retrieve the uri prefix used for all token uris
function uriPrefix() external view returns (string memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | string | The current uri prefix |
purchasePaused
Retrieve the purchase function status
function purchasePaused() external view returns (bool);
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | True if the purchase function is paused or false otherwise |
setIntegrator
Sets the integrator address
function setIntegrator(address newIntegrator) external onlyAdmin;
Parameters
| Name | Type | Description |
|---|---|---|
newIntegrator | address | The new integrator address to use |
setIntegratorCommission
Sets the integrator commission
function setIntegratorCommission(uint256 newIntegratorCommission) external onlyAdmin;
Parameters
| Name | Type | Description |
|---|---|---|
newIntegratorCommission | uint256 | The new integrator commission to use |
setOperatorCommission
Sets the operator commission
function setOperatorCommission(uint256 newOperatorCommission) external onlyAdmin;
Parameters
| Name | Type | Description |
|---|---|---|
newOperatorCommission | uint256 | The new operator commission to use |
isExited
Retrieve if the token is exited
function isExited(uint256 tokenId) external view returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | The token id to lookup |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | True if the token is exited or false otherwise |
purchasable
Retrieve the amount of purchasable validators
function purchasable() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The currently purchasable validator amount |
setName
Sets the ERC721 contract name
function setName(string calldata newName) external onlyAdmin;
Parameters
| Name | Type | Description |
|---|---|---|
newName | string | The new name of the contract |
setSymbol
Sets the ERC721 contract symbol
function setSymbol(string calldata newSymbol) external onlyAdmin;
Parameters
| Name | Type | Description |
|---|---|---|
newSymbol | string | The new symbol of the contract |
setUriPrefix
Sets the uri prefix of the contract
function setUriPrefix(string calldata newUriPrefix) external onlyAdmin;
Parameters
| Name | Type | Description |
|---|---|---|
newUriPrefix | string | The new uri prefix to use |
pausePurchase
Pause the purchase function
function pausePurchase() external onlyAdmin;
unpausePurchase
Unpause the purchase function
function unpausePurchase() external onlyAdmin;
setUser
Set the user and expires of an NFT. Once the rent is defined, only the rentee can edit or revoke the rent
The address defined as user will remain the user until the clearUsership method is called
function setUser(uint256 tokenId, address user, uint64 expires) external;
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | The id of the token to rent |
user | address | The new user of the NFT |
expires | uint64 | UNIX timestamp, The new user could use the NFT before expires |
clearUsership
Withdraw rewards if any for the user and clears the usership
function clearUsership(uint256 tokenId) external returns (uint256 newId);
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | The token id to clear the usership for |
claimDebt
Claim the rewards due to the user
function claimDebt() external;
debt
Retrieve the debt due to an user
function debt(address user) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | The user to lookup |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The debt due to the user |
purchase
Purchase one or several validators
The msg.value should be a multiple of 32 ETH > 0
function purchase() external payable notPaused returns (uint256[] memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256[] | The list of minted NFT ids |
exit
Triggers an exit action on the underlying validators
function exit(uint256[] calldata tokenIds) external;
Parameters
| Name | Type | Description |
|---|---|---|
tokenIds | uint256[] | The list of token ids upon which to perform the exits |
withdraw
Triggers a withdrawal action on the underlying validators
function withdraw(uint256[] calldata tokenIds, address recipient) external returns (uint256[] memory);
Parameters
| Name | Type | Description |
|---|---|---|
tokenIds | uint256[] | The list of token ids upon which to perform the withdrawal |
recipient | address | The address that should receive the pulled funds |
_withdraw
Internal utility to withdraw
function _withdraw(uint256[] memory tokenIds, address recipient, bool ownerOnly) internal returns (uint256[] memory);
Parameters
| Name | Type | Description |
|---|---|---|
tokenIds | uint256[] | The token ids to withdraw |
recipient | address | The recipient of the withdrawn tokens |
ownerOnly | bool | Whether only the owner can withdraw |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256[] | validatorIds The validator ids that were withdrawn |
withdrawCallback
function withdrawCallback(uint256 _id, bytes memory _publicKey, uint256 _amount) external payable;
_solveId
Internal utility to solve the token id
function _solveId(uint256 externalId) internal view returns (uint256);
_getWithdrawableAmount
Internal utility to get the amount of withdrawable funds for a given token id
function _getWithdrawableAmount(uint256 tokenId) internal view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | The token id to get the withdrawable amount for |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The amount of withdrawable funds |
_setFactory
Internal utility to set the factory to purchase validator on
function _setFactory(address newFactory) internal;
Parameters
| Name | Type | Description |
|---|---|---|
newFactory | address | The new factory to set |
_setUriPrefix
Internal utility to set the URI prefix to use
function _setUriPrefix(string calldata newUriPrefix) internal;
Parameters
| Name | Type | Description |
|---|---|---|
newUriPrefix | string | The new uri prefix to set |
_setExecLayerVault
Internal utility to set the exec layer vault to point our validators to
function _setExecLayerVault(address newExecLayerVault) internal;
Parameters
| Name | Type | Description |
|---|---|---|
newExecLayerVault | address | The new exec layer vault address |
_setOperatorCommission
Internal utility to set the operator commission
function _setOperatorCommission(uint256 newOperatorCommission) internal;
Parameters
| Name | Type | Description |
|---|---|---|
newOperatorCommission | uint256 | The new operator commission in bps |
_setIntegratorCommission
Internal utility to set the integrator commission
function _setIntegratorCommission(uint256 newIntegratorCommission) internal;
Parameters
| Name | Type | Description |
|---|---|---|
newIntegratorCommission | uint256 | The new integrator commission in bps |
_setIntegrator
Internal utility to set the integrator
function _setIntegrator(address newIntegrator) internal;
Parameters
| Name | Type | Description |
|---|---|---|
newIntegrator | address | The new integrator address |
_setExtraData
Internal utility to set the extra data to use upon deposits
function _setExtraData(string calldata newExtraData) internal;
Parameters
| Name | Type | Description |
|---|---|---|
newExtraData | string | The new extra data to set |
_setSoulboundMode
Internal utility to set the soulbound mode
function _setSoulboundMode(bool active) internal;
Parameters
| Name | Type | Description |
|---|---|---|
active | bool | Whether or not the soulbound mode is enabled |
_castedFactory
Internal utility to retrieve the factory address casted to its interface
function _castedFactory() internal view returns (IvFactory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | IvFactory | The factory address |
_userOf
Internal utility to retrieve the current user of a token
function _userOf(uint256 tokenId) internal view returns (address);
Returns
| Name | Type | Description |
|---|---|---|
<none> | address | The current user address or null address if not set |
_beneficiaryOf
Internal utility to retrieve the current rewards beneficiary of a token
function _beneficiaryOf(uint256 tokenId) internal view returns (address);
Returns
| Name | Type | Description |
|---|---|---|
<none> | address | The current user address or owner address if no user is set |
_isExited
Internal utility to check the exit status of a validator
function _isExited(uint256 tokenId) internal view returns (bool);
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | True if the validator is exited, false otherwise |
getApproved
function getApproved(uint256 tokenId) public view virtual override(IERC721, NFT) returns (address);
_approve
function _approve(address to, address owner, uint256 tokenId) internal virtual override;
_isApprovedOrUser
Internal utility to check if the specified address is either approved by the user or the user for the given token id
function _isApprovedOrUser(address spender, uint256 tokenId) internal view virtual returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
spender | address | The address to verify |
tokenId | uint256 | The token id to verify |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | True if approved or user |
_nextId
Internal utility to compute the next token id to mint
function _nextId() internal view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The next token id to mint |
_currentId
Internal utility to compute the last minted token id
function _currentId() internal view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The last token id minted |