layout | title |
---|---|
default |
RewardControl |
View Source: contracts/RewardControl.sol
↗ Extends: RewardControlStorage, RewardControlInterface, ExponentialNoError
{{ContractName}}
Events
event AlkSpeedUpdated(address indexed market, uint256 newSpeed);
event DistributedSupplierAlk(address indexed market, address indexed supplier, uint256 supplierDelta, uint256 supplierAccruedAlk, uint256 supplyIndexMantissa);
event DistributedBorrowerAlk(address indexed market, address indexed borrower, uint256 borrowerDelta, uint256 borrowerAccruedAlk, uint256 borrowIndexMantissa);
event TransferredAlk(address indexed participant, uint256 participantAccrued);
event OwnerUpdate(address indexed owner, address indexed newOwner);
event MarketAdded(address indexed market, uint256 numberOfMarkets);
event MarketRemoved(address indexed market, uint256 numberOfMarkets);
Make sure that the sender is only the owner of the contract
modifier onlyOwner() internal
Arguments
Name | Type | Description |
---|
- initializer(address _owner, address _alkemiEarnVerified, address _alkAddress)
- refreshAlkSupplyIndex(address market, address supplier)
- refreshAlkBorrowIndex(address market, address borrower)
- claimAlk(address holder)
- claimAlk(address holder, address market)
- refreshAlkSpeeds()
- updateAlkSupplyIndex(address market)
- updateAlkBorrowIndex(address market)
- distributeSupplierAlk(address market, address supplier)
- distributeBorrowerAlk(address market, address borrower)
- claimAlk(address holder, address[] markets)
- transferAlk(address participant, uint256 participantAccrued)
- getBlockNumber()
- getAlkAccrued(address participant)
- getAlkAddress()
- getAlkemiEarnVerifiedAddress()
- getMarketStats(address market)
- getMarketTotalSupply(address market)
- getMarketTotalBorrows(address market)
- getSupplyBalance(address market, address supplier)
- getBorrowBalance(address market, address borrower)
- transferOwnership(address _newOwner)
- acceptOwnership()
- addMarket(address market)
- removeMarket(uint256 id)
- setAlkAddress(address _alkAddress)
- setAlkemiEarnVerifiedAddress(address _alkemiEarnVerified)
- setAlkRate(uint256 _alkRate)
RewardControl
is the contract to calculate and distribute reward tokens
function initializer(address _owner, address _alkemiEarnVerified, address _alkAddress) public nonpayable
Arguments
Name | Type | Description |
---|---|---|
_owner | address | |
_alkemiEarnVerified | address | |
_alkAddress | address |
⤾ overrides RewardControlInterface.refreshAlkSupplyIndex
Refresh ALK supply index for the specified market and supplier
function refreshAlkSupplyIndex(address market, address supplier) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
market | address | The market whose supply index to update |
supplier | address | The address of the supplier to distribute ALK to |
⤾ overrides RewardControlInterface.refreshAlkBorrowIndex
Refresh ALK borrow index for the specified market and borrower
function refreshAlkBorrowIndex(address market, address borrower) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
market | address | The market whose borrow index to update |
borrower | address | The address of the borrower to distribute ALK to |
⤾ overrides RewardControlInterface.claimAlk
Claim all the ALK accrued by holder in all markets
function claimAlk(address holder) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
holder | address | The address to claim ALK for |
⤾ overrides RewardControlInterface.claimAlk
Claim all the ALK accrued by holder by refreshing the indexes on the specified market only
function claimAlk(address holder, address market) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
holder | address | The address to claim ALK for |
market | address | The address of the market to refresh the indexes for |
Recalculate and update ALK speeds for all markets
function refreshAlkSpeeds() internal nonpayable
Arguments
Name | Type | Description |
---|
Accrue ALK to the market by updating the supply index
function updateAlkSupplyIndex(address market) internal nonpayable
Arguments
Name | Type | Description |
---|---|---|
market | address | The market whose supply index to update |
Accrue ALK to the market by updating the borrow index
function updateAlkBorrowIndex(address market) internal nonpayable
Arguments
Name | Type | Description |
---|---|---|
market | address | The market whose borrow index to update |
Calculate ALK accrued by a supplier and add it on top of alkAccrued[supplier]
function distributeSupplierAlk(address market, address supplier) internal nonpayable
Arguments
Name | Type | Description |
---|---|---|
market | address | The market in which the supplier is interacting |
supplier | address | The address of the supplier to distribute ALK to |
Calculate ALK accrued by a borrower and add it on top of alkAccrued[borrower]
function distributeBorrowerAlk(address market, address borrower) internal nonpayable
Arguments
Name | Type | Description |
---|---|---|
market | address | The market in which the borrower is interacting |
borrower | address | The address of the borrower to distribute ALK to |
Claim all the ALK accrued by holder in the specified markets
function claimAlk(address holder, address[] markets) internal nonpayable
Arguments
Name | Type | Description |
---|---|---|
holder | address | The address to claim ALK for |
markets | address[] | The list of markets to claim ALK in |
Transfer ALK to the participant
function transferAlk(address participant, uint256 participantAccrued) internal nonpayable
returns(uint256)
Returns
The amount of ALK which was NOT transferred to the participant
Arguments
Name | Type | Description |
---|---|---|
participant | address | The address of the participant to transfer ALK to |
participantAccrued | uint256 | The amount of ALK to (possibly) transfer |
Get the current block number
function getBlockNumber() public view
returns(uint256)
Returns
The current block number
Arguments
Name | Type | Description |
---|
Get the current accrued ALK for a participant
function getAlkAccrued(address participant) public view
returns(uint256)
Returns
The amount of accrued ALK for the participant
Arguments
Name | Type | Description |
---|---|---|
participant | address | The address of the participant |
Get the address of the ALK token
function getAlkAddress() public view
returns(address)
Returns
The address of ALK token
Arguments
Name | Type | Description |
---|
Get the address of the underlying AlkemiEarnVerified contract
function getAlkemiEarnVerifiedAddress() public view
returns(address)
Returns
The address of the underlying AlkemiEarnVerified contract
Arguments
Name | Type | Description |
---|
Get market statistics from the AlkemiEarnVerified contract
function getMarketStats(address market) public view
returns(isSupported bool, blockNumber uint256, interestRateModel address, totalSupply uint256, supplyRateMantissa uint256, supplyIndex uint256, totalBorrows uint256, borrowRateMantissa uint256, borrowIndex uint256)
Returns
Market statistics for the given market
Arguments
Name | Type | Description |
---|---|---|
market | address | The address of the market |
Get market total supply from the AlkemiEarnVerified contract
function getMarketTotalSupply(address market) public view
returns(uint256)
Returns
Market total supply for the given market
Arguments
Name | Type | Description |
---|---|---|
market | address | The address of the market |
Get market total borrows from the AlkemiEarnVerified contract
function getMarketTotalBorrows(address market) public view
returns(uint256)
Returns
Market total borrows for the given market
Arguments
Name | Type | Description |
---|---|---|
market | address | The address of the market |
Get supply balance of the specified market and supplier
function getSupplyBalance(address market, address supplier) public view
returns(uint256)
Returns
Supply balance of the specified market and supplier
Arguments
Name | Type | Description |
---|---|---|
market | address | The address of the market |
supplier | address | The address of the supplier |
Get borrow balance of the specified market and borrower
function getBorrowBalance(address market, address borrower) public view
returns(uint256)
Returns
Borrow balance of the specified market and borrower
Arguments
Name | Type | Description |
---|---|---|
market | address | The address of the market |
borrower | address | The address of the borrower |
Transfer the ownership of this contract to the new owner. The ownership will not be transferred until the new owner accept it.
function transferOwnership(address _newOwner) external nonpayable onlyOwner
Arguments
Name | Type | Description |
---|---|---|
_newOwner | address | The address of the new owner |
Accept the ownership of this contract by the new owner
function acceptOwnership() external nonpayable
Arguments
Name | Type | Description |
---|
Add new market to the reward program
function addMarket(address market) external nonpayable onlyOwner
Arguments
Name | Type | Description |
---|---|---|
market | address | The address of the new market to be added to the reward program |
Remove a market from the reward program based on array index
function removeMarket(uint256 id) external nonpayable onlyOwner
Arguments
Name | Type | Description |
---|---|---|
id | uint256 | The index of the allMarkets array to be removed |
Set ALK token address
function setAlkAddress(address _alkAddress) external nonpayable onlyOwner
Arguments
Name | Type | Description |
---|---|---|
_alkAddress | address | The ALK token address |
Set AlkemiEarnVerified contract address
function setAlkemiEarnVerifiedAddress(address _alkemiEarnVerified) external nonpayable onlyOwner
Arguments
Name | Type | Description |
---|---|---|
_alkemiEarnVerified | address | The AlkemiEarnVerified contract address |
Set ALK rate
function setAlkRate(uint256 _alkRate) external nonpayable onlyOwner
Arguments
Name | Type | Description |
---|---|---|
_alkRate | uint256 | The ALK rate |