All-or-nothing fundraising with a goal and deadline. If the goal is met by the deadline, the creator receives the funds. Otherwise, contributors can claim refunds.
Community fundraisers with transparent goals
Project kickstarters with automatic refund on failure
Charity drives with on-chain accountability
The contract is initialized through the initialize execute method after deployment:
Parameter Type Description titleStringCampaign title (max 128 chars) descriptionStringCampaign description (max 512 chars) token_idTokenIdToken to accept (use all-zeros for native NORN) goalu128Fundraising goal amount deadlineu64Unix timestamp when the campaign ends
Method Parameters Description initializetitle, description, token_id, goal, deadlineCreate the campaign. Only callable once. contributeamount: u128Contribute tokens to the campaign. Must be active and before deadline. finalize-- End the campaign. If goal met, funds go to creator. If not, status set to Failed. refund-- Claim a refund after campaign has failed. Returns contributor's full amount.
Method Parameters Returns Description get_config-- CrowdfundConfigFull campaign configuration and status get_contributionaddress: Addressu128Contribution amount for a specific address get_total_raised-- u128Total tokens raised so far get_contributor_count-- u64Number of unique contributors
pub enum CampaignStatus {
Active , // Campaign is accepting contributions
Succeeded , // Goal met, funds released to creator
Failed , // Goal not met, contributors can refund
}
pub struct CrowdfundConfig {
pub creator : Address ,
pub title : String ,
pub description : String ,
pub token_id : TokenId ,
pub goal : u128 ,
pub deadline : u64 ,
pub status : CampaignStatus ,
pub created_at : u64 ,
}
# Deploy a crowdfund contract
norn wallet deploy-loom --name my-crowdfund
# Upload bytecode
norn wallet upload-bytecode --loom-id < LOOM_I D > \
--bytecode crowdfund.wasm
# Initialize (borsh-encoded input)
norn wallet execute-loom --loom-id < LOOM_I D > --input < HE X >
# Query config
norn wallet query-loom --loom-id < LOOM_I D >