Reward Handler
Contract in charge of handling the initial bootstrap of CTX for the users that minted the TCAP Token.
Code
Address
Mainnet
Contract | Address |
---|---|
ETH RewardHandler | 0x5b577578565c2404bb84e734f583cf8523236ef1 |
DAI RewardHandler | 0xe0c99c503c4ae5ec50ac63c59c7ef4725c355fdd |
Rinkeby
Contract | Address |
---|---|
ETH RewardHandler | 0x9e6ad39935AA04f3e1801205D4a8Ee1d9bEeFF11 |
DAI RewardHandler | 0x2E0a511DD1d4aB8EB3F9c0441CfCcde19C9544F0 |
Public Variables
Address of the reward.
Address of the vault.
Tracks the period where users stop earning rewards.
Tracks the current reward rate.
How long the rewards lasts, it updates when more rewards are added.
Last time rewards were updated.
Amount of reward calculated per token stored.
Track the rewards paid to users.
Tracks the user rewards.
Private Variables
Tracks the total supply of the minted TCAPs.
Tracks the amount of TCAP minted per user.
Events
Events are called each time the state changes on the contract.
An event emitted when a reward is added.
An event emitted when TCAP is minted and staked to earn rewards
An event emitted when TCAP is burned and removed of stake.
An event emitted when reward is paid to a user.
An event emitted when the rewards duration is updated.
An event emitted when a erc20 token is recovered.
Modifiers
updateReward
Updates the reward and time on call.
onlyVault
Reverts if the caller is not a vault.
Read-Only Functions
totalSupply
Returns the total amount of TCAP tokens minted and getting reward on this vault.
balanceOf
Returns the amount of TCAP tokens minted and getting reward from specific user.
getRewardForDuration
Returns the Reward rate multiplied by the rewards duration time.
lastTimeRewardApplicable
Returns the minimun between current block timestamp or the finish period of rewards.
rewardPerToken
Returns the calculated reward per token deposited.
earned
Returns the amount of reward tokens a _account
has earned.
min
Returns the minimun between two variables.
State-Changing Functions
constructor
Called once the contract it's deployed, sets the orchestrator as owner.
stake
Called when TCAP is minted, adds the minted value as stake. Only vault can call it. Updates reward on call.
exit
Removes all stake and transfers all rewards to the staker. Only vault can call it.
notifyRewardAmount
Notifies the contract that reward has been added to be given. Only owner can call it. Increases duration of rewards.
recoverERC20
Added to support recovering LP Rewards from other systems such as BAL to be distributed to holders.
setRewardsDuration
Updates the reward duration. Only owner can call it. Previous rewards must be complete.
withdraw
Called when TCAP is burned or liquidated, removes the burned value as stake. Only vault can call it. Updates rewards on call.
getRewardFromVault
Called when TCAP is burned or liquidated, transfers to the staker the current amount of rewards tokens earned. Only vault can call it. Updates rewards on call.
getReward
Transfers to the caller the current amount of rewards tokens earned. Updates rewards on call.