Skip to main content

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

InitialETHCrowdfund.sol

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

NameTypeDescription
delegateaddressThe address to which voting power will be delegated to during the governance phase.
gateDatabytesData to pass to the gatekeeper to prove eligibility.

Returns

NameTypeDescription
votingPoweruint96The 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

NameTypeDescription
tokenIduint256The ID of the card the contribution is being made towards.
delegateaddressThe address to which voting power will be delegated to during the governance phase.
gateDatabytesData to pass to the gatekeeper to prove eligibility.

Returns

NameTypeDescription
votingPoweruint96The 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

NameTypeDescription
argsBatchContributeArgsThe arguments to pass to each contribute() call.

Returns

NameTypeDescription
votingPowersuint96[]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

NameTypeDescription
tokenIduint256The ID of the token to credit the contribution to, or zero to mint a new Party Card for the recipient
recipientaddress payableThe address to record the contribution under
initialDelegateaddressThe address to delegate to for the governance phase if recipient hasn't delegated
gateDatabytesData to pass to the gatekeeper to prove eligibility

Returns

NameTypeDescription
votingPoweruint96The 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

NameTypeDescription
argsBatchContributeForArgsThe arguments for the batched contributeFor() calls.

Returns

NameTypeDescription
votingPowersuint96[]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

NameTypeDescription
tokenIduint256The ID of the Party Card to refund the owner of then burn.

Returns

NameTypeDescription
amountuint96The 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

NameTypeDescription
tokenIdsuint256[]The IDs of the Party Cards to burn and refund the owners of.
revertOnFailureboolIf true, revert if any refund fails.

Returns

NameTypeDescription
amountsuint96[]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

NameTypeDescription
votingPoweruint96The voting power to convert to a contribution amount.

Returns

NameTypeDescription
amountuint96The contribution amount.