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 |