A gym with a built-in incentive to actually come and train.
Realized on the Solana blockchain.
Best explanation is here
{
member_month: 7, // the last month the user paid for, 7 = July 2023
num_avail: 4 // the number of available rewards for user in this month, range: 0-4, 1 reward = $10
}
start_membership
- Simulates the user purchasing the membership for another month
- Increments
member_month
- Resets
num_avail
to4
- The user must transfer $120 USDC to a PDA
- Sample transaction
claim_reward
- Only valid if
num_avail
is still > 0 - In that case, it is decremented and $10 are sent back to the user as cashback
- Only valid if
reset_user
- For testing purposes
- Sets
member_month
andnum_avail
to0
, essentially cancelling the membership - All of the USDC that is stored in the respective PDA is transferred back to them
- Source code of the Solana Program
- On mainnet: 7bd3GWaR7h5X6ZAndStp9vD5NbQY5a7V9Q6UMMCm3tCd