Smart Contracts play a critical role in the Metis Layer 2 ecosystem, enabling secure and decentralized management of Sequencer operations and network activities. This section provides detailed natSpec (Ethereum Natural Specification Format) documentation for both Mainnet and Testnet contracts. By adhering to natSpec standards, we ensure clarity and transparency for developers and auditors alike.
The Smart Contract (natSpec) section is split into two key guides:
Mainnet Smart Contract (natSpec): Detailed documentation for contracts deployed on Ethereum Mainnet, covering production-grade operations and locking mechanisms for METIS tokens.
Testnet Smart Contract (natSpec): Documentation for contracts deployed on Sepolia Testnet, offering a sandbox environment for testing and experimentation.
All locking, reward distribution, and additional locking operations for Sequencers are executed on the Sepolia Testnet. These contracts are integral to managing the Sequencer lifecycle and ensuring smooth participation in the network.
Key Contracts
The following contracts are essential for Sequencer operations:
Contract
Address
LockingInfo
0x390A6fE63385522E87e248BC5200f7d3a02F994b
LockingPool
0x7591940125cC0344a65D60319d1ADcD463B2D4c3
Sequencers can perform all operations, including managing rewards and lock-ups, directly through these contracts without needing frontend access.
The following methods are provided to manage Sequencers efficiently. These include querying and updating your Sequencer's status, locking tokens, and handling rewards.
Read Contract Information
seqOwners
Retrieves all operational details of a Sequencer using the owner address.
Parameter:
seqId (uint256)
: Sequencer ID.
Response: Detailed Sequencer operational state.
seqSigners
Retrieves Sequencer information using the signer address.
Parameter:
seqId (uint256)
: Sequencer ID.
Response: Detailed Sequencer operational state.
sequencers
Accesses all relevant details of a Sequencer using its ID.
Parameter:
seqId (uint256)
: Sequencer ID.
Response:
Write Contract Information
lockFor
Locks METIS tokens and assigns Sequencer ownership.
Parameters:
_signer (address)
: Sequencer signer address.
_amount (uint256)
: Amount of METIS to lock.
_signerPubkey (bytes)
: Uncompressed public key of the signer.
lockWithRewardRecipient
Similar to lockFor
, but allows specifying a reward recipient at the outset.
Parameters:
_signer (address)
: Sequencer signer address.
_rewardRecipient (address)
: Reward recipient address.
_amount (uint256)
: Amount of METIS to lock.
_signerPubkey (bytes)
: Uncompressed public key.
relock
Adds additional tokens to an existing lock or locks accrued rewards.
Parameters:
_seqId (uint256)
: Sequencer ID.
_amount (uint256)
: Amount to relock.
_lockReward (bool)
: Whether to lock rewards.
setSequencerRewardRecipient
Updates or assigns a reward recipient for a Sequencer.
Parameters:
_seqId (uint256)
: Sequencer ID.
_recipient (address)
: New reward recipient address.
withdrawRewards
Withdraws accrued rewards to the specified address.
Parameters:
_seqId (uint256)
: Sequencer ID.
_l2Gas (uint32)
: Gas limit for the operation.
unlock
Initiates the unlocking process for METIS tokens.
Parameters:
_seqId (uint256)
: Sequencer ID.
_l2Gas (uint32)
: Gas limit for the bridge operation.
unlockClaim
Claims unlocked tokens after the 21-day waiting period.
Parameters:
_seqId (uint256)
: Sequencer ID.
_l2Gas (uint32)
: Gas limit.
withdraw
Partially withdraws locked tokens, ensuring the remaining balance meets the minimum lock requirement.
Parameters:
_amount (uint256)
: Amount to withdraw.
_seqId (uint256)
: Sequencer ID.
All activities related to locking, rewards, and additional locking operations for Sequencers are executed on the Ethereum L1 mainnet (chainid: 1). These smart contracts form the backbone of Sequencer lifecycle management, enabling seamless integration into the Metis ecosystem.
The following contracts are critical for Sequencer operations:
Contract
Address
LockingInfo
0x0fe382b74c3894b65c10e5c12ae60bbd8faf5b48
LockingPool
0xd54c868362c2098e0e46f12e7d924c6a332952dd
Sequencers can interact directly with these contracts to manage rewards, lock-ups, and related activities without requiring frontend tools.
Review Technical Documentation Thoroughly review all technical documentation to understand the operational and technical requirements for running a Sequencer.
Apply for Whitelist Submit an application to join the Sequencer whitelist, which is required to begin operations.
Set Up and Run Your Sequencer Deploy your Sequencer node, configure it correctly, and securely back up your private keys. Detailed setup instructions are available in the README.md file.
Submit Sequencer Information Provide your Sequencer details via a pull request to the GitHub repository. This should include:
name: Your Sequencer's name.
avatar: URL for your Sequencer's logo or avatar.
url: Website or social profile link (must start with https://
).
address: Whitelist address for Sequencer lock-up.
seq_addr: Sequencer address generated by the node.
pubkey: Uncompressed public key generated by your server (ensure to remove any extra 04
characters).
desc: A brief description of your organization or individual setup.
Approve Locking Tokens
Approve the desired amount of METIS tokens to be locked using the LockingInfo
contract as the spender.
Lock METIS Tokens
Use the LockPool contract to lock METIS tokens by calling either the lockFor
or lockWithRewardRecipient
method, depending on whether you are assigning a reward recipient.
Check Sequencer Status
Use the sequencers
method in the LockingPool contract to verify your Sequencer's status and rewards.
Claim Mining Rewards
Retrieve accrued mining rewards using the withdrawRewards
method. If you have not assigned a reward recipient, use the setSequencerRewardRecipient
method to configure one before claiming rewards.
The LockingPool contract provides key methods to efficiently manage Sequencer operations, including querying status, locking tokens, and handling rewards.
Reading Contract Information
seqOwners
Retrieves comprehensive Sequencer status using the owner's address.
Parameter: seqId (uint256)
- The Sequencer ID.
Response: Returns details of the Sequencer's operational state.
seqSigners
Retrieves Sequencer information using the signer's address.
Parameter: seqId (uint256)
- The Sequencer ID.
Response: Returns details of the Sequencer's operational state.
sequencers
Accesses all detailed information about a Sequencer using its ID.
Parameter: seqId (uint256)
- The Sequencer ID.
Response:
Writing Contract Information
lockFor
Locks METIS tokens and assigns Sequencer ownership.
Parameters:
_signer (address)
: Sequencer signer address.
_amount (uint256)
: Amount of METIS tokens to lock.
_signerPubkey (bytes)
: Uncompressed public key of the signer.
lockWithRewardRecipient
Similar to lockFor
, but includes an additional parameter to specify a reward recipient.
Parameters:
_signer (address)
: Sequencer signer address.
_rewardRecipient (address)
: Reward recipient address.
_amount (uint256)
: Amount of METIS tokens to lock.
_signerPubkey (bytes)
: Uncompressed public key.
relock
Adds more tokens to an existing lock or locks accrued rewards.
Parameters:
_seqId (uint256)
: Sequencer ID.
_amount (uint256)
: Additional tokens to lock (can be 0
if relocking rewards).
_lockReward (bool)
: Whether to lock current rewards.
setSequencerRewardRecipient
Updates or assigns a reward recipient address.
Parameters:
_seqId (uint256)
: Sequencer ID.
_recipient (address)
: New reward recipient address.
withdrawRewards
Withdraws accrued rewards to the specified address.
Parameters:
_seqId (uint256)
: Sequencer ID.
_l2Gas (uint32)
: Gas limit for the operation.
unlock
Initiates the unlocking process for METIS tokens.
Parameters:
_seqId (uint256)
: Sequencer ID.
_l2Gas (uint32)
: Gas limit for the bridge operation.
unlockClaim
Claims unlocked tokens after the mandatory 21-day waiting period.
Parameters:
_seqId (uint256)
: Sequencer ID.
_l2Gas (uint32)
: Gas limit.
withdraw
Partially withdraws locked tokens while maintaining the minimum lock balance.
Parameters:
_amount (uint256)
: Amount to withdraw.
_seqId (uint256)
: Sequencer ID.
Always verify recipient addresses before submitting transactions, especially for rewards or withdrawals.
Securely manage and back up private keys for long-term Sequencer integrity.
Monitor gas parameters closely to avoid transaction failures.