3# Smart Contract Information
There is some information & functions (interact) in the staking smart contract, anyone can see and interact (some functions).
Read Contract
- CONTRACT_RENOUNCED = Information whether this smart contract has been released by the owner / or not
- CheckContractRenounced = Same as CONTRACT_RENOUNCED
- GetLifetimeContributionAmount = To see the amount of CET (total) that has been staked by a certain address
- GetStakeJoinDate = Time , when a certain address staking (first time)
- GetStakerPercentageByAddress = View the percentage (active staking) of a particular address
- GetStakerUnstakeableAmount = To see the number of CET coins that can be Unstake
- GetStakingAmount = To see the number of active CET staking in the smart contract
- MINIMUM_CONTRIBUTION_AMOUNT = Minimum contribution for staking
- StakerCount = Total number of addresses staking
- StakerExists = To see if a certain address has Unstake All
- UNSTAKEABLE_FEE = To see fee when Unstake
- owner = To display the owner of the smart contract staking
- stakerList = To see the address (whether the address is staking)
- stakers = Is a certain address staking
Write Contract
- ChangeMinimumStakingAmount = Function to change the minimum amount of CET (minimum staking contribution)
- ChangeUnstakeableFee = Function to replace the fee amount when the address Unstake coin CET
- RemoveStake = Remove stake
- RenounceContract = Function to leave smart contract staking
- Stake = Function to stake CET coins
- UnstakeAll = Works to Unstake all CET coins
- renounceOwnership = Function to leave the smart contract (as owner)
- transferOwnership = Function to transfer ownership (owner) of the staking smart contract
4# Stake CET
Setting Minimum Stake
Please set the minimum number of CET coins that can be staked into a smart contract, for example 1 or 10 CET coins, if a user staking below the minimum amount, it will fail.
Setting Unstake Fee
Please set the fee amount when the address/user Unstake, for example 0.5% or 1%. Illustration, if A is staking 1000 coin cet, then one day A does UnstakeAll, then the coinex cet will be deducted automatically when Unstake, for example (if the fee is 1%) then Address A only receives 99% or only 990 coins CET. I recommend not using high fees, use 0.1-0.5%
Staking
Enter the smart contract in the coinex smart chain explorer, click “Contract Info” click “Write Contract”
- Select “Stake” and enter the number of CET coins you want to stake, Click “Write”
- Confirm in your wallet, after that your coin cet will be deducted according to the amount you input / stake
- After the staking process is complete, you can see the staking status in the “Write Contrct” menu
- GetLifetimeContributionAmount = To see the amount of CET (total) ever staked
- GetStakeJoinDate = Staking time (first time)
- GetStakerPercentageByAddress = View percentage (active staking) address
- GetStakerUnstakeableAmount = To see the number of CET coins that can be Unstake
- GetStakingAmount = To see the number of active CET staking in smart contractst
5# Unstake CET
In the staking smart contract there is only 1 unstake function, namely “UnStake All” this function is to take all CET coins from the smart contract, if you want a different unstake feature, you can modify it in the smart contract code.
- Go to the “Unstake All” menu
- Click “Write” and confirm in your wallet, wait 3-5 seconds until the transaction is fully confirmed
- After confirmation, the CET balance will go to your wallet, but will be deducted by the fee
Conclusion
Deploy smart contract staking on Coinex is very easy, fast and cheap, the transaction process only takes 3-5 seconds, and the transaction fee is not more than $0.005 per transaction
This smart contract does not yet have a farming feature, if you want to add a farming or reward feature, you have to modify the code, you can take the reference code in openzepplin. You can use this smart contract for the whitelist method or IDO ticket.
GOOD LUCK