Payra is a solana program that enables small groups to split expenses and manage shared funds. It functions as a mini-DAO system designed for friend groups and communities who need transparent and automated fund distribution when managing shared expenses.
Note
Payra was built as the capstone project of Alok for Q3 Builders Turbin3 Cohort. More code of the program can be found here
Program ID: pAYrAkZHxebd89ojqt8pu9fBF8HWfiAcdqs8QFzk6dt
Deployer: GL2QboU6NtwzRyUMx7KNXM9sR23VTXAcd1qkKUHbJDfE
(alok8bb.sol)
Payra currently implements expense splitting with democratic voting mechanisms. Future development includes fractionalized NFT functionality. The program enables groups to:
- Create contribution events with funding targets and deadlines
- Manage who can participate and track their contributions
- Propose expenses with custom spending distributions
- Vote on proposals as a group
- Automatically settle approved expenses and distribute funds
This represents a shared activity or expense pool that the group is managing.
- Creator: The person who started the event
- Target Amount: How much funding the group wants to raise
- Deadline: When contributions and activities need to be completed
- Whitelist: Up to 10 approved participant wallets
- Withdraw Account: Where approved expenses get sent
Each person's individual account that tracks their involvement in an event.
- PDA Derivation:
["participant", event_id, wallet_pubkey]
- Contribution Tracking: How much this person has put in
- Spending Tracking: How much has been spent on their behalf
- Net Balance: Final settlement amount (positive means they should get money back, negative means they owe money)
How the group makes spending decisions through voting.
- Types: Regular spending proposals and final event settlement proposals
- Voting Period: Groups can set deadlines for when votes need to be collected
- Approval Logic: Needs at least 50% yes votes from eligible voters
- Spending Distribution: Customize what percentage each participant pays
// Event PDA
seeds = [b"event", event_id.to_le_bytes()]
// Participant PDA
seeds = [b"participant", event_id.to_le_bytes(), wallet_pubkey]
// Proposal PDA
seeds = [b"proposal", event_key, proposal_id.to_le_bytes()]
- Who Can Vote: Event creator plus everyone on the whitelist
- When to Settle: Either the deadline has passed OR everyone has voted
- Approval Threshold: At least 50% yes votes from eligible voters
- Create events with custom funding targets, deadlines, and payout accounts
- Manage participant lists (up to 10 people can join)
- Events automatically close when the deadline is reached and target isn't met
- Events stay open when the funding target is achieved
- Accept SPL token contributions into secure event vaults
- Participant accounts are created automatically when someone contributes
- Track individual and total contributions in real time
- Contributions are only accepted before the deadline
- Create spending proposals with detailed expense breakdowns
- Simple yes/no voting system for all participants
- Proposals get settled automatically after the voting period
- Support for regular spending proposals and final event settlement
- Funds are automatically sent to designated accounts when proposals pass
- Expenses are split proportionally based on the proposal percentages
- The system calculates everyone's final balance (what they contributed minus what they spent)
- Built-in protection against math errors and overflows
- Account verification to prevent fake accounts
- Only whitelisted participants can vote and contribute
- Strict deadline and timing checks
- Clear error messages when something goes wrong
Great for managing shared costs among friends:
- Group trips and hotel bookings
- Shared meals and entertainment
- Event planning and activities
- Keeping track of who owes what
Perfect for small community initiatives:
- Funding local events
- Buying shared resources
- Making group investment decisions
- Fair fund allocation
For example, the withdraw account can be set to a KAST.com wallet address, so when expenses are approved, the funds go directly to where they can be spent in the real world.
- initialize: Set up the global event counter
- create_event: Start a new contribution event
- whitelist: Add people to an event
- contribute: Add funds to an event vault
- create_proposal: Suggest how to spend money with custom splits
- vote: Cast yes/no votes on proposals
- settle_proposal: Execute approved proposals and send funds out
- create_settle_proposal: Propose wrapping up the entire event
- settle_event: Calculate everyone's final balances
- close_event: Close events that didn't reach their targets
# Run all tests
yarn test
# Run specific test file
yarn run ts-mocha tests/active/event-management.ts
yarn run ts-mocha tests/proposal/proposal-accept.ts
- Fractionalized NFTs: Let groups share ownership of digital assets
- Advanced Settlement Options: Partial payouts and milestone-based settlements
- Integration APIs: Better connections with external payment services
-
Clone the repository
git clone https://github.com/alok8bb/payra cd payra-capstone
-
Install dependencies
yarn install
-
Build the program
anchor build
-
Run tests
anchor test