ERC20 Token build on top latest openzeppelin libraries. Features:
- upgradable
- mint & burn by Owner
- builtin real airdrop function (takes list of address to decrease gas usage)
Staking
functionality (inspired by link)
Deployed in Rinkeby testnet
- installed
nodejs
v.10 or v.12 - ensure
node
,npm
andnpx
console commands are works
npm install
- prepare your MNEMONIC (seed phrase) from the existent wallet or create new one
Copy .env.exmaple
to .env
and edit it according steps below:
- register at http://infura.io/ to get free API key (PROJECT ID)
and change INFURA_PROJECT_ID value in
.env
- change MNEMONIC value in
.env
to your actual - adjust AIRDROP_AMOUNT value in
.env
to desiredNOTE: value must be integer in
wei
s or according to decimals of your token - (optional) change AIRDROP_RECIPIENTS_FILE to actual file name with address list
- (optional) change AIRDROP_ACCOUNT_ID to desired account index in generated sequence from mnemonic
NOTE: by default it's
0
i.e. default first account
- name
- symbol
- decimals (
18
is max and thus good choice) - initial supply (integer amount according to decimals, i.e. for 555 tokens with decimals=18, it will be 555000000000000000000)
- initial holder (address of token owner, initial supply will be transferred here)
NOTE: for best experience put here default (first) address generated from mnemonic, i.e. with index 0
- stake base period - minimal period for reward calculation, in seconds (1 day = 86400)
- stake hold period - period of stake hold after canceling, reward can be taken only after, in seconds (21 days = 1814400)
- stake annual percent - reward percent per annual period, integer ( 12 )
- stake annual period - annual equivalent period, in seconds (1 year = 365 days = 31536000)
- run
npx oz deploy
- on next step with arrows keys choose upgradeable
- next pick network rinkeby (or mainnet)
- next choose contract Token
- on question 'Call a function to initialize the instance after creating it?' answer Y
- next select initialize function with most parameters
- next follow wizard to fill Token parameters:
- name (e.g. Some token)
- symbol (e.g. TKN)
- initialSupply (e.g. 555000000000000000000)
- initialHolder (e.g. 0xD9dC8E5b333a89d4A7e435faD1E53f62E80309Fd)
NOTE: Initial holder WILL BE OWNER of Token, i.e. can do mint/burn
- stakeBasePeriod (e.g. 86400)
- stakeHoldPeriod (e.g. 1814400)
- stakeAnnualPercent (e.g. 12)
- stakeAnnualPeriod (e.g. 31536000)
Token supports all ERC20 standard functions.
In addition:
mint(address account, uint256 amount)
- owner can mint some amount for specified accountburn(address account, uint256 amount)
- owner can burn some amount from specified accountairdrop(uint256 amount, address [] calldata recipients)
- transfer a specified amount to each address in list, function caller must have enough token balancestakeParams(uint256 basePeriod, uint256 holdPeriod, uint256 annualPercent, uint256 annualPeriod)
- owner can change stake parameterscreateStake(uint256 stake)
- create the stake for caller, caller must have enough token balancecancelStake()
- cancel the stake for caller and hold staked amountwithdrawStake()
- caller take reward after hold periodisStakeholder(address stakeholder) returns (bool)
- check if address is stakeholderrewardOf(address stakeholder) returns(uint256)
- get provision or calculated reward for addressstakeOf(address stakeholder) returns (uint256)
- staked amount of stakeholderstakeDetails(address stakeholder) returns (uint256, uint256)
- returns staking start and finish time for addresstotalStakes() returns (uint256)
- total staked amount at the momentbasePeriod()
holdPeriod()
annualPercent()
annualPeriod()
- fill
recipients.txt
with address list (one address per line, line with incorrect address will be ignored) - ensure you have enough ETH ant token balance on the owner account (or account which index in specified
.env
) - run
npm run airdrop-rinkeby
ornpm run airdrop-mainnet
to perform airdrop
NOTE: airdrop was test with ~900 addresses in list per one transaction, it takes about 6M of gas see tx
npm test