Discord staking roles for NFTs that have left the wallet.
When members stake an NFT, it usually moves into a staking contract, so a normal ownership check no longer sees it. NXT reads the staking contract directly and grants roles to members with tokens staked.
Staking hides holdings
Staking is meant to reward commitment, yet in many servers a member who stakes loses their holder role because the token is no longer in their wallet. That punishes the behavior the project wants to encourage.
Staking contracts also differ: some expose a count, others return a list of staked token IDs.
How NXT reads staking contracts
A Staking rule takes the network, the staking contract, the NFT contract being staked, a read function, and an optional minimum. The read function must be a public view function that takes one address and returns either a uint256 count, such as balanceOf or stakedCount, or a uint256 list of token IDs, in which case NXT counts its length.
NXT calls the function for each of the member's wallets and adds up the results. Because it watches the NFT contract's transfers, staking and unstaking trigger a re-check within seconds. If neither return shape can be read, the result is unknown and no role is removed.
To give the same role to members who hold or stake, create a Contract rule and a Staking rule for the same role.
Set it up. Three steps.
Add a Staking rule
Choose the network, the staking contract, and the NFT contract being staked.
Set the read function
Keep balanceOf or enter your contract's function, such as stakedTokens, and set a minimum.
Cover holders too
Add a Contract rule for the same role so both stakers and holders qualify.
Staking rule details
Count or list
Read functions can return a uint256 count or a uint256 list of token IDs.
Summed wallets
Results from every proven wallet are added together.
Real-time on stake
Transfers of the staked NFT contract trigger re-checks within seconds.
Minimum staked
Require a number of staked tokens, defaulting to 1.
Hold or stake
Two rules for the same role keep it while either one passes.
Combo ready
Use staking as one condition in a Combo rule alongside balances or traits.