Chef
This is the contract used for staking ASTRADAO/iToken. It includes the primary functionalities like staking score, reward multiplier, reward distribution for Astra DAO and iToken holders, and others.
Methods
function initialize( address, uint256, uint256, uint256)
This function is basically used to initialize Astra DAO contract address, owner/dev address, ASTRADAO per block to be rewarded, start reward block, end reward block, for the chef contract.
Parameters:
address _astr:
Astra DAO contract address
uint256 _ASTRPerBlock:
ASTR rewards per block
uint256 _startBlock:
start block number for starting rewards distribution
uint256 _bonusEndBlock:
end block number for ending reward distribution
function add(IERC20)
This function is basically used to add the pool for ASTRADAO/iToken on the chef contract. this function is only be called by the owner of the chef contract.
Parameters:
IERC20
_lpToken:
iToken or Astra DAO contract address
function addVault(uint256)
This function is basically used to add the vault value for ASTRADAO/iToken on the chef contract. this function is only be called by the owner of the chef contract.
Parameters:
uint256 val:
value of month like 0, 3, 6, 9, 12
function getRewardMultiplier(uint256, address)
This function is used for calculating the reward multiplier of the user. Depending on users’ staking scores and whether they’ve decided to move Astra DAO tokens to one of the lockups vaults, users will get up to 2.5x higher rewards and voting power
Parameters:
uint256 _pid:
pool id
address _user:
user account address
function deposit(uint256, uint256, uint256)
This function is used to deposit/stake the amount by the user. On the chef contract, users can stake and lock their iToken and Astra DAO tokens.
Parameters:
_pid:
pool id
_amount:
amount to be deposited
vault:
vault months
function withdraw(uint256, bool)
This function is basically used to withdraw the staked/deposited amount and ASTRADAO reward from the chef contract. Users can choose the option for re-staking ASTRADAO reward or instant payout.
Parameters:
uint256 _pid
: pool id
bool _withStake
: withdraw the amount with or without the stake.
function viewEligibleAmount(uint256, address)
This function is used to view the eligible amount which needs to be withdrawn if the user deposits the amount in multiple vaults.
Parameters:
uint256 _pid:
pool id
address _user:
user address
function stakingScore(uint256, address)
This function is used to view the staking score of the user. The staking score is calculated using average holdings over the last 60 days. The idea of staking score is to recognize the value of a long-term holding even if held assets are small.
Parameters:
uint256 _pid:
pool id
address _userAddress:
user account address
function updateBlockReward(uint256, address)
This function is used to calculate the total block reward as defined ASTRADAO per block and the distribution will be calculated with the current user reward multiplier, total user multiplier, and total pool multiplier. After calling this function, users can update their reward.
Parameters:
uint256 _pid:
pool id
address _sender:
user address
function viewRewardInfo(uint256)
This function is used to view the total reward(including block reward) which user has earned on the Astra DAO platform.
Parameters:
uint256 _pid:
pool id
function withdrawASTRReward(uint256 _pid, bool _withStake)
This function is used to claim the ASTRADAO rewards. Users can claim the claimable ASTRADAO reward. There are two options for claiming the reward with or without staking the Astra DAO token. If the user wants to claim 100%, he needs to stake the Astra DAO token to the Astra DAO pool. Otherwise, a percentage of ASTRADAO would be deducted as a fee.
Parameters:
uint256 _pid:
pool id
bool
_withStake: with or without stake
function getTodayReward(uint256 _pid)
This function shows the amount of rewards the user has claimed to date.
Parameters:
uint256 _pid:
pool id
Last updated