How To Create Staking CRC20 Token Coinex Smart Chain – Part 2


4# Smart Contract Information

After the smart contract verification process is complete, all smart contract information appears in the coinex smart chain explorer, anyone can see the information.

Information in the “Read Contract” Tab
  • CONTRACT_RENOUNCED = To find out whether the contract has been renounced (released from ownership by the owner)
  • GetLifetimeContributionAmount = To find out the total number of tokens that have been staked by a certain address
    GetStakeJoinDate = Information when the address-wallet staked the first time
  • GetStakerPercentageByAddress = Information on the percentage of the number of tokens staked by a certain address
  • GetStakerUnstakeableAmount = Information on how many tokens are UnStakeable by a certain address
  • GetStakingAmount = Information on how many tokens are currently actively staking by a certain address
  • MINIMUM_CONTRIBUTION_AMOUNT = Minimum number of tokens that can be staked
  • StakerCount = Number of addresses that have staked crc20 tokens
  • TOKEN: Address smart contract crc20 (a token that can be staking)
  • UNSTAKEABLE_FEE = Fee when address Unstake Token
  • Owner = Owner of smart contract staking
Information & Function in “Write Contract” Tab
  • ChangeMinimumStakingAmount = Function to change the minimum number of tokens staked, for example 0.1 or 1 token
  • ChangeUnstakeableFee = Function to change the fee amount when unstake token
  • RenounceContract = Serves to release ownership of smart contracts
  • Stake = Function for staking token crc20
  • Unstake All = Function to Unstake all tokens or WD all tokens in smart contracts
  • Update Token = To replace the crc20 token that will/can be staking in the smart contract
  • renounceOwnership = Serves to release the owner of the smart contract
  • transferOwnership = To transfer / change ownership of the smart contract to another address

 

5# Approve Address

Before staking the crc20 token, you need to approve the address on the crc20 token smart contract, if this step is not done, then you cannot stake or unstake,

  • Approve your wallet address and enter the number of tokens you want to approve
  • Approve address of smart contract staking and enter the number of tokens that you will approve
How to approve address
  • Sign in to the crc20 token smart contract
  • Click Contrat Info
  • Click Write Contract
  • Connect your wallet, there are two options, you can connect with metamask or use wallet connect
    Click on the “Approve” menu
  • Enter the address and the number of tokens, because this token uses decimal 18, then you need to add 18 to the number 0, for example if you want to approve 100,000 tokens, then all you need to input is 100000000000000000000
  • Click Aprove/Submit and confirm in the metamask wallet
  • Wait until it is fully confirmed by the coinex smart chain blockchain

6# Setting ChangeMinimumStakingAmount

You need settings, how many tokens (minimum) can be staked

 

7# Update Token

Click the “Update Token” menu and enter the address of the crc20 token smart contract and confirm it in your wallet

 

8# Stake & Unstake Token
  • Staking Token

Enter smart contract staking in the coinex smart chain explorer, click “contract info”, click “write contract”, connect your wallet (can use metamask or wallet connect).

Click the “Stake” menu, enter the number of tokens you want to stake, because this uses decimal 18, you need to add 18 to the number 0 , for example if I want to stake 100 tokens, then I have to enter 1000000000000000000

Click “Write” and confirm in your wallet, your token will be automatically deducted according to the amount you entered

 

  • Unstake token

The process is the same as stake, only you have to select the “Unstake All” menu, this function is to return / WD / Take all the tokens in the smart contract. You can modify it to create a partial Unstake function or a percentage system.

 

Conclusion

Making smart contract staking on the coinex smart chain is easy and fast, for one transaction it only takes 3-seconds, and the transaction fee is also very cheap, not more than $0.005 per transaction. You can modify this smart contract as you wish, you can also add a reward or farming function to the smart contract

You can use the smart contract staking to whitelist the IDO or a ticket to join the IDO, the system is that anyone who wants to take part in the IDO must staking in the smart contract. You can also combine this Staking Smart Contract with the React JS application, which later users can interact with smart contracts such as stake, unstake, approve using the website page (react js). good luck


Alif Fahmi

hi , I'm Alif, I'm a blockchain & cryptocurrency lover, I love writing & learning, my job is web developer & crypto trader