Staking contract development with hardhat
ERC20Token, Token Staking, Token Claim, Token Unstaking, Token Withdraw
yarn install
yarn compile
create .env file
- PRIVATE_KEY - Private key of account that is using for deployment or test
- ETHERSCAN_APIKEY - etherscan API KEY
- ALCHEMY_MAINNET_API_KEY - Ethereum mainnet api key
- ALCHEMY_SEPOLIA_API_KEY - Sepolia testnet api key
- ALCHEMY_GOERLI_API_KEY - Goerli testnet api key
- ALCHEMY_MUMBAI_API_KEY - Mumbai testnet api key
- TEST_ADD3TOKEN_ADDRESS - Goerli test token address
- TEST_STAKING_ADDRESS - Goerli staking address
We use openzeppelin upgradable artifcast and we should to keep it fresh for upgrading.
We keep artifacts in contract_artifacts directory. With this scheme:
./contract_artifacts/
./contract_artifacts/{env_name}/
./contract_artifacts/{env_name}/{purpose_name}/
./contract_artifacts/{env_name}/{purpose_name}/openzeppelin/
./contract_artifacts/{env_name}/{purpose_name}/openzeppelin/unknown-56.json
- Token Deploy Command
yarn deploy-token --network [network_name]
- Staking Contract Deploy Command
yarn deploy-staking --network [network_name]
npx hardhat verify --network bsc [Proxy Address]
-
Test Command
For all tests:
yarn testFor local/ci-cd tests:
yarn test:token yarn test:staking
Dynamic,Static,AutoCompoundmode for staking contract
Dynamic mode is working like that the staker can claim when they want even the staking period is not ended
Static mode is working like that the staker can claim only after the period is ended
AutoCompound mode is working like auto stake when user claim