IMultiPool

Git Source

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

NameTypeDescription
vPoolsaddress[]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

NameTypeDescription
iduint256Id of the pool

Returns

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

NameTypeDescription
poolIduint256vPool id
newFeeBpsuint256The 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

NameTypeDescription
recipientsaddress[]The list of fee recipients.
splitsuint256[]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

NameTypeDescription
newPooladdressThe address of the new vPool.
feeuint256The 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

NameTypeDescription
poolIduint256The id of the vPool.

integratorCommissionOwed

Returns the ETH value of integrator shares left to sell.

function integratorCommissionOwed(uint256 poolId) external view returns (uint256);

Parameters

NameTypeDescription
poolIduint256The id of the vPool.

Returns

NameTypeDescription
<none>uint256The ETH value of unsold integrator shares.

exitCommissionShares

Allows the integrator to exit the integrator shares of a vPool.

function exitCommissionShares(uint256 poolId) external;

Parameters

NameTypeDescription
poolIduint256The id of the vPool.

pauseDeposits

Allows the integrator to pause and unpause deposits only.

function pauseDeposits(bool isPaused) external;

Parameters

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

NameTypeDescription
vPooladdressAddress of the vPool sending the shares
poolIduint256Id of the pool in the integrations contract
amountuint256The amount of vPool shares received

PoolActivation

Emitted when a vPool in enabled or disabled

event PoolActivation(address poolAddress, uint256 id, bool isActive);

Parameters

NameTypeDescription
poolAddressaddressThe new pool address
iduint256Id of the pool
isActiveboolwhether 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

NameTypeDescription
poolAddressaddressThe new pool address
iduint256Id of the pool

SetFee

Emitted when the integrator fee is changed

event SetFee(uint256 poolId, uint256 operatorFeeBps);

Parameters

NameTypeDescription
poolIduint256Id of the pool
operatorFeeBpsuint256The new fee in basis points

SetName

Emitted when the display name is changed

event SetName(string name);

Parameters

NameTypeDescription
namestringThe new name

SetSymbol

Emitted when the display symbol is changed

event SetSymbol(string symbol);

Parameters

NameTypeDescription
symbolstringThe new display symbol

SetMaxCommission

Emitted when the max commission is set

event SetMaxCommission(uint256 maxCommission);

Parameters

NameTypeDescription
maxCommissionuint256The new max commission

SetDepositsPaused

Emitted when the deposits are paused or unpaused

event SetDepositsPaused(bool isPaused);

Parameters

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

NameTypeDescription
stakeraddressThe address staking
depositedEthuint128The amount of ETH staked
mintedTokensuint128The amount of integrator shares minted
stakeDetailsPoolStakeDetails[]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

NameTypeDescription
stakeraddressThe address exiting
exitedTokensuint128The amount of integrator shares exited
exitDetailsPoolExitDetails[]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

NameTypeDescription
poolIduint256Id of the pool
sharesuint256Amount of pool shares exited
weightsuint256[]Array of weights for each recipient
recipientsaddress[]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

NameTypeDescription
sumuint256Sum of amounts in the list
msgValueuint256Amount 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

NameTypeDescription
ethLeftuint256The ETH value of shares left to sell
iduint256Id of the pool

PoolAlreadyRegistered

Thrown when trying to add a Pool that is already registered in the contract

error PoolAlreadyRegistered(address newPool);

Parameters

NameTypeDescription
newPooladdressThe pool address

PoolDisabled

Thrown when trying to deposit to a disabled pool

error PoolDisabled(uint256 poolId);

Parameters

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

NameTypeDescription
poolAddressaddressThe pool address

PoolTransferFailed

Emitted when a pool transfer does not return true.

error PoolTransferFailed(uint256 id);

Parameters

NameTypeDescription
iduint256The id of the pool.

InvalidPoolId

Thrown when passing an invalid poolId

error InvalidPoolId(uint256 poolId);

Parameters

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