π²Campaigns [live]
A single contract for raising for a specific initiative with optional time or target based restraints
Campaigns on POTLOCK provide a structured way to raise funds for specific initiatives associated with an account, with optional minimum escrowed targets.
Overview of Campaigns
Campaigns serve as a vehicle for raising funds toward defined goals or initiatives. They introduce minimum funding targets and operate within a specified timeframe, allowing for refunds if the target is not met. This feature encourages community engagement and provides clarity on funding purposes, making it ideal for both individual projects and broader organizational objectives.
Use Cases
Targeted Fundraising: Raise funds specifically for initiatives like events, projects, or community support.
Supporting Organizations: Individuals can create campaigns on behalf of organizations to expand outreach and impact.
Community Engagement: Enable fans and supporters to contribute towards their favorite projects, fostering a sense of ownership and participation.
Features of Campaigns
Single Currency Support: Each campaign can support only one currency at a time, simplifying transactions.
Beneficiary Approval: The beneficiary (the project or organization being funded) can officially approve the campaign, ensuring transparency.
Escrow Functionality: Donations may be held in escrow until the minimum target is reached; if not met, donors are refunded.
Referral Opportunities: Campaign creators can leverage optional referral systems to encourage more community participation in fundraising efforts.
Contract Structure
The POTLOCK Campaign Contract is designed to facilitate fundraising through donations while managing escrow functionalities based on specified targets.
General Types
CampaignId: Unique identifier for each campaign.
DonationId: Unique identifier for each donation instance.
TimestampMs: Represents time in milliseconds.
Contract Fields
The main contract structure includes several key fields:
owner: The account that created the campaign.
admins: Accounts with administrative privileges over the campaign.
next_campaign_id: Tracks the ID assigned to the next campaign created.
campaigns_by_id: Maps campaign IDs to their details.
donations_by_id: Maps donation IDs to their details.
escrowed_donation_ids_by_campaign_id: Maps campaign IDs to donations held in escrow.
Campaign Structure
Each campaign includes:
name: Title of the campaign.
description: Overview of what the campaign aims to achieve.
cover_image_url: URL for the campaign's cover image.
recipient: Account receiving the funds raised by the campaign.
start_ms / end_ms: Timestamps indicating when the campaign starts and ends.
target_amount / min_amount / max_amount: Financial targets associated with the campaign.
NB: Campaigns can be created on behalf of others, hence the recipient field.
Write Methods
The contract includes several methods for managing campaigns:
create_campaign(): Initializes a new campaign with specified details.
update_campaign(): Allows owners to modify existing campaign details.
delete_campaign(): Removes a campaign from existence.
NB: ALL privileged write methods (those beginning with admin_* or owner_*) require an attached deposit of at least one yoctoNEAR, for security purposes.
Donation Methods
Users can donate through:
donate(): Allows users to contribute funds to an active campaign, specifying optional messages or referrer IDs.
Read Methods
The contract provides various read methods:
get_campaign(): Retrieves details of a specific campaign by ID.
get_campaigns_by_owner(): Lists all campaigns created by a specific account.
get_donations_for_campaign(): Provides all donations made towards a specific campaign.
Events
Events are emitted during significant actions within the contract:
A
campaign_createevent indicates that a new Campaign object has been created.
This structured overview provides a comprehensive understanding of how campaigns function within POTLOCK, detailing their purpose, features, contract structure, and methods effectively.
Example:
set_source_metadata
set_source_metadataIndicates that ContractSourceMetadata object has been set/updated.
Example:
Contract Adresses
When the contracts will be deployed they will be audited as they can custody funds. After the audit, the contracts will be locked at
v1.campaigns.potlock.testnet
v1.campaigns.potlock.near
v1..campaigns.staging.potlock.near
Last updated
Was this helpful?