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 Offering
andAdvisors Reward
distributions deploy a separateMultipleDistribution
contract, pass the_participants
and_stakes
arrays to itsaddParticipants
function, and then callfinalizeParticipants
function.
ThefinalizeParticipants
function will addaddress(0)
to the participant set if the share of theaddress(0)
is not zero.
TheaddParticipants
andfinalizeParticipants
functions must be called before theDistribution
contract pre-initialization. -
Deploy the
Distribution
contract. Pass the addresses of all participants (including thePrivate Offering
andAdvisors Reward
contract addresses) to its constructor. -
For both
Private Offering
andAdvisors Reward
contracts call theMultipleDistribution.setDistributionAddress
to set the address of theDistribution
contract inside those contracts. -
Deploy the
ERC677MultiBridgeToken
contract (and passDistribution
,Private Offering
, andAdvisors Reward
contract addresses to the constructor). -
Call
preInitialize
function of theDistribution
contract passing it theERC677MultiBridgeToken
address andInitial Stake Amount
as parameters. TheInitial Stake Amount
must be equal to the amount of STAKE tokens initially minted in xDai chain before transitioning to POSDAO.
ThepreInitialize
function releases 100% ofPublic Offering
, 100% ofLiquidity Fund
, and 25% ofPrivate Offering
tokens. -
Call
initialize
function of theDistribution
contract. 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.sol
is a contract representing STAKE token on Ethereum Mainnet. Used by theDistribution
andMultipleDistribution
contracts.Distribution.sol
is 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 Fund
pools.MultipleDistribution.sol
is a separate distribution contract forPrivate Offering
andAdvisors Reward
pools. 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 theDistribution
contract.
The owner is supposed to be a MultiSig Wallet contract. The owner can only call the following functions:
ERC677MultiBridgeToken.transferOwnership
to transfer ownership of theERC677MultiBridgeToken
contract to another address;ERC677MultiBridgeToken.addBridge
to add the address of a bridge contract;ERC677MultiBridgeToken.removeBridge
to remove the address of a bridge contract;ERC677MultiBridgeToken.claimTokens
to transfer coins or specified tokens to the specified address if someone sent coins/tokens to the contract mistakenly;Distribution.transferOwnership
to transfer ownership of theDistribution
contract to another address;Distribution.preInitialize
to pre-initialize theDistribution
contract (unlock tokens forPublic Offering
,Liquidity Fund
, and 25% ofPrivate Offering
) and to initialize thePrivate Offering
andAdvisors Reward
contracts.Distribution.preInitialize
can only be called afterPrivate Offering
andAdvisors Reward
participants are finalized withMultipleDistribution.finalizeParticipants
function;Distribution.initialize
to initialize theDistribution
contract;MultipleDistribution.transferOwnership
to transfer ownership of theMultipleDistribution
contract to another address;MultipleDistribution.addParticipants
to add MultipleDistribution participants before initializing;MultipleDistribution.editParticipant
to change participant's stake before initializing;MultipleDistribution.removeParticipant
to remove a participant before initializing;MultipleDistribution.finalizeParticipants
to finalize the list of MultipleDistribution participants before initializing;MultipleDistribution.setDistributionAddress
to set theDistribution
contract address;MultipleDistribution.burn
to burn unallocated (excess) tokens (send them toaddress(0)
without total supply changing).
The following methods can be called by anyone:
ERC677MultiBridgeToken
public methods (transferAndCall
,transfer
,transferFrom
,push
,pull
,move
,approve
,increaseAllowance
,decreaseAllowance
,permit
);Distribution.makeInstallment
to transfer daily installment to specified pool;Distribution.initialize
(if 90 days after pre-initialization are expired) to initialize theDistribution
contract.
Distribution.changePoolAddress
to change own pool's address if needed.
MultipleDistribution.withdraw
to withdraw participant share.
- A bridge contract(s) defined by
ERC677MultiBridgeToken.addBridge
function can mint arbitrary tokens for any account (except zero address) usingERC677MultiBridgeToken.mint
function.