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);