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 |