Prime liquidity provider
PrimeLiquidityProvider
PrimeLiquidityProvider is used to fund Prime
Solidity API
DEFAULT_MAX_DISTRIBUTION_SPEED
The default max token distribution speed
uint256 DEFAULT_MAX_DISTRIBUTION_SPEED
prime
Address of the Prime contract
address prime
tokenDistributionSpeeds
The rate at which token is distributed (per block)
mapping(address => uint256) tokenDistributionSpeeds
maxTokenDistributionSpeeds
The max token distribution speed for token
mapping(address => uint256) maxTokenDistributionSpeeds
lastAccruedBlock
The rate at which token is distributed to the Prime contract
mapping(address => uint256) lastAccruedBlock
tokenAmountAccrued
The token accrued but not yet transferred to prime contract
mapping(address => uint256) tokenAmountAccrued
initialize
PrimeLiquidityProvider initializer
function initialize(address accessControlManager_, address[] tokens_, uint256[] distributionSpeeds_, uint256[] maxDistributionSpeeds_, uint256 loopsLimit_) external
Parameters
accessControlManager_
address
AccessControlManager contract address
tokens_
address[]
Array of addresses of the tokens
distributionSpeeds_
uint256[]
New distribution speeds for tokens
maxDistributionSpeeds_
uint256[]
loopsLimit_
uint256
Maximum number of loops allowed in a single transaction
❌ Errors
Throw InvalidArguments on different length of tokens and speeds array
initializeTokens
Initialize the distribution of the token
function initializeTokens(address[] tokens_) external
Parameters
tokens_
address[]
Array of addresses of the tokens to be intialized
⛔️ Access Requirements
Only Governance
pauseFundsTransfer
Pause fund transfer of tokens to Prime contract
function pauseFundsTransfer() external
⛔️ Access Requirements
Controlled by ACM
resumeFundsTransfer
Resume fund transfer of tokens to Prime contract
function resumeFundsTransfer() external
⛔️ Access Requirements
Controlled by ACM
setTokensDistributionSpeed
Set distribution speed (amount of token distribute per block)
function setTokensDistributionSpeed(address[] tokens_, uint256[] distributionSpeeds_) external
Parameters
tokens_
address[]
Array of addresses of the tokens
distributionSpeeds_
uint256[]
New distribution speeds for tokens
⛔️ Access Requirements
Controlled by ACM
❌ Errors
Throw InvalidArguments on different length of tokens and speeds array
setMaxTokensDistributionSpeed
Set max distribution speed for token (amount of maximum token distribute per block)
function setMaxTokensDistributionSpeed(address[] tokens_, uint256[] maxDistributionSpeeds_) external
Parameters
tokens_
address[]
Array of addresses of the tokens
maxDistributionSpeeds_
uint256[]
New distribution speeds for tokens
⛔️ Access Requirements
Controlled by ACM
❌ Errors
Throw InvalidArguments on different length of tokens and speeds array
setPrimeToken
Set the prime token contract address
function setPrimeToken(address prime_) external
Parameters
prime_
address
The new address of the prime token contract
📅 Events
Emits PrimeTokenUpdated event
⛔️ Access Requirements
Only owner
setMaxLoopsLimit
Set the limit for the loops can iterate to avoid the DOS
function setMaxLoopsLimit(uint256 loopsLimit) external
Parameters
loopsLimit
uint256
Limit for the max loops can execute at a time
📅 Events
Emits MaxLoopsLimitUpdated event on success
⛔️ Access Requirements
Controlled by ACM
releaseFunds
Claim all the token accrued till last block
function releaseFunds(address token_) external
Parameters
token_
address
The token to release to the Prime contract
📅 Events
Emits TokenTransferredToPrime event
❌ Errors
Throw InvalidArguments on Zero address(token)
Throw FundsTransferIsPaused is paused
Throw InvalidCaller if the sender is not the Prime contract
sweepToken
A public function to sweep accidental ERC-20 transfers to this contract. Tokens are sent to user
function sweepToken(contract IERC20Upgradeable token_, address to_, uint256 amount_) external
Parameters
token_
contract IERC20Upgradeable
The address of the ERC-20 token to sweep
to_
address
The address of the recipient
amount_
uint256
The amount of tokens needs to transfer
📅 Events
Emits SweepToken event
⛔️ Access Requirements
Only Governance
❌ Errors
Throw InsufficientBalance if amount_ is greater than the available balance of the token in the contract
getEffectiveDistributionSpeed
Get rewards per block for token
function getEffectiveDistributionSpeed(address token_) external view returns (uint256)
Parameters
token_
address
Address of the token
Return Values
[0]
uint256
speed returns the per block reward
accrueTokens
Accrue token by updating the distribution state
function accrueTokens(address token_) public
Parameters
token_
address
Address of the token
📅 Events
Emits TokensAccrued event
getBlockNumber
Get the latest block number
function getBlockNumber() public view virtual returns (uint256)
Return Values
[0]
uint256
blockNumber returns the block number
Last updated