InitialETHCrowdfund
A crowdfund for raising an initial treasury for new Parties. Unlike other crowdfunds that are started for the sole purpose of acquiring NFT(s), this crowdfund simply bootstraps a Party with funds and lets its members coordinate on what to do after.
Code
Roles
Contributors
Users who have contributed to the crowdfund.
Hosts
Trusted addresses with the ability to unilaterally veto proposals and configure Rage Quit in the Party that is created after the crowdfund is won. While the crowdfund is active, the Host can finalize the crowdfund early if it has reached its minimum crowdfunding goal.
Funding Split Recipient
An optional address that can claim a reserved percentage of the raised funds after the crowdfund wins.
States
Active
The crowdfund has been created and contributions can be made to reach contribution targets until a deadline or the minimum contribution target is reached and host finalizes.
Won
The crowdfund has expired and reached the minimum contribution target. It is now ready to be finalized.
Finalized
A won crowdfund has been finalized, with funds transferred to the Party and voting power successfully updated for governance to begin.
Functions
contribute
Contribute ETH to this crowdfund on behalf of a contributor.
function contribute(address delegate, bytes memory gateData)
public
payable
onlyDelegateCall
returns (uint96 votingPower);
Parameters
Name | Type | Description |
---|---|---|
delegate | address | The address to which voting power will be delegated to during the governance phase. |
gateData | bytes | Data to pass to the gatekeeper to prove eligibility. |
Returns
Name | Type | Description |
---|---|---|
votingPower | uint96 | The voting power the contributor receives for their contribution. |
contribute
Contribute ETH to this crowdfund on behalf of a contributor.
function contribute(uint256 tokenId, address delegate, bytes memory gateData)
public
payable
onlyDelegateCall
returns (uint96 votingPower);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The ID of the card the contribution is being made towards. |
delegate | address | The address to which voting power will be delegated to during the governance phase. |
gateData | bytes | Data to pass to the gatekeeper to prove eligibility. |
Returns
Name | Type | Description |
---|---|---|
votingPower | uint96 | The voting power the contributor receives for their contribution. |
batchContribute
contribute()
in batch form. May not revert if any individual contribution fails.
function batchContribute(BatchContributeArgs calldata args)
external
payable
onlyDelegateCall
returns (uint96[] memory votingPowers);
Parameters
Name | Type | Description |
---|---|---|
args | BatchContributeArgs | The arguments to pass to each contribute() call. |
Returns
Name | Type | Description |
---|---|---|
votingPowers | uint96[] | The voting power received for each contribution. |
contributeFor
Contribute to this crowdfund on behalf of another address.
function contributeFor(uint256 tokenId, address payable recipient, address initialDelegate, bytes memory gateData)
external
payable
onlyDelegateCall
returns (uint96 votingPower);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The ID of the token to credit the contribution to, or zero to mint a new Party Card for the recipient |
recipient | address payable | The address to record the contribution under |
initialDelegate | address | The address to delegate to for the governance phase if recipient hasn't delegated |
gateData | bytes | Data to pass to the gatekeeper to prove eligibility |
Returns
Name | Type | Description |
---|---|---|
votingPower | uint96 | The voting power received for the contribution |
batchContributeFor
contributeFor()
in batch form. May not revert if any individual contribution fails.
function batchContributeFor(BatchContributeForArgs calldata args)
external
payable
onlyDelegateCall
returns (uint96[] memory votingPowers);
Parameters
Name | Type | Description |
---|---|---|
args | BatchContributeForArgs | The arguments for the batched contributeFor() calls. |
Returns
Name | Type | Description |
---|---|---|
votingPowers | uint96[] | The voting power received for each contribution. |
finalize
Finalize the crowdfund if it has expired and reached its minimum contribution target.
function finalize() external;
refund
Refund the owner of a Party Card and burn it. Only available if the crowdfund lost. Can be called to refund for self or on another's behalf.
function refund(uint256 tokenId) external returns (uint96 amount);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The ID of the Party Card to refund the owner of then burn. |
Returns
Name | Type | Description |
---|---|---|
amount | uint96 | The amount of ETH refunded to the contributor. |
batchRefund
refund()
in batch form. May not revert if any individual refund fails.
function batchRefund(uint256[] calldata tokenIds, bool revertOnFailure) external returns (uint96[] memory amounts);
Parameters
Name | Type | Description |
---|---|---|
tokenIds | uint256[] | The IDs of the Party Cards to burn and refund the owners of. |
revertOnFailure | bool | If true, revert if any refund fails. |
Returns
Name | Type | Description |
---|---|---|
amounts | uint96[] | The amounts of ETH refunded for each refund. |
sendFundingSplit
Send the funding split to the recipient if applicable.
function sendFundingSplit() external returns (uint96 splitAmount);
getCrowdfundLifecycle
Get the current lifecycle of the crowdfund.
function getCrowdfundLifecycle() public view returns (CrowdfundLifecycle lifecycle);
convertVotingPowerToContribution
Calculate the contribution amount from the given voting power.
function convertVotingPowerToContribution(uint96 votingPower) public view returns (uint96 amount);
Parameters
Name | Type | Description |
---|---|---|
votingPower | uint96 | The voting power to convert to a contribution amount. |
Returns
Name | Type | Description |
---|---|---|
amount | uint96 | The contribution amount. |