Deploying a Lockup Contract
The simplest way to deploy a new lockup contract is to use the existing global contract already published on NEAR. It is important to understand that the total amount of tokens to be locked is determined by the balance of the account at the moment of deployment. Whatever tokens are in the account once you deploy the contract will become locked under the schedule you define. This means that you must always first create and fund the lockup account with the intended amount of tokens, and only after that deploy the contract.Checking Balance
To see the owner’s balance, run the following command. The returned amount includes both the total amount of tokens in the contract and any staking rewards that are available for withdrawal.Withdraw Tokens
To transfer unlocked tokens to your account, please run the following command.Withdraw Tokens Once Fully Unlocked
Once all tokens are fully vested and unlocked, you can convert your lockup account into a regular NEAR account by adding a full access key. This allows you to manage the account directly and withdraw the remaining tokens by leveraging the power of advanced technique, which includes deleting it account completely and specifying your account as beneficiary. Generate a new key pair and run the following command to add it as full access key to account, once the vesting/locking schedule is finished.owner.near with your address) with the following command.
Make sure all staked tokens are fully withdrawn before attempting to delete the account. If any tokens remain delegated to a staking pool, they will be lost once the account is deleted.
Staking
The Lockup contract allows the owner to delegate tokens to a whitelisted staking pool, and it lets the owner to earn additional rewards while their base tokens remain locked. Let’s walk through each step slowly, in the order you will typically execute the commands.Select Staking Pool
Choose a validator from the whitelist configured at initialization, then set it on the lockup contract.Deposit and Stake Tokens
Stake part of tokens, available on the lockup contract. The amount must be passed over in yoctoNEAR (1 NEAR = 10^24 yoctoNEAR).Refresh Staking Pool Balance
The rewards from staking pool won’t be automatically reflected in the contract. This command synchronizes the contract’s internal balance with the staking pool.Unstake
When you feel ready, simply request unstake with the following command. You will need to wait standard delay of 4 epochs for funds to become withdrawable from the pool.Withdraw
As soon as 4 epochs have gone by, run the following command to move the funds from the staking pool back to the contract, including earned rewards.Termination (for Foundations)
The lockup can be terminated early by afoundation_account_id, if it was specified during the initialization. Before the cliff, the entire allocation is refunded to the foundation. After the cliff, only the unvested portion is refunded, while the vested part remains with the owner.
During termination, some owner actions are temporarily paused until the process completes.