A smart contract designed to enable collective philanthropy on the Asset Hub. Donors come together, contribute funds, and vote—anonymously—for which registered non-profit should receive the donations. Fair, private, and decentralized giving.
This contract enables:
- ✅ Individuals to donate Asset Hub tokens
- ✅ Anonymous voting using a commitment scheme
- ✅ Non-profits to receive funds based on votes
- ✅ Only the contract owner can register non-profits
-
Registration
The contract owner registers trusted non-profit organizations, each linked to a unique address. -
Donations
Any user can donate Asset Hub registered tokens to the contract. -
Anonymous Voting
Donors submit a vote commitment hash during the voting phase. This hides their real vote. -
Vote Reveal
After the voting period ends, donors reveal their votes using the original values that match their hash. -
Distribution
Funds are automatically distributed based on the percentage of revealed votes for each charity.
- Only the contract owner can register non-profit organizations
- Users can donate Asset Hub tokens
- Users can submit a hashed vote commitment
- Users can reveal their vote after a specific period
- Funds are distributed proportionally to vote results
-
Commit Phase:
Donors send a hashed vote (e.g.,hash(vote || secret)) to keep their choice private. -
Reveal Phase:
Donors reveal their originalvoteandsecret. The contract verifies the hash and counts the vote. -
Tally & Distribute:
After the reveal phase ends, funds are distributed to the non-profits based on the number of valid revealed votes.