Crowdfund
contract Crowdfund
Crowdfund is a base contract for managing donations, allowing donators to donate ether to a cause. This contract implements such functionality in its most fundamental form and can be extended to provide additional functionality and/or custom behavior. The external interface represents the basic interface for purchasing tokens, and conform the base architecture for crowdfunds. They are *not* intended to be modified / overridden. The internal interface conforms the extensible and modifiable surface of crowdfunds. Override the methods to add functionality. Consider using 'super' where appropriate to concatenate behavior.
Reference
Events
FundsAdded
event FundsAdded(address donator, uint256 amount)
Event for token purchase logging.
- Parameters:
donator
- who paid for the tokensamount
- amount of tokens purchased
Functions
_preValidateFund
function _preValidateFund(address beneficiary, uint256 weiAmount) internal
Validation of an incoming funds. Use require statements to revert state when conditions are not met. Use `super` in contracts that inherit from Crowdfund to extend their validations. Example from HolderCrowdfund.sol's _preValidatePurchase method: super._preValidatePurchase(beneficiary, weiAmount); require(weiRaised().add(weiAmount) <= cap);.
- Parameters:
beneficiary
- Address performing the token purchaseweiAmount
- Value in wei involved in the purchase
_processFunds
function _processFunds(address beneficiary, uint256 weiAmount) internal
Process donated funds.
- Parameters:
beneficiary
- addressweiAmount
- uint256
addFund
function addFund(address beneficiary) public payable
Low level add fund ***DO NOT OVERRIDE***.
- Parameters:
beneficiary
- Address receiving the donations
fallback
function (address wallet) public
- Parameters:
wallet
- Address where collected funds will be forwarded to
fallback
function () external payable
Fallback function ***DO NOT OVERRIDE***.
wallet
function wallet() public view returns (address)
- Returns:
- the address where funds are collected.
weiRaised
function weiRaised() public view returns (uint256)
- Returns:
- the mount of wei raised.