A decentralized charity donation platform built on Aptos blockchain where users can donate to charity campaigns with all transactions tracked on-chain.
This smart contract enables:
- Charity organizers to create fundraising campaigns with target amounts
- Donors to contribute APT coins transparently
- On-chain tracking of total donations and donor count per campaign
- Create Campaign: Initialize a new charity campaign with a fundraising target
- Donate to Charity: Contribute APT coins to any registered charity campaign
- On-Chain Tracking: All donations, donors, and campaign progress are recorded immutably on the blockchain
Aptos-meetup/
├── sources/
│ └── project.move # Smart contract code
├── Move.toml # Project configuration
└── README.md # This file
Module Name: CharityModule::CharityPlatform
Module Address: f9ac9420e52ca2ffb2b157cb0340ed8ec2b4ba4bb9b73666422ad64e42287b71
Creates a new charity campaign.
Parameters:
organizer: The account creating the campaigntarget_amount: The fundraising goal in APT tokens
Example:
create_campaign(organizer, 1000000000); // 10 APTDonate APT tokens to a charity campaign.
Parameters:
donor: The account making the donationcharity_address: Address of the charity organizeramount: Amount to donate in APT tokens
Example:
donate_to_charity(donor, 0xf9ac9420..., 100000000); // 1 APTCharityCampaign
struct CharityCampaign {
total_donations: u64, // Total funds raised
target_amount: u64, // Fundraising goal
donor_count: u64, // Number of donors
}- Aptos CLI installed
- Aptos wallet with testnet APT tokens
- Move knowledge (basic understanding of the Move language)
- Clone/Navigate to project:
cd Aptos-meetup- Create an Aptos profile (if not already created):
aptos init --profile tarun1- Fund your account with testnet APT from the Aptos Faucet
Compile the smart contract:
aptos move compileExpected output:
BUILDING Charity_app
Result: f9ac9420e52ca2ffb2b157cb0340ed8ec2b4ba4bb9b73666422ad64e42287b71::CharityPlatform
Deploy the contract to Aptos testnet:
aptos move publish --profile tarun1This will:
- Compile your contract
- Create a publish transaction
- Sign with your
tarun1profile - Submit to the Aptos testnet
aptos move run --function-id f9ac9420e52ca2ffb2b157cb0340ed8ec2b4ba4bb9b73666422ad64e42287b71::CharityPlatform::create_campaign --args 1000000000 --profile tarun1aptos move run --function-id f9ac9420e52ca2ffb2b157cb0340ed8ec2b4ba4bb9b73666422ad64e42287b71::CharityPlatform::donate_to_charity --args @<CHARITY_ADDRESS> 100000000 --profile tarun1Replace <CHARITY_ADDRESS> with the actual charity address.
Check deployed modules:
aptos account list --query modules --profile tarun1Move.toml settings:
[package]
name = "Charity_app"
version = "0.1.0"
[dependencies]
AptosFramework = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/aptos-framework", rev = "mainnet" }
[addresses]
aptos_framework = "0x1"
CharityModule = "0xf9ac9420e52ca2ffb2b157cb0340ed8ec2b4ba4bb9b73666422ad64e42287b71"To test locally without deploying:
aptos move testError: "address 'aptos_framework' is not assigned a value"
- Solution: Ensure
Move.tomlhas the correct[addresses]section withaptos_framework = "0x1"
Error: "Name of dependency declared does not match"
- Solution: Change dependency name to
AptosFrameworkinMove.toml
Error: "insufficient balance"
- Solution: Request more APT from the Aptos Faucet
- All donations are irreversible (by design)
- Only the campaign creator's address stores the campaign data
- APT tokens are transferred directly on-chain
- Multi-sig approval for campaign creation
- Withdrawal mechanisms for organizers
- Campaign expiration dates
- Refund logic if target not met
- Campaign categorization/tags
MIT
Tarun Gangwar
Questions? Refer to the Aptos official documentation or community Discord.
