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 |