BuildersTreasuryV2
Overview
The BuildersTreasuryV2 contract serves as a dedicated storage vault and distribution mechanism for builder rewards in the protocol. It is tightly integrated with the BuildersV4 contract and acts as the reward source when the Subnet admin or claim admin claim their share of MOR tokens.
The treasury holds the reward token (MOR) and is the only contract authorized to send out rewards. It tracks the total distributed rewards (claimed amount).
To function correctly, the protocol administrator (owner) must ensure that this contract is regularly and sufficiently funded.
Key Features
Reward source: acts as the source of truth and distribution for builder rewards in the protocol.
Access controlled: only the
BuildersV4contract can trigger reward transfers.Reward accounting: tracks the total amount of rewards that have been distributed.
Protocol-funded: must be funded by Morpheus protocol operators on L1 (e.g., Ethereum) to ensure proper cross-chain reward payments.
Storage
rewardToken
Holds the address of the MOR token used as the reward currency.
address public rewardToken;builders
Stores the address of the authorized BuildersV4 contract that can distribute rewards.
distributedRewards
Tracks the total amount of rewards that have been distributed through this treasury.
Functions for the contract owner
BuildersTreasuryV2_init
Initializes the treasury contract with the reward token and BuildersV2 contract.
rewardToken_
Address of the MOR token used for rewards
setBuilders
Updates the address of the BuildersV4 contract.
builders_
Address of the new BuildersV4 contract to authorize
withdraw
The function to withdraw rewardToken from the contract.
receiver_
Address of the user receiving the rewards
amount_
Amount of tokens to transfer. Wei.
Functions for the BuildersV4 contract
sendRewards
Transfers reward tokens to a specified receiver. Callable only by the Builders contract.
receiver_
Address of the user receiving the rewards
amount_
Amount of tokens to transfer. Wei.
Read functions
supportsInterface
Used for interface detection (ERC165). Returns true if the contract supports a specific interfaceId_. Supports IBuildersTreasuryV2, IERC165.
version
Returns the current version of the contract.
Last updated
Was this helpful?