RewardControl.sol

View Source: contracts/RewardControl.sol

↗ Extends: RewardControlStorage, RewardControlInterface, ExponentialNoError

Events

event AlkSpeedUpdated(address indexed market, uint256  newSpeed, bool  isVerified);
event DistributedSupplierAlk(address indexed market, address indexed supplier, uint256  supplierDelta, uint256  supplierAccruedAlk, uint256  supplyIndexMantissa, bool  isVerified);
event DistributedBorrowerAlk(address indexed market, address indexed borrower, uint256  borrowerDelta, uint256  borrowerAccruedAlk, uint256  borrowIndexMantissa, bool  isVerified);
event TransferredAlk(address indexed participant, uint256  participantAccrued, address  market, bool  isVerified);
event OwnerUpdate(address indexed owner, address indexed newOwner);
event MarketAdded(address indexed market, uint256  numberOfMarkets, bool  isVerified);
event MarketRemoved(address indexed market, uint256  numberOfMarkets, bool  isVerified);

Modifiers

  • onlyOwner

onlyOwner

Make sure that the sender is only the owner of the contract

modifier onlyOwner() internal

Arguments

Functions

  • initializer(address _owner, address _alkemiEarnVerified, address _alkemiEarnPublic, address _alkAddress)

  • refreshAlkSupplyIndex(address market, address supplier, bool isVerified)

  • refreshAlkBorrowIndex(address market, address borrower, bool isVerified)

  • claimAlk(address holder)

  • claimAlk(address holder, address market, bool isVerified)

  • refreshMarketLiquidity()

  • refreshAlkSpeeds()

  • updateAlkSupplyIndex(address market, bool isVerified)

  • updateAlkBorrowIndex(address market, bool isVerified)

  • distributeSupplierAlk(address market, address supplier, bool isVerified)

  • distributeBorrowerAlk(address market, address borrower, bool isVerified)

  • claimAlk(address holder, address[] markets, bool isVerified)

  • transferAlk(address participant, uint256 participantAccrued, address market, bool isVerified)

  • getBlockNumber()

  • getAlkAccrued(address participant)

  • getAlkAddress()

  • getAlkemiEarnAddress()

  • getMarketStats(address market, bool isVerified)

  • getMarketTotalSupply(address market, bool isVerified)

  • getMarketTotalBorrows(address market, bool isVerified)

  • getSupplyBalance(address market, address supplier, bool isVerified)

  • getBorrowBalance(address market, address borrower, bool isVerified)

  • transferOwnership(address _newOwner)

  • acceptOwnership()

  • addMarket(address market, bool isVerified)

  • removeMarket(uint256 id, bool isVerified)

  • setAlkAddress(address _alkAddress)

  • setAlkemiEarnVerifiedAddress(address _alkemiEarnVerified)

  • setAlkemiEarnPublicAddress(address _alkemiEarnPublic)

  • setAlkRate(uint256 _alkRate)

  • getAlkRewards(address user)

  • getSupplyAlkRewards(struct ExponentialNoError.Exp totalLiquidity, struct ExponentialNoError.Exp[] marketTotalLiquidity, address user, uint256 i, uint256 j, bool isVerified)

  • getBorrowAlkRewards(struct ExponentialNoError.Exp totalLiquidity, struct ExponentialNoError.Exp[] marketTotalLiquidity, address user, uint256 i, uint256 j, bool isVerified)

initializer

RewardControl is the contract to calculate and distribute reward tokens

function initializer(address _owner, address _alkemiEarnVerified, address _alkemiEarnPublic, address _alkAddress) public nonpayable

Arguments

refreshAlkSupplyIndex

⤾ overrides RewardControlInterface.refreshAlkSupplyIndex

Refresh ALK supply index for the specified market and supplier

function refreshAlkSupplyIndex(address market, address supplier, bool isVerified) external nonpayable

Arguments

refreshAlkBorrowIndex

⤾ overrides RewardControlInterface.refreshAlkBorrowIndex

Refresh ALK borrow index for the specified market and borrower

function refreshAlkBorrowIndex(address market, address borrower, bool isVerified) external nonpayable

Arguments

claimAlk

⤾ overrides RewardControlInterface.claimAlk

Claim all the ALK accrued by holder in all markets

function claimAlk(address holder) external nonpayable

Arguments

claimAlk

⤾ 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, bool isVerified) external nonpayable

Arguments

refreshMarketLiquidity

Recalculate and update ALK speeds for all markets

function refreshMarketLiquidity() internal view
returns(struct ExponentialNoError.Exp[], struct ExponentialNoError.Exp)

Arguments

refreshAlkSpeeds

Recalculate and update ALK speeds for all markets

function refreshAlkSpeeds() public nonpayable

Arguments

updateAlkSupplyIndex

Accrue ALK to the market by updating the supply index

function updateAlkSupplyIndex(address market, bool isVerified) public nonpayable

Arguments

updateAlkBorrowIndex

Accrue ALK to the market by updating the borrow index

function updateAlkBorrowIndex(address market, bool isVerified) public nonpayable

Arguments

distributeSupplierAlk

Calculate ALK accrued by a supplier and add it on top of alkAccrued[supplier]

function distributeSupplierAlk(address market, address supplier, bool isVerified) public nonpayable

Arguments

distributeBorrowerAlk

Calculate ALK accrued by a borrower and add it on top of alkAccrued[borrower]

function distributeBorrowerAlk(address market, address borrower, bool isVerified) public nonpayable

Arguments

claimAlk

Claim all the ALK accrued by holder in the specified markets

function claimAlk(address holder, address[] markets, bool isVerified) internal nonpayable

Arguments

transferAlk

Transfer ALK to the participant

function transferAlk(address participant, uint256 participantAccrued, address market, bool isVerified) internal nonpayable
returns(uint256)

Returns

The amount of ALK which was NOT transferred to the participant

Arguments

getBlockNumber

Get the current block number

function getBlockNumber() public view
returns(uint256)

Returns

The current block number

Arguments

getAlkAccrued

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

getAlkAddress

Get the address of the ALK token

function getAlkAddress() public view
returns(address)

Returns

The address of ALK token

Arguments

getAlkemiEarnAddress

Get the address of the underlying AlkemiEarnVerified and AlkemiEarnPublic contract

function getAlkemiEarnAddress() public view
returns(address, address)

Returns

The address of the underlying AlkemiEarnVerified and AlkemiEarnPublic contract

Arguments

getMarketStats

Get market statistics from the AlkemiEarnVerified contract

function getMarketStats(address market, bool isVerified) 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

getMarketTotalSupply

Get market total supply from the AlkemiEarnVerified / AlkemiEarnPublic contract

function getMarketTotalSupply(address market, bool isVerified) public view
returns(uint256)

Returns

Market total supply for the given market

Arguments

getMarketTotalBorrows

Get market total borrows from the AlkemiEarnVerified contract

function getMarketTotalBorrows(address market, bool isVerified) public view
returns(uint256)

Returns

Market total borrows for the given market

Arguments

getSupplyBalance

Get supply balance of the specified market and supplier

function getSupplyBalance(address market, address supplier, bool isVerified) public view
returns(uint256)

Returns

Supply balance of the specified market and supplier

Arguments

getBorrowBalance

Get borrow balance of the specified market and borrower

function getBorrowBalance(address market, address borrower, bool isVerified) public view
returns(uint256)

Returns

Borrow balance of the specified market and borrower

Arguments

transferOwnership

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

acceptOwnership

Accept the ownership of this contract by the new owner

function acceptOwnership() external nonpayable

Arguments

addMarket

Add new market to the reward program

function addMarket(address market, bool isVerified) external nonpayable onlyOwner

Arguments

removeMarket

Remove a market from the reward program based on array index

function removeMarket(uint256 id, bool isVerified) external nonpayable onlyOwner

Arguments

setAlkAddress

Set ALK token address

function setAlkAddress(address _alkAddress) external nonpayable onlyOwner

Arguments

setAlkemiEarnVerifiedAddress

Set AlkemiEarnVerified contract address

function setAlkemiEarnVerifiedAddress(address _alkemiEarnVerified) external nonpayable onlyOwner

Arguments

setAlkemiEarnPublicAddress

Set AlkemiEarnPublic contract address

function setAlkemiEarnPublicAddress(address _alkemiEarnPublic) external nonpayable onlyOwner

Arguments

setAlkRate

Set ALK rate

function setAlkRate(uint256 _alkRate) external nonpayable onlyOwner

Arguments

getAlkRewards

Get latest ALK rewards

function getAlkRewards(address user) external view
returns(uint256)

Arguments

getSupplyAlkRewards

Get latest Supply ALK rewards

function getSupplyAlkRewards(struct ExponentialNoError.Exp totalLiquidity, struct ExponentialNoError.Exp[] marketTotalLiquidity, address user, uint256 i, uint256 j, bool isVerified) internal view
returns(uint256)

Arguments

getBorrowAlkRewards

Get latest Borrow ALK rewards

function getBorrowAlkRewards(struct ExponentialNoError.Exp totalLiquidity, struct ExponentialNoError.Exp[] marketTotalLiquidity, address user, uint256 i, uint256 j, bool isVerified) internal view
returns(uint256)

Arguments

Last updated