A repository for STAKE token initialization and distribution used by POSDAO implementation.
- Security audit:
- in xDai's GitHub: first report, additional (final) report
- in Quantstamp's GitHub
- Contracts documentation: https://xdaichain.github.io/stake-token/docs/
- Distribution model: https://www.staketoken.net/rounds-1/stake-distribution
- POSDAO contracts repository: https://github.com/poanetwork/posdao-contracts
- POSDAO White Paper: https://forum.poa.network/t/posdao-white-paper/2208
npm install
npm run test
-
For both
Private OfferingandAdvisors Rewarddistributions deploy a separateMultipleDistributioncontract, pass the_participantsand_stakesarrays to itsaddParticipantsfunction, and then callfinalizeParticipantsfunction.
ThefinalizeParticipantsfunction will addaddress(0)to the participant set if the share of theaddress(0)is not zero.
TheaddParticipantsandfinalizeParticipantsfunctions must be called before theDistributioncontract pre-initialization. -
Deploy the
Distributioncontract. Pass the addresses of all participants (including thePrivate OfferingandAdvisors Rewardcontract addresses) to its constructor. -
For both
Private OfferingandAdvisors Rewardcontracts call theMultipleDistribution.setDistributionAddressto set the address of theDistributioncontract inside those contracts. -
Deploy the
ERC677MultiBridgeTokencontract (and passDistribution,Private Offering, andAdvisors Rewardcontract addresses to the constructor). -
Call
preInitializefunction of theDistributioncontract passing it theERC677MultiBridgeTokenaddress andInitial Stake Amountas parameters. TheInitial Stake Amountmust be equal to the amount of STAKE tokens initially minted in xDai chain before transitioning to POSDAO.
ThepreInitializefunction releases 100% ofPublic Offering, 100% ofLiquidity Fund, and 25% ofPrivate Offeringtokens. -
Call
initializefunction of theDistributioncontract. The countdown for cliff periods and installments starts from this moment.
Run your local node.
Uncomment the lines with preInitialize and initialize calls in 2_deploy_contracts.js and run:
ECOSYSTEM_FUND_ADDRESS=0xb28a3211ca4f9bf8058a4199acd95c999c4cdf3b PUBLIC_OFFERING_ADDRESS=0x975fe74ec9cc82afdcd8393ce96abe039c6dba84 FOUNDATION_REWARD_ADDRESS=0xb68d0a5c0566c39e8c2f8e15d8494032fd420da1 LIQUIDITY_FUND_ADDRESS=0x7f29ce8e46d01118888b1692f626d990318018ea INITIAL_STAKE_AMOUNT=220000000000000000000000 PRIVATE_OFFERING_DATA=./example.csv ADVISORS_REWARD_DATA=./example.csv ./node_modules/.bin/truffle migrate --reset --network kovan
Note: don't forget to change the input data.
Token/ERC677MultiBridgeToken.solis a contract representing STAKE token on Ethereum Mainnet. Used by theDistributionandMultipleDistributioncontracts.Distribution.solis the main distribution contract containing the distribution amounts, terms, and logic. Distributes initially minted tokens from its balance toEcosystem Fund,Public Offering,Private Offering,Advisors Reward,Foundation Reward, andLiquidity Fundpools.MultipleDistribution.solis a separate distribution contract forPrivate OfferingandAdvisors Rewardpools. This contract contains all the corresponding private/advisors participants and allows the participants to withdraw their share of tokens after they are transferred to the contract from theDistributioncontract.
The owner is supposed to be a MultiSig Wallet contract. The owner can only call the following functions:
ERC677MultiBridgeToken.transferOwnershipto transfer ownership of theERC677MultiBridgeTokencontract to another address;ERC677MultiBridgeToken.addBridgeto add the address of a bridge contract;ERC677MultiBridgeToken.removeBridgeto remove the address of a bridge contract;ERC677MultiBridgeToken.claimTokensto transfer coins or specified tokens to the specified address if someone sent coins/tokens to the contract mistakenly;Distribution.transferOwnershipto transfer ownership of theDistributioncontract to another address;Distribution.preInitializeto pre-initialize theDistributioncontract (unlock tokens forPublic Offering,Liquidity Fund, and 25% ofPrivate Offering) and to initialize thePrivate OfferingandAdvisors Rewardcontracts.Distribution.preInitializecan only be called afterPrivate OfferingandAdvisors Rewardparticipants are finalized withMultipleDistribution.finalizeParticipantsfunction;Distribution.initializeto initialize theDistributioncontract;MultipleDistribution.transferOwnershipto transfer ownership of theMultipleDistributioncontract to another address;MultipleDistribution.addParticipantsto add MultipleDistribution participants before initializing;MultipleDistribution.editParticipantto change participant's stake before initializing;MultipleDistribution.removeParticipantto remove a participant before initializing;MultipleDistribution.finalizeParticipantsto finalize the list of MultipleDistribution participants before initializing;MultipleDistribution.setDistributionAddressto set theDistributioncontract address;MultipleDistribution.burnto burn unallocated (excess) tokens (send them toaddress(0)without total supply changing).
The following methods can be called by anyone:
ERC677MultiBridgeTokenpublic methods (transferAndCall,transfer,transferFrom,push,pull,move,approve,increaseAllowance,decreaseAllowance,permit);Distribution.makeInstallmentto transfer daily installment to specified pool;Distribution.initialize(if 90 days after pre-initialization are expired) to initialize theDistributioncontract.
Distribution.changePoolAddressto change own pool's address if needed.
MultipleDistribution.withdrawto withdraw participant share.
- A bridge contract(s) defined by
ERC677MultiBridgeToken.addBridgefunction can mint arbitrary tokens for any account (except zero address) usingERC677MultiBridgeToken.mintfunction.