- must include a funding goal
- must allow users to contribute to the goal
- must identify contributors by their address
- may retain other info
- must have a state (
Unfunded
,Prefunded
orFunded
) - state must be updated when certain conditions are met
- contributors may withdraw funds during the
Unfunded
state - must allow the owner to notify a sponsor
- must allow the owner to transfer the funds to a distribution contract when the
Funded
state is reached
- must allow sponsoring via percent
- must have its own balance
- must be able to be initialized with a starting balance
- must revert the sponsorship if there are not enough funds
- must allow the owner to change the sponsorhip percent
- must allow the owner to fund the contract
- must verifiy the
CrowdFunding
contract's balance
- must allow adding beneficiaries with certain shares
- the total shares may amount to less than a hundred
- must allow the
CrowdFunding
to transfer funds - must allow beneficiaries to withdraw their respective shares
Mention: All the functionalities above are implemented and will not be listed again below to make reading easier
- base contract for the following three
- comprised of the
owner
attribute and shared modifiers
- status implemented as enum
- current funding status returned in string format
- both contributors and their respective contributions are retained
- custom modifiers created to avoid redundancy and make the code cleaner while enforcing security and strictness
- the last contributor is allowed to withdraw its funds if the total balance accumulated exceeds the funding goal
- contributors can check their respective contributions
- function exposed to receive funds from sponsor
- possibility to reset the crowd funding once all the funds have been transferred and the status is
Funded
- numerous custom modifiers used for enforcing security
- allows for choosing between sponsoring with a percentage of the funding goal or the total accumulated balance of the
CrowdFunding
contract - allows the owner to whitelist certain
CrowdFunding
contracts - checks the fund requests comes from a whitelisted contract and not an EOA
- allows the owner to remove addresses from the whitelist
- allows for multiple crowdfundings to use the facilities of the contract by uniquely identifying every
CrowdFunding
by the address of its owner (referred to as manager below) - each manager only has access to the info that concerns them
- the amount gathered by each manager is updated alongside the transfer from the
CrowdFunding
contract - each manager has a corresponding list of beneficiaries, each with their own respective percentages
- total percentages allocated are remembered for each of the managers in order to avoid recalculating them each time a beneficiary is added/updated
- beneficiaries can be added by a manager to their mapping
- beneficiaries can have their shares updated by a manager
- proper fund administration is thouroughly ensured by numerous checks using custom modifiers
- beneficiaries can check their respective share
- managers can check the amount gathered
- managers can check the addresses of the paid beneficiaries
Documentation: All the contracts have been meticulously documented using NatSpec
.