Staking

Cryptum SDK currently only supports staking methods for the Celo blockchain.

Staking on Celo blockchain

To stake CELO you have to follow these steps below:

  • Register your account if it isn't registered yet

  • Lock tokens

  • Vote for validator group

  • Activate your votes

To unstake you have the following steps to do:

  • Revoke active votes from validator group

  • Unlock tokens

  • Withdraw tokens

Use the transaction controller to make the following calls:

const sdk = new CryptumSdk({
  environment: 'testnet',
  apiKey: 'YOUR-API-KEY'
})

Query information about account

sdk.staking.celo.getAccountSummary(opts)

  • opts.address (string) (required) - wallet address.

Register account

sdk.staking.celo.isRegisteredAccount(opts)

Check if account is registered already for staking.

  • opts.address (string) (required) - wallet address.

sdk.staking.celo.registerAccount(opts)

Register account.

  • opts.wallet (Wallet) (required) - wallet to be registered.

Lock tokens

sdk.staking.celo.lock(opts)

  • opts.wallet (Wallet) (required) - wallet used to lock the amount with.

  • opts.amount (string) (required) - amount to be locked.

Vote for validator group

sdk.staking.celo.vote(opts)

  • opts.wallet (Wallet) (required) - wallet used to vote.

  • opts.amount (string) (required) - Celo amount used to vote.

  • opts.validator (string) (required) - validator group address.

Activate votes

Before activating, you'll need to wait for the next epoch to begin. One epoch lasts around one day.

sdk.staking.celo.activate(opts)

  • opts.wallet (Wallet) (required) - wallet used to activate.

  • opts.validator (string) (required) - validator group address.

Revoke votes

sdk.staking.celo.revokePending(opts)

  • opts.wallet (Wallet) (required) - wallet used to revoke pending votes.

  • opts.amount (string) (required) - Celo amount used to revoke.

  • opts.validator (string) (required) - validator group address to revoke from.

sdk.staking.celo.revokeActive(opts)

  • opts.wallet (Wallet) (required) - wallet used to revoke active votes.

  • opts.amount (string) (required) - Celo amount used to revoke.

  • opts.validator (string) (required) - validator group address to revoke from.

Unlock tokens

sdk.staking.celo.unlock(opts)

  • opts.wallet (Wallet) (required) - wallet used to unlock amount.

  • opts.amount (string) (required) - Celo amount used to unlock.

Withdraw

Use this method to withdraw pending amounts. After unlocking the tokens you have to wait for 3 days to withdraw.

sdk.staking.celo.getPendingWithdrawals(opts)

  • opts.address (string) (required) - wallet address to get the pending withdrawals from.

sdk.staking.celo.withdraw(opts)

  • opts.wallet (Wallet) (required) - wallet used to withdraw.

  • opts.index (number) (required) - index of pending withdrawals.

Relock tokens

Relock tokens that are pending withdrawals.

sdk.staking.celo.relock(opts)

  • opts.wallet (Wallet) (required) - wallet used to withdraw.

  • opts.amount (string) (required) - amount to relock.

  • opts.index (number) (required) - index of pending withdrawals.

Last updated