Documentation menu

Staking rule

A Staking rule grants a role to members whose tokens are held in your staking contract. Staked tokens usually leave the member's wallet, so a normal Contract rule would not see them.

Settings

Field Description
Network The EVM chain the staking contract is on
Staking contract The address of your staking contract
NFT contract The collection being staked. NXT watches its transfers, so staking and unstaking trigger a re-check.
Read function The name of a view function that takes the member's address. Defaults to balanceOf.
Minimum Optional. How many staked tokens are required. Defaults to 1.
Role The Discord role to grant

Read function requirements

The function must be a public view function that takes one address argument and returns either:

  • a uint256 count, for example balanceOf(address) returns (uint256) or stakedCount(address) returns (uint256), or
  • a uint256[] list of token IDs, for example stakedTokens(address) returns (uint256[]). NXT counts the length of the list.

NXT calls the function once for each of the member's wallets and adds up the results. If neither return shape can be read, the result is unknown and no role is removed.

Combining staked and unstaked holders

To grant the same role to members who hold or stake, create two rules for the same role: a Contract rule and a Staking rule. The member keeps the role while either passes.

Blocked tokens do not apply to staking rules, because the staking contract reports counts rather than individual tokens.

Something unclear or out of date? Tell us at support@nxtnft.app.