Gated mint program#456
Merged
Merged
Conversation
…e proposal has already passed but not been finalized yet
…AOproject/programs into pileks/met-5-optimistic-governance
… optimistic governance proposal
…/met-339-private-token
Contributor
|
Repository Guard
Repository GuardCargo dependency pinning
Cross-program Anchor/Solana version consistency
solana-program crate pin
Anchor.toml solana_version
Crate minimum age
Yarn package.json pinning
npm minimum age
Workflow toolchain consistency
GitHub Action SHA pinning
Sensitive program / config changes
Overall status: pass Lockfile freshness (Cargo.lock + yarn.lock) is checked by the workflow directly and cannot be bypassed. The sensitive-diff section is a review hint - CODEOWNERS handles the actual merge gate. |
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.The
gated_mint_configPDA stores two authorities: a privilegedadmin(set once at init, controls everything) and an optionalwhitelist_admin(a delegated role that can only add whitelisted users). The admin can rotate or clear the whitelist_admin at any time.Instructions
initialize_gated_mintgated_mint_configPDA (seed["gated_mint_config", mint]) viaset_authorityCPI; stores per-mintadminand an optionalwhitelist_admin(must differ fromadmin).add_whitelisted_useradminor the configuredwhitelist_admin; creates aWhitelistedUserPDA at["whitelisted_user", mint, user].set_whitelist_adminwhitelist_adminongated_mint_config. New value must differ fromadmin. Blocked oncegating_disabledis true.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_invoke,add_whitelisted_user, andset_whitelist_admin, 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 (includingset_whitelist_admincoverage and whitelist_admin-signed paths inadd_whitelisted_user) 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.