Contract
The FlowStakingCollection
contract is a contract that manages a resource containing a user's stake and delegation objects.
The FlowStakingCollection
allows a user to manage multiple active nodes or delegators
and interact with node or delegator objects stored in either their optional locked account
or in the StakingCollection itself (stored in the main account).
If a user has locked tokens, StakingCollection allows a user to interact with their locked tokens
to perform staking actions for any of their nodes or delegators.
The staking collection also manages creating a node's machine accounts if they have any collector or consensus nodes. It also allows them to deposit and withdraw tokens from any of their machine accounts through the staking collection.
See the Staking Collection Docs for more information on the design of the staking collection contract.
Source: FlowStakingCollection.cdc
Network | Contract Address |
---|---|
Testnet | 0x95e019a17d0e23d7 |
Sandboxnet | 0xf4527793ee68aede |
Mainnet | 0x8d0e87b65159ae63 |
Transactions
Use the following transactions to interact with the StakingCollection.
_Note: The StakingCollection differentiates between stake and delegation requests through
passing an optional DelegatorID argument. For example, if you wish to Stake New Tokens for an active node,
pass nil
as the optional DelegatorID argument to the Stake New Tokens transaction.
The same applies for all the other staking operation transactions.
Scripts
ID | Name | Source |
---|---|---|
SCO.16 | Get All Delegator Info | stakingCollection/scripts/get_all_delegator_info.cdc |
SCO.15 | Get All Node Info | stakingCollection/scripts/get_all_node_info.cdc |
SCO.16 | Get Delegator Ids | stakingCollection/scripts/get_delegator_ids.cdc |
SCO.17 | Get Node Ids | stakingCollection/scripts/get_node_ids.cdc |
SCO.18 | Get Does Stake Exist | stakingCollection/scripts/get_does_stake_exist.cdc |
SCO.19 | Get Locked Tokens Used | stakingCollection/scripts/get_locked_tokens_used.cdc |
SCO.20 | Get Unlocked Tokens Used | stakingCollection/scripts/get_unlocked_tokens_used.cdc |
SCO.21 | Get Machine Accounts | stakingCollection/scripts/get_machine_accounts.cdc |
Setup Transaction
To setup the Staking Collection for an account, use the SC.01
transaction.
The setup process finds any node or delegator records already stored in the main account's storage, as well as any in the associated locked account if an associated locked account exists. It connects these node and delegator records with the new Staking Collection, allowing them to be interacted with using the Staking Collection API.
Events
The StakingCollection
contract emits an event whenever an important action occurs.
_10 pub event NodeAddedToStakingCollection(nodeID: String, role: UInt8, amountCommitted: UFix64, address: Address?)_10 pub event DelegatorAddedToStakingCollection(nodeID: String, delegatorID: UInt32, amountCommitted: UFix64, address: Address?)_10_10 pub event NodeRemovedFromStakingCollection(nodeID: String, role: UInt8, address: Address?)_10 pub event DelegatorRemovedFromStakingCollection(nodeID: String, delegatorID: UInt32, address: Address?)_10_10 pub event MachineAccountCreated(nodeID: String, role: UInt8, address: Address)