MAINNET:
Loading...
TESTNET:
Loading...
/
onflow.org
Flow Playground

Locked Tokens Contract


The LockedTokens contract defines the resources and interfaces used to store locked FLOW tokens owned by a token holder.

Source: LockedTokens.cdc

NetworkContract Address
Testnet0x95e019a17d0e23d7
Mainnet0x8d0e87b65159ae63

StakingProxy

The StakingProxy contract defines the interfaces through which token holder and node operators perform staking operations with locked FLOW.

Source: StakingProxy.cdc

NetworkContract Address
Testnet0x7aad92e5a0715d21
Mainnet0x62430cf28c26d095

Transactions

Use the following transactions to interact with the staking contracts.

Token Admin

The token admin is the administrator responsible for distributing and releasing locked FLOW tokens. The token admin has possession of a single account that is used to control the lockups for all locked FLOW.

The token admin creates a shared account for each token holder that is co-owned by the token admin and the token holder. The shared account is used to store all locked FLOW owned by a token holder.

The token admin public key is used by account creators to configure token holder accounts to hold locked FLOW.

Token Admin Public Key

PurposeNetworkWeightEncoded Key
StandardTestnet100f845b840fd8c6a3078ea6b7ecb96d914832ee3b62323d4d42860235b4a175d75544f476aeb800e3a4bad2cc5375e47fc5e13356167a4512b6ad03e660c04b6db26246cba020364
LeaseTestnet1000f847b840fd8c6a3078ea6b7ecb96d914832ee3b62323d4d42860235b4a175d75544f476aeb800e3a4bad2cc5375e47fc5e13356167a4512b6ad03e660c04b6db26246cba02038203e8
StandardMainnet100f845b8406e4f43f79d3c1d8cacb3d5f3e7aeedb29feaeb4559fdb71a97e2fd0438565310e87670035d83bc10fe67fe314dba5363c81654595d64884b1ecad1512a64e65e020164
LeaseMainnet1000f847b8406e4f43f79d3c1d8cacb3d5f3e7aeedb29feaeb4559fdb71a97e2fd0438565310e87670035d83bc10fe67fe314dba5363c81654595d64884b1ecad1512a64e65e02018203e8

Custodian

The custodian is an agent who acts on behalf of the token holder for the purpose of securing FLOW tokens.

Token Holder

The token holder is a user who holds possession of locked and unlocked FLOW tokens.

The token holder can stake and delegate locked or unlocked FLOW through the StakingProxy contract.

The token holder can withdraw unlocked FLOW from the shared account created by the token admin.

IDNameSource
TH.01Withdraw Unlocked FLOWlockedTokens/user/withdraw_tokens.cdc
TH.02Deposit Unlocked FLOWlockedTokens/user/deposit_tokens.cdc
TH.03Get Unlock LimitlockedTokens/user/get_unlock_limit.cdc
TH.04Get Locked Account BalancelockedTokens/user/get_locked_account_balance.cdc
TH.05Get Locked Account AddresslockedTokens/user/get_locked_account_address.cdc

Staking

These transactions operate through the StakingProxy.NodeStakerProxy interface.

See the staking documentation for how to get info about a staked node.

Delegating

These transactions operate through the StakingProxy.NodeDelegatorProxy interface.

See the staking documentation for how to get info about a staked delegator.

Node Operator Staking Proxy

The node operator is an independent user who operators a Flow node on behalf of a token holder. These transactions should only be used for those who are in a relationship where a node operator operates a node for a token holder and the relationship needs to be managed on chain.

IDNameSource
NO.01Set Up Operator AccountstakingProxy/setup_node_account.cdc

Register an Operator Node

These transactions are used in the case where the node info has to be transferred on-chain. If the node info can be exchanged off-chain, the normal node registration functions can be used.

IDNameSource
TH.15Get Operator Node Info for registrationstakingProxy/get_node_info.cdc
TH.16Register Operator NodestakingProxy/register_node.cdc

Staking

These transactions operate through the StakingProxy.NodeStakerProxy interface.

The node operator can perform the following staking actions using locked or unlocked FLOW owned by the token holder.

Note: The node operator can perform these actions on behalf of the token holder, but only with explicit permission. This permission can be revoked by the token holder.

IDNameSource
NO.02Add Node InfostakingProxy/add_node_info.cdc
NO.03Remove Node InfostakingProxy/remove_node_info.cdc
NO.04Remove Staking ProxystakingProxy/remove_staking_proxy.cdc
NO.05Stake New Locked FLOWstakingProxy/stake_new_tokens.cdc
NO.06Re-stake Unstaked FLOWstakingProxy/stake_unstaked_tokens.cdc
NO.07Unstake FLOWstakingProxy/unstake_all.cdc
NO.08Withdraw Unstaked FLOWstakingProxy/withdraw_unstaked.cdc
NO.09Withdraw Rewarded FLOWstakingProxy/withdraw_rewards.cdc

Events

The LockedTokens contract defines events that can be monitored for important actions.

SharedAccountRegistered

Emitted when a new shared (locked) account is registered.

SharedAccountRegistered
pub event SharedAccountRegistered(address: Address)

UnlockedAccountRegistered

Emitted when a new user (unlocked) account is registered. This and SharedAccountRegistered are always emitted at the same time.

UnlockedAccountRegistered
pub event UnlockedAccountRegistered(address: Address)

UnlockLimitIncreased

Emitted when the token admin increases the unlock limit for a locked account. This will usually happen when a milestone is reached in the vesting of the locked tokens.

UnlockLimitIncreased
pub event UnlockLimitIncreased(address: Address, increaseAmount: UFix64, newLimit: UFix64)

LockedAccountRegisteredAsNode

Emitted when a user registers their locked account as a node operator.

LockedAccountRegisteredAsNode
pub event LockedAccountRegisteredAsNode(address: Address, nodeID: String)

LockedAccountRegisteredAsDelegator

Emitted when a user registers their locked account as a delegator.

LockedAccountRegisteredAsDelegator
pub event LockedAccountRegisteredAsDelegator(address: Address, nodeID: String)

LockedTokensDeposited

Emitted when the token admin deposits locked tokens from the token sale.

LockedTokensDeposited
pub event LockedTokensDeposited(address: Address, amount: UFix64)