Flow Staking Contract Reference
Contract
The FlowIDTableStaking
contract is the central table that manages staked nodes, delegation and rewards.
Source: FlowIDTableStaking.cdc
Network | Contract Address |
---|---|
Emulator | 0xf8d6e0586b0a20c7 |
Cadence Testing Framework | 0x0000000000000001 |
Testnet | 0x9eca2b38b18b5dfe |
Mainnet | 0x8624b52f9ddcd04a |
Transactions and Scripts
Transactions for the staking contract are in the flow-core-contracts
repo.
Developers and users are advised to use the staking collection transactions
to stake tokens instead of the basic transactions that are used for tests.
Getting Staking Info with Scripts
These scripts are read-only and get info about the current state of the staking contract.
ID | Name | Source |
---|---|---|
SC.01 | Get Delegation Cut Percentage | idTableStaking/get_cut_percentage.cdc |
SC.02 | Get Minimum Stake Requirements | idTableStaking/get_stake_requirements.cdc |
SC.03 | Get Total Weekly Reward Payout | idTableStaking/get_weekly_payout.cdc |
SC.04 | Get Current Staked Node Table | idTableStaking/get_current_table.cdc |
SC.05 | Get Proposed Staked Node Table | idTableStaking/get_proposed_table.cdc |
SC.06 | Get Total Flow Staked | idTableStaking/get_total_staked.cdc |
SC.07 | Get Total Flow Staked by Node Type | idTableStaking/get_total_staked_by_type.cdc |
SC.08 | Get All Info about a single NodeID | idTableStaking/get_node_info.cdc |
SC.09 | Get a node's total Commitment (delegators) | idTableStaking/get_node_total_commitment.cdc |
SC.10 | Get All Info about a single Delegator | idTableStaking/delegation/get_delegator_info.cdc |
SC.11 | Get a node's total Commitment | idTableStaking/get_node_total_commitment_without_delegators.cdc |
Delegator Transactions
Documentation for delegating with tokens is described in the staking documentation for the staking collection
Events
The FlowIDTableStaking
contract emits an event whenever an important action occurs.
See the staking events Documentation for more information about each event.
_44 /// Epoch_44 access(all) event NewEpoch(_44 totalStaked: UFix64,_44 totalRewardPayout: UFix64,_44 newEpochCounter: UInt64_44 )_44 access(all) event EpochTotalRewardsPaid(_44 total: UFix64,_44 fromFees: UFix64,_44 minted: UFix64,_44 feesBurned: UFix64,_44 epochCounterForRewards: UInt64_44 )_44_44 /// Node_44 access(all) event NewNodeCreated(nodeID: String, role: UInt8, amountCommitted: UFix64)_44 access(all) event TokensCommitted(nodeID: String, amount: UFix64)_44 access(all) event TokensStaked(nodeID: String, amount: UFix64)_44 access(all) event NodeTokensRequestedToUnstake(nodeID: String, amount: UFix64)_44 access(all) event TokensUnstaking(nodeID: String, amount: UFix64)_44 access(all) event TokensUnstaked(nodeID: String, amount: UFix64)_44 access(all) event NodeRemovedAndRefunded(nodeID: String, amount: UFix64)_44 access(all) event RewardsPaid(nodeID: String, amount: UFix64, epochCounter: UInt64)_44 access(all) event UnstakedTokensWithdrawn(nodeID: String, amount: UFix64)_44 access(all) event RewardTokensWithdrawn(nodeID: String, amount: UFix64)_44 access(all) event NetworkingAddressUpdated(nodeID: String, newAddress: String)_44 access(all) event NodeWeightChanged(nodeID: String, newWeight: UInt64)_44_44 /// Delegator_44 access(all) event NewDelegatorCreated(nodeID: String, delegatorID: UInt32)_44 access(all) event DelegatorTokensCommitted(nodeID: String, delegatorID: UInt32, amount: UFix64)_44 access(all) event DelegatorTokensStaked(nodeID: String, delegatorID: UInt32, amount: UFix64)_44 access(all) event DelegatorTokensRequestedToUnstake(nodeID: String, delegatorID: UInt32, amount: UFix64)_44 access(all) event DelegatorTokensUnstaking(nodeID: String, delegatorID: UInt32, amount: UFix64)_44 access(all) event DelegatorTokensUnstaked(nodeID: String, delegatorID: UInt32, amount: UFix64)_44 access(all) event DelegatorRewardsPaid(nodeID: String, delegatorID: UInt32, amount: UFix64, epochCounter: UInt64)_44 access(all) event DelegatorUnstakedTokensWithdrawn(nodeID: String, delegatorID: UInt32, amount: UFix64)_44 access(all) event DelegatorRewardTokensWithdrawn(nodeID: String, delegatorID: UInt32, amount: UFix64)_44_44 /// Contract Fields_44 access(all) event NewDelegatorCutPercentage(newCutPercentage: UFix64)_44 access(all) event NewWeeklyPayout(newPayout: UFix64)_44 access(all) event NewStakingMinimums(newMinimums: {UInt8: UFix64})_44 access(all) event NewDelegatorStakingMinimum(newMinimum: UFix64)