Staking Precompile
This page is intended for developers looking to build smart contracts or interfaces that interact with the staking system.
The entrypoint to the staking system is the stateful staking precompile.
This precompile allows delegators and validators to take actions that affect the composition of the validator set.
- join the validator set (
addValidator
) - delegate their stake to a validator (
delegate
) - undelegate their stake from a validator (a multi-step process:
undelegate
, waitWITHDRAWAL_DELAY
epochs, thenwithdraw
) - compound the rewards they earned as a delegator (i.e. delegate the rewards)
(
compound
) - claim the rewards they earned as a delegator (
claimRewards
)
For ease of integration, please see the Solidity Interface and the ABI JSON.
Although users may delegate or undelegate at any time, stake weight changes only take effect at epoch boundaries, and stake weight changes made too close to the epoch boundary get queued until the next epoch boundary, as described in Staking Behavior. This is to allow for the separation of consensus and execution, one of Monad's core design attributes.
Only standard CALL
s are allowed to the staking precompile. In particular,
STATICCALL
and DELEGATECALL
are not allowed.
Because the staking system is a precompile and not a smart contract, you cannot test against it in a forked environment.
Precompile Address and Selectors
The contract address is 0x0000000000000000000000000000000000001000
.
The external functions are identified by the following 4-byte selectors.
External state-modifying methods:
addValidator(bytes,bytes,bytes)
-0xf145204c
delegate(uint64)
-0x84994fec
undelegate(uint64,uint256,uint8)
-0x5cf41514
withdraw(uint64,uint8)
-0xaed2ee73
compound(uint64)
-0xb34fea67
claimRewards(uint64)
-0xa76e2ca5
changeCommission(uint64,uint256)
-0x9bdcc3c8
externalReward(uint64)
-0xe4b3303b
External view methods:
getValidator(uint64)
-0x2b6d639a
getDelegator(uint64,address)
-0x573c1ce0
getWithdrawalRequest(uint64,address,uint8)
-0x56fa2045
getConsensusValidatorSet(uint32)
-0xfb29b729
getSnapshotValidatorSet(uint32)
-0xde66a368
getExecutionValidatorSet(uint32)
-0x7cb074df
getDelegations(address,uint64)
-0x4fd66050
getDelegators(uint64,address)
-0xa0843a26
getEpoch()
-0x757991a8
Syscalls:
syscallOnEpochChange(uint64)
-0x1d4e9f02
syscallReward(address)
-0x791bdcf3
syscallSnapshot()
-0x157eeb21