wen-community / wen-program-library

Apache License 2.0
87 stars 18 forks source link

Set up for Migration #69

Open balmy-gazebo opened 2 months ago

balmy-gazebo commented 2 months ago

When Solana unlocks the Group and Member accounts on Mainnet, we will want to transition the group member structure in WNS to the native Solana Group/Member accounts.

I propose we knock this out in stages:

Stage 1: Write Migrate Instructions + Tests migrate_group.rs - Migrate a group by passing in the existing WNS-owned group account and Group mint. Initialize the extra space in the Mint account with the Mint Authority still the Manager account. Re-assign the group max_size. Update the GroupPointer in the Mint account to now point to itself as the group. The group's size should be 0 as this must be set via the addition of mint's to the Group. The update_authority should be the same as the original WNS Group. Leave GroupAccount untouched. WEN will front the SOL for the group accounts and recoup it in the closing of these accounts later. Set Mint Auth to None. migrate_member.rs - Migrate a member by passing in the existing WNS-owned member account, create a GroupMember account on the mint, point group at the group mint now, point mint at itself, member number should be the same as it was in the original WNS Member account. Once that's all done, should close the WNS GroupMember account. Set Mint Auth to None. complete_group_migration.rs - Verify that the WNS Group mint group_size is equal to the WNS Group group_size. If so, everything should be migrated, can close the WNS group account. tests/wen_migrate_group_members.rs - Run the full migration on localnet NFTs

Stage 2: Prepare community Anyone who has WNS integrated into their protocol and is looking directly at the WNS group/member accounts or in their Frontend should be prepared to migrate it.

Stage 3: Clean up

Stage 4: Run + Validate Migration fetch_groups.ts - Run a getPA on all group Accounts in WNS. Write these mints to a csv file. migrate_group.ts - Should be a script that can be called per Group mint, loading all mints in the group by mapping GroupMember accounts back to the Group and ultimately Group Mint. The migrate_group instruction should be called on the group mint. Once confirmed, each mint should be migrated individually. migrate_groups.ts - Read the group mints CSV and run migrate_group on each, validate before running migrate that the group still exists incase the script needs to be restarted at some point. validate_migration.ts - Should attempt a getPA on Group and GroupMember accounts in WNS, if the migration properly happened, all accounts should be deleted or invalid.

Stage 5: Update Contract Merge Stage 3 into main and deploy stable versions of Contract and SDKs.

ghulamMustafaRaza commented 1 month ago

what's the expected timeline on looks like on Solana Labs side, of enabling it?

balmy-gazebo commented 1 month ago

Most recent date I've heard is mid-June, but there's no hard deadline for launch