
Custom purpose
Provides a service to make a decentralised voting event. Offers a contract that takes a voter and a vote and resolves the voting process with results. Voting can only be stopped by the owner. Each participant may vote only once and the owner can not vote.
Parameters:
- startTime:_ sets the start date in seconds (epoch value)
- endTime: sets the end date in seconds (epoch value)
- target: sets the target for the crowdsale
Exposed methods
- fallback
- totalPercentage gets the percentage of the raised wei
- target gets the campaign target
- startTime gets the start time of the crowdfunding
- raised gets the raised amount
- owner gets the owner
- investments gets the investments for the provided address
- endTime gets the end time of the crowdfunding
- beneficiaries gets the beneficiary for specified position in list
- forwardFunds forward funds to the beneficiaries
- performInvestment perform an investment
- refund executes a refund
- registerBeneficiary register a beneficiary in schema
- transferOwnership transfers the ownership to the provided address
Example:
- startTime:_ 1524294302
- endTime: 1553151902
- target: 88888
####Behaviour: -anybody can invest in the campaign startTime - endTime interval -campaign is closed after endTime -target can be exceeded -if target is not reached at endTime investors can ask for a refund for an undefined period -if target is reached and endTime has passed, anybody can call forward funds function that will transfer raised ether according to the beneficiary schema
####Set-up Owner can configure beneficiary schema using function registerBeneficiary. A beneficiary schema represents a list of addresses and percentages of raised funds.
####Owner should call registerBeneficiary three times:
- definition of const crowdsale as a web3 contract
- crowdsale.registerBeneficiary(""0x0000000000000000000000000000000000000001"", 25, { from: web3.eth.coinbase });
- crowdsale.registerBeneficiary(""0x0000000000000000000000000000000000000002"", 30, { from: web3.eth.coinbase });
- crowdsale.registerBeneficiary(""0x0000000000000000000000000000000000000003"", 45, { from: web3.eth.coinbase });
####Finalization After the crowdsale has ended there are two scenarious, target reached or not.
####Target reached
- Anybody can call forwardFunds function that will transfer the investments to the beneficiary schema. Keep in mind some constraints will apply:
- raised >= target // raised wei amount greater than target set at initializtion
- forwarded == false // funds should not be already transfered
- totalPercentage == 100 // sum of beneficiary schema percentages should be 100
####Target not reached
- Investors can call refund function and they will receive investments back."