Gated mint program#456
Open
pileks wants to merge 12 commits intopileks/launchpad-v8from
Open
Conversation
…/met-339-private-token
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduces
gated_mint, a new program that gates an SPL Mint behind an admin-managed whitelist by holding the mint's freeze authority. Whitelisted users move tokens throughgated_invoke, which thaws relevant token accounts before a CPI into a whitelisted target program and re-freezes them after. Couples intov08_launchpad: any base mint with a freeze authority must point it at the deterministicgated_mint_configPDA.This PR stacks on
pileks/launchpad-v8; the launchpad_v8 program/SDK/tests are part of this diff against develop but land via that PR. The net new scope here is thegated_mintprogram, its SDK module, its tests, and the 19-line freeze-authority check ininitialize_launch.Instructions
initialize_gated_mintgated_mint_configPDA (seed["gated_mint_config", mint]) viaset_authorityCPI; stores per-mintadmin.add_whitelisted_userWhitelistedUserPDA at["whitelisted_user", mint, user].gated_invokeminttoken account inremaining_accounts, thaws if frozen, runsinvokeontarget_program(must be inWHITELISTED_PROGRAMS, must not begated_mint::ID), then re-freezes any account left inInitializedstate.disable_gatinggated_invokeandadd_whitelisted_user, unlocks permissionlessthaw_account.thaw_accountdisable_gating; thaws a single token account of the gated mint.Other Changes
v08_launchpad::initialize_launchnow requires that, ifbase_mint.freeze_authorityis set, it equals the canonicalgated_mint_configPDA derived frombase_mint. This is a pure on-chainfind_program_addresscheck, no CPI intogated_mint. Mints without a freeze authority continue to work unchanged.@metadaoproject/programs/gated_mint(v0.1) module withGatedMintClient, PDA helpers, and generated types; re-exported from the package root.gated_mintinstruction plustests/integration/gatedLaunchpadV8.test.tsexercising the full lifecycle: init gated mint → init/start/fund/settle launchpad_v8 launch → claim (frozen ATAs thawed and re-frozen viagated_invoke) → disable gating → permissionlessthaw_account.