LogoLogo
Cryptum.ioGitHub
  • 🌐Cryptum
    • What is Cryptum
    • DeFi Market
    • Ecosystem
      • Bitcoin
      • Ethereum
      • Polygon
      • Avalanche C-Chain
      • BNB Chain
      • Cardano
      • Celo
      • Hathor
      • Solana
      • Stellar
      • XRP Ledger
      • Stratus
      • Hyperledger Besu
  • 👝Products
    • Dashboard Analytics
    • Tokenization
    • Crypto Checkout
      • Overview
      • Getting started
      • Checkout Dashboard
        • Creating your Store
        • Customer Checkout screens
        • Analytics
        • Managing Wallets
        • Creating Collections and NFTs
        • Linking Products to NFTs
        • Monitoring Orders
      • Checkout API
        • Authentication
        • Store
        • Orders
          • Handling Orders
    • Wallets
    • DeFi-as-a-Service
    • On & Off Ramp (soon)
    • E-commerce Plugins
      • Wordpress NFT Plugin
        • How to install NFT Plugin
        • Connect your Credentials to NFT Plugin
      • Wordpress Checkout Plugin
        • How to install Checkout Plugin
        • Connect your Credentials to Checkout Plugin
      • Plugins Guides
        • Creating your Store
        • Manage your Wallets
        • Creating Collections and NFTs
        • Linking Products to NFTs
        • Monitoring Orders
        • Monitoring Store (Analytics)
  • 💻Community Edition
    • Overview
    • Architecture
    • Start for free
    • Getting started
    • Dashboard guide
      • 🔑Creating a Project (API Key)
      • 🛠️Start building!
      • 📊Monitoring your Project
      • 📈Monitoring Requests
    • SDK guides
      • Get test currencies
      • Chainlink
        • 📈Price Feeds
        • ⚙️Automation
        • 🎲VRF
        • 🛤️CCIP
        • 🛤️CCIP
        • Project Examples
          • Lottery
          • Send Message CCIP
      • Wallets
      • Balances
      • Prices
      • Tokens
        • EVM Tokens (ERC-20)
        • Solana Tokens (SPL)
        • Cardano Tokens
        • Stellar Tokens
        • XRP Tokens
        • Hathor Tokens
      • NFTs
        • EVM NFTs (Ethereum, Polygon and others)
        • NFTs on Solana
        • NFTs on Hathor Network
      • Queries
        • Wallet information
        • Get transaction by hash
        • Get block information
        • Get transaction receipt by hash
        • Get fees information
        • Get NFT data
        • Get NFT balance
        • Get UTXOs (Unspent transaction outputs)
      • Uniswap
      • Staking
      • Smart Contracts
        • Deploy custom Smart Contracts
        • Loot Box
    • Features and credits
      • Avalanche C Chain
      • Bitcoin
      • BNB Chain
      • Cardano
      • Celo
      • Ethereum
      • Hathor
      • Polygon
      • Solana
      • Stellar
      • XRP Ledger
      • Stratus
    • API guides
      • API Cryptum
      • API Connector
  • 📃GLOSSARY
    • Blockchain terms
    • Cryptum terms
Powered by GitBook
On this page
  • Staking on Celo blockchain
  • Query information about account
  • Register account
  • Lock tokens
  • Vote for validator group
  • Activate votes
  • Revoke votes
  • Unlock tokens
  • Withdraw
  • Relock tokens
  1. Community Edition
  2. SDK guides

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.

const summary = await sdk.staking.celo.getAccountSummary({
	address: '0xaaaaaaaaaaaaa',
}))
// summary {
//   total: '2.781313429852',
//   nonvoting: '1.01',
//   pendingWithdrawals: [ { amount: '0.002882006678210218', timestamp: '1625704512' } ],
//   votes: [
//     {
//       group: '0x5edfCe0bad47e24E30625c275457F5b4Bb619241',
//       pending: '0',
//       active: '1.771313429852'
//     }
//   ]
// }

Register account

sdk.staking.celo.isRegisteredAccount(opts)

Check if account is registered already for staking.

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

const { result } = await sdk.staking.celo.isRegisteredAccount({
	address: '0xaaaaaa'
}))

sdk.staking.celo.registerAccount(opts)

Register account.

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

const transaction = await sdk.staking.celo.registerAccount({ wallet }))

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.

const transaction = await sdk.staking.celo.lock({ wallet, amount: '0.22' }))

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.

const transaction = await sdk.staking.celo.vote({
	wallet,
	amount: '1.77',
	validator: '0xbbbbbbbb',
}))

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.

const transaction = await sdk.staking.celo.activate({
	wallet,
	validator: '0xbbbbbbbb',
}))

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.

const transaction = await sdk.staking.celo.revokePending({
	wallet,
	amount: '1',
	validator: '0x5555555555',
}))

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.

const transaction = await sdk.staking.celo.revokeActive({
	wallet,
	amount: '0.2218',
	validator: '0xcccccccccccccc',
}))

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.

const transaction = await sdk.staking.celo.unlock({
	wallet,
	amount: '0.01218',
}))

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.

const pendingWithdrawals = await sdk.staking.celo.getPendingWithdrawals({
	address: '0xaaaaaaaaaa',
}))

sdk.staking.celo.withdraw(opts)

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

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

const transaction = await sdk.staking.celo.withdraw({ wallet, index: 1 }))

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.

const transaction = await sdk.staking.celo.relock({
	wallet,
	amount: '0.01218',
	index: 0,
}))
PreviousUniswapNextSmart Contracts

Last updated 1 year ago

💻