Rewards¶
Depositors (lenders) and borrowers in Crayon Protocol are rewarded with the XCRAY token. Accumulated rewards can be claimed from the Crayon Protocol Control contract.
The following functions in the Control smart contract support the reward token, including minting activities.
- mint_all_reward_token(_user: address)¶
Credit
_userwith all the reward tokens accumulated by_useron all the desks minus a percentage specified by the_user’s front-end, or other integration, provider._user: The address whose rewards are being claimed
- mint_reward_token(_user: address, _desks: DynArray[address, 20])¶
Credit
_userwith the reward tokens accumulated by_useron_desks._user: The address whose rewards are being claimed_desks: Desks on which_useraccumulated rewards
- get_reward_parameters(_desk: address)¶
Return the amount of reward tokens distributed to borrowers and depositors per block. Returns a tuple with borrower and lender rate as first and second component, respectively. This is a
viewfunction._desk: The desk whose reward parameters are sought
- reward_balanceOf(_user: address, _desks: DynArray[address, 20]) uint256¶
Return the balance of rewards
_useraccumulated on_desksas of the last update of the cumulative rewards on those desks. This function is aviewfunction._user: The user whose reward balance is sought_desks: The desks where rewards are to be checked
Note
reward_balanceOf returns the balance as of the last call to update_cumul_rewards on the desk. The user can force an up-to-date balance by first calling update_cumul_rewards on the desks the user has chosen.
Note
mint_reward_token and mint_all_reward_token mint the most up-to-date reward token balance. Indeed they internally call update_cumul_rewards on the desks the user chose.
- update_cumul_rewards()¶
Force an update of the reward indices of a desk.
Note
Unlike the other functions on this page, update_cumul_rewards is a method on the Desk smart contract not the Control smart contract.