RewardsDistributor
Inherits: Ownable
Author: Morpho Labs.
This contract allows Morpho users to claim their rewards. This contract is largely inspired by Euler Distributor's contract: https://github.com/euler-xyz/euler-contracts/blob/master/contracts/mining/EulDistributor.sol.
State Variables
MORPHO
STORAGE ///
ERC20 public immutable MORPHO;
currRoot
bytes32 public currRoot;
prevRoot
bytes32 public prevRoot;
claimed
mapping(address => uint256) public claimed;
Functions
constructor
CONSTRUCTOR ///
Constructs Morpho's RewardsDistributor contract.
constructor(address _morpho);
Parameters
Name | Type | Description |
---|---|---|
_morpho | address | The address of the MORPHO token to distribute. |
updateRoot
EXTERNAL ///
Updates the current merkle tree's root.
function updateRoot(bytes32 _newRoot) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
_newRoot | bytes32 | The new merkle tree's root. |
withdrawMorphoTokens
Withdraws MORPHO tokens to a recipient.
function withdrawMorphoTokens(address _to, uint256 _amount) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
_to | address | The address of the recipient. |
_amount | uint256 | The amount of MORPHO tokens to transfer. |
claim
Claims rewards.
function claim(address _account, uint256 _claimable, bytes32[] calldata _proof) external;
Parameters
Name | Type | Description |
---|---|---|
_account | address | The address of the claimer. |
_claimable | uint256 | The overall claimable amount of token rewards. |
_proof | bytes32[] | The merkle proof that validates this claim. |
Events
RootUpdated
EVENTS ///
Emitted when the root is updated.
event RootUpdated(bytes32 newRoot);
MorphoWithdrawn
Emitted when MORPHO tokens are withdrawn.
event MorphoWithdrawn(address to, uint256 amount);
RewardsClaimed
Emitted when an account claims rewards.
event RewardsClaimed(address account, uint256 amount);
Errors
ProofInvalidOrExpired
ERRORS ///
Thrown when the proof is invalid or expired.
error ProofInvalidOrExpired();
AlreadyClaimed
Thrown when the claimer has already claimed the rewards.
error AlreadyClaimed();