Crowdfunding

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:

  1. startTime:_ sets the start date in seconds (epoch value)
  2. endTime: sets the end date in seconds (epoch value)
  3. target: sets the target for the crowdsale

Exposed methods

  1. fallback
  2. totalPercentage gets the percentage of the raised wei
  3. target gets the campaign target
  4. startTime gets the start time of the crowdfunding
  5. raised gets the raised amount
  6. owner gets the owner
  7. investments gets the investments for the provided address
  8. endTime gets the end time of the crowdfunding
  9. beneficiaries gets the beneficiary for specified position in list
  10. forwardFunds forward funds to the beneficiaries
  11. performInvestment perform an investment
  12. refund executes a refund
  13. registerBeneficiary register a beneficiary in schema
  14. 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."
Buy
Reviewed by Modex
Buy Contract Test Contract

Create an account or login to purchase this smart contract