Getting Started
- Fork the repository: https://github.com/JointSave-org/Joint_Save
- Clone your fork:
git clone https://github.com/<your-username>/Joint_Save.git
cd Joint_Save
- Create a new branch:
git checkout -b feat/self-service-leave-pool
Overview
Checked all three pool contracts and confirmed remove_member exists everywhere, but always requires admin.require_auth() — there's no equivalent function a regular member can call themselves to leave a pool. Right now, the only way to exit a pool is to ask the admin to remove you, which is awkward and puts unnecessary friction (and unnecessary trust) on a basic, expected action.
Requirements
Smart Contract Changes (all three pool types)
- Add a
leave_pool(env: Env, member: Address) function, requiring member.require_auth() (the member authorizes themselves, no admin involved)
- For Rotational: should follow the same round-shifting logic already used by
remove_member (don't duplicate the math — consider extracting a shared internal helper both functions call)
- For Target: should only be allowed before the pool is unlocked, consistent with the existing
remove_member restriction
- For Flexible: should refund the member's balance, same as
remove_member
- Consider whether the current beneficiary in a Rotational pool should be allowed to leave mid-round, or whether that needs a restriction (discuss in the PR if you think a guard is needed)
Frontend Changes
- Add a "Leave Pool" button in
group-actions.tsx, visible only to non-admin members (i.e. hidden for the pool's own creator/admin, who should use a different flow if they want to step back)
- Confirmation dialog before leaving, warning about any consequences (e.g. losing your spot in a rotational pool's order)
Acceptance Criteria
Getting Started
Overview
Checked all three pool contracts and confirmed
remove_memberexists everywhere, but always requiresadmin.require_auth()— there's no equivalent function a regular member can call themselves to leave a pool. Right now, the only way to exit a pool is to ask the admin to remove you, which is awkward and puts unnecessary friction (and unnecessary trust) on a basic, expected action.Requirements
Smart Contract Changes (all three pool types)
leave_pool(env: Env, member: Address)function, requiringmember.require_auth()(the member authorizes themselves, no admin involved)remove_member(don't duplicate the math — consider extracting a shared internal helper both functions call)remove_memberrestrictionremove_memberFrontend Changes
group-actions.tsx, visible only to non-admin members (i.e. hidden for the pool's own creator/admin, who should use a different flow if they want to step back)Acceptance Criteria
leave_pooland successfully exit without any admin involvementremove_memberrather than re-implementing it)