MultiPool1155

Git Source

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

NameTypeDescription
poolIduint256

Returns

NameTypeDescription
<none>uint256Total amount of shares.

totalSupply

Returns the total amount of vStakes shares.

function totalSupply(uint256 poolId) public view returns (uint256);

Parameters

NameTypeDescription
poolIduint256

Returns

NameTypeDescription
<none>uint256Total amount of shares.

poolRate

Returns the poolShare to ETH conversion rate for the given ID

function poolRate(uint256 id) external view returns (uint256);

Parameters

NameTypeDescription
iduint256Id of the pool

Returns

NameTypeDescription
<none>uint256ETH 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

NameTypeDescription
poolIduint256The id of the vPool.
statusboolWhether 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

NameTypeDescription
iduint256Id of the pool
amountuint256Amount of shares to add to the exit queue

batchRequestExit

Batched version of requestExit

function batchRequestExit(uint256[] calldata ids, uint256[] calldata amounts) external;

Parameters

NameTypeDescription
idsuint256[]Ids of the pools
amountsuint256[]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

NameTypeDescription
amountsuint256[]List of amounts for each pool
idsuint256[]List of pool ids.

_requestExit

Internal function to request exit from a pool

function _requestExit(uint256 id, uint256 amount, PoolExitDetails memory details) internal;

Parameters

NameTypeDescription
iduint256Pool id
amountuint256Amount to exit
detailsPoolExitDetailsExit 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

NameTypeDescription
accountaddressAddress of the account
iduint256Token id

Returns

NameTypeDescription
<none>uint256balance 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

NameTypeDescription
accountsaddress[]List of addresses of the accounts
idsuint256[]List of token ids

Returns

NameTypeDescription
<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

NameTypeDescription
accountaddressAddress of the account
iduint256Token id

Returns

NameTypeDescription
<none>uint256balance 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

NameTypeDescription
accountsaddress[]List of addresses of the accounts
idsuint256[]List of token ids

Returns

NameTypeDescription
<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

NameTypeDescription
accountaddressThe address to mint to
amountuint256The amount to mint
iduint256

_burn

Internal function for burning

function _burn(address account, uint256 amount, uint256 id) internal;

Parameters

NameTypeDescription
accountaddressThe address to burn from
amountuint256The amount to burn
iduint256