Admin Functions
This section details the administrative functions available in the MNS contract, which are restricted to the current admin address. These functions facilitate the secure transfer of the admin role, the withdrawal of collected protocol fees, and the updating of core contract dependencies like the EVVM address.
Admin Role Transfer Process
The admin role is transferred using a secure, time-locked, two-step process to prevent immediate or malicious takeovers. This involves a proposal by the current admin and acceptance by the nominated successor after a mandatory waiting period.
proposeAdmin
Function Type: external
(onlyAdmin
)
Function Signature: proposeAdmin(address _proposedAdmin)
Initiates the admin role transfer process by nominating a new address as the proposed admin. This can only be called by the current admin.
Parameters
Parameter | Type | Description |
---|---|---|
_proposedAdmin | address | The address of the nominated new admin. |
rejectProposalAdmin
Function Type: external
(onlyAdmin
)
Function Signature: rejectProposalAdmin()
Allows the current admin to cancel a pending admin change proposal before it has been accepted, immediately revoking the nomination.
acceptNewAdmin
Function Type: external
Function Signature: acceptNewAdmin()
Allows the proposed admin to claim the admin role after the mandatory waiting period has passed. This function can only be successfully called by the _proposedAdmin
address.
Complete Workflow
- Proposal Initiation: The current admin calls
proposeAdmin(newAdminAddress)
to nominate a successor. A proposal timestamp is recorded, starting the clock on the waiting period. - Proposal Cancellation (Optional): At any point before the role is accepted, the current admin can call
rejectProposalAdmin
to nullify the pending proposal. - Role Acceptance: The proposed admin must wait for a mandatory period (e.g., 24 hours) to elapse after the proposal timestamp. After the waiting period is over, the proposed admin calls
acceptNewAdmin
. The function verifies that themsg.sender
is the proposed admin and that the waiting period has passed. Upon success, the admin role is transferred to the new address.
Fee Withdrawal Process
The withdrawal of collected protocol fees also follows a secure, time-locked, two-step proposal process to ensure transparency and prevent immediate fund drainage.
proposeWithdrawMateTokens
Function Type: external
(onlyAdmin
)
Function Signature: proposeWithdrawMateTokens(uint256 _amount)
Initiates the withdrawal process by proposing an amount of MATE tokens to be withdrawn from the contract's collected fees.
The _amount
can only be from the fees collected by the contract (e.g., from registrations, offers, etc.). It cannot include funds held in escrow for active offers. This mechanism ensures the contract always retains sufficient liquidity to fulfill its obligations.
Parameters
Parameter | Type | Description |
---|---|---|
_amount | uint256 | The amount of MATE tokens to be withdrawn. |
cancelWithdrawMateTokens
Function Type: external
(onlyAdmin
)
Function Signature: cancelWithdrawMateTokens()
Allows the current admin to cancel a pending fee withdrawal proposal before it has been claimed.
claimWithdrawMateTokens
Function Type: external
(onlyAdmin
)
Function Signature: claimWithdrawMateTokens()
Allows the admin to execute the proposed withdrawal of MATE tokens after the mandatory waiting period has passed.
Complete Workflow
- Proposal Initiation: The current admin calls
proposeWithdrawMateTokens(_amount)
. The function verifies that the proposed_amount
is less than or equal to the currently available balance of collected fees. A proposal timestamp is recorded, starting the clock on the waiting period. - Proposal Cancellation (Optional): At any point before the withdrawal is claimed, the current admin can call
cancelWithdrawMateTokens
to nullify the proposal. - Withdrawal Confirmation: The admin must wait for a mandatory period (e.g., 24 hours) to elapse after the proposal timestamp. After the waiting period is over, the admin calls
claimWithdrawMateTokens
. The function verifies that the waiting period has passed. Upon success, it transfers the proposed amount of MATE tokens to the admin's address, typically using an internal function likemakeCaPay
.
Change EVVM Contract Address Process
This two-step, time-locked process allows the admin to safely update the address of the core EVVM contract dependency, ensuring the MNS contract can adapt to future infrastructure changes.
proposeChangeEVVMContractAddress
Function Type: external
(onlyAdmin
)
Function Signature: proposeChangeEVVMContractAddress(address _newEVVMContractAddress)
Initiates the process to change the EVVM contract address by proposing a new address.
Parameters
Parameter | Type | Description |
---|---|---|
_newEVVMContractAddress | address | The address of the new EVVM contract to be set. |
cancelChangeEvvmAddress
Function Type: external
(onlyAdmin
)
Function Signature: cancelChangeEvvmAddress()
Allows the current admin to cancel a pending EVVM contract address change proposal before it has been finalized.
acceptChangeEvvmAddress
Function Type: external
(onlyAdmin
)
Function Signature: acceptChangeEvvmAddress()
Allows the current admin to finalize the change and set the new EVVM contract address after the mandatory waiting period has passed.
Complete Workflow
- Proposal Initiation: The current admin calls
proposeChangeEVVMContractAddress(newEVVMAddress)
to nominate a new EVVM contract address. A proposal timestamp is recorded, starting the clock on the waiting period. - Proposal Cancellation (Optional): At any point before the new address is accepted, the current admin can call
cancelChangeEvvmAddress
to nullify the pending proposal. - Address Acceptance: The current admin must wait for a mandatory period (e.g., 24 hours) to elapse after the proposal timestamp. After the waiting period is over, the admin calls
acceptChangeEvvmAddress
. The function verifies that themsg.sender
is the admin and that the waiting period has passed. Upon success, the EVVM contract address is updated to the new address.