From 76da5eadd600d4566daae0fe78e92607d07579cd Mon Sep 17 00:00:00 2001 From: Pileks Date: Wed, 13 May 2026 18:45:54 +0200 Subject: [PATCH 1/7] add additional fields to events in ppv2/mintgov --- programs/mint_governor/src/events.rs | 1 + .../src/instructions/remove_mint_authority.rs | 1 + programs/performance_package_v2/src/events.rs | 7 +++ .../instructions/close_performance_package.rs | 4 +- .../src/instructions/execute_change.rs | 1 + .../initialize_performance_package.rs | 3 + .../src/instructions/start_unlock.rs | 2 + .../src/state/performance_package.rs | 9 +++ .../mint_governor/v0.7/types/mint_governor.ts | 10 ++++ .../v0.7/types/index.ts | 29 +++++++++- .../v0.7/types/performance_package_v2.ts | 58 +++++++++++++++++++ 11 files changed, 123 insertions(+), 2 deletions(-) diff --git a/programs/mint_governor/src/events.rs b/programs/mint_governor/src/events.rs index f38f95552..cb902adc0 100644 --- a/programs/mint_governor/src/events.rs +++ b/programs/mint_governor/src/events.rs @@ -60,6 +60,7 @@ pub struct MintAuthorityRemovedEvent { pub mint_governor: Pubkey, pub authorized_minter: Pubkey, pub total_minted: u64, + pub mint_authority: Pubkey, } #[event] diff --git a/programs/mint_governor/src/instructions/remove_mint_authority.rs b/programs/mint_governor/src/instructions/remove_mint_authority.rs index bcb0cebe5..33e7244a6 100644 --- a/programs/mint_governor/src/instructions/remove_mint_authority.rs +++ b/programs/mint_governor/src/instructions/remove_mint_authority.rs @@ -49,6 +49,7 @@ impl RemoveMintAuthority<'_> { mint_governor: mint_governor.key(), authorized_minter: mint_authority.authorized_minter, total_minted: mint_authority.total_minted, + mint_authority: mint_authority.key(), }); // Mint authority account gets closed using close constraint diff --git a/programs/performance_package_v2/src/events.rs b/programs/performance_package_v2/src/events.rs index 77900db56..0915445e4 100644 --- a/programs/performance_package_v2/src/events.rs +++ b/programs/performance_package_v2/src/events.rs @@ -21,6 +21,9 @@ pub struct PerformancePackageCreatedEvent { pub recipient: Pubkey, pub create_key: Pubkey, pub pda_bump: u8, + pub oracle_reader: OracleReader, + pub reward_function: RewardFunction, + pub min_unlock_timestamp: i64, } /// Emitted by: `start_unlock` @@ -29,6 +32,8 @@ pub struct UnlockStartedEvent { pub common: CommonFields, pub performance_package: Pubkey, pub start_time: i64, + /// Mirrors `UnlockCompletedEvent.oracle_value`. + pub start_oracle_value: u128, } /// Emitted by: `complete_unlock` @@ -74,6 +79,8 @@ pub struct ChangeExecutedEvent { pub new_recipient: Option, pub new_oracle_reader: Option, pub new_reward_function: Option, + /// The ChangeRequest PDA that was executed (and closed) by this instruction + pub change_request: Pubkey, } /// Emitted by: `close_performance_package` diff --git a/programs/performance_package_v2/src/instructions/close_performance_package.rs b/programs/performance_package_v2/src/instructions/close_performance_package.rs index 9c885f44d..dc8b3a6b1 100644 --- a/programs/performance_package_v2/src/instructions/close_performance_package.rs +++ b/programs/performance_package_v2/src/instructions/close_performance_package.rs @@ -49,9 +49,11 @@ impl ClosePerformancePackage<'_> { } pub fn handle(ctx: Context) -> Result<()> { - let pp = &ctx.accounts.performance_package; + let pp = &mut ctx.accounts.performance_package; let clock = Clock::get()?; + pp.seq_num += 1; + emit_cpi!(PerformancePackageClosedEvent { common: CommonFields { slot: clock.slot, diff --git a/programs/performance_package_v2/src/instructions/execute_change.rs b/programs/performance_package_v2/src/instructions/execute_change.rs index ff11e11c9..5336bb428 100644 --- a/programs/performance_package_v2/src/instructions/execute_change.rs +++ b/programs/performance_package_v2/src/instructions/execute_change.rs @@ -111,6 +111,7 @@ impl ExecuteChange<'_> { new_recipient: cr.new_recipient, new_oracle_reader: cr.new_oracle_reader.clone(), new_reward_function: cr.new_reward_function.clone(), + change_request: ctx.accounts.change_request.key(), }); // The change_request account is closed automatically via the `close = rent_destination` constraint diff --git a/programs/performance_package_v2/src/instructions/initialize_performance_package.rs b/programs/performance_package_v2/src/instructions/initialize_performance_package.rs index a8345e936..0beba0f4e 100644 --- a/programs/performance_package_v2/src/instructions/initialize_performance_package.rs +++ b/programs/performance_package_v2/src/instructions/initialize_performance_package.rs @@ -96,6 +96,9 @@ impl InitializePerformancePackage<'_> { recipient: pp.recipient, create_key: pp.create_key, pda_bump: pp.bump, + oracle_reader: pp.oracle_reader.clone(), + reward_function: pp.reward_function.clone(), + min_unlock_timestamp: pp.min_unlock_timestamp, }); Ok(()) diff --git a/programs/performance_package_v2/src/instructions/start_unlock.rs b/programs/performance_package_v2/src/instructions/start_unlock.rs index f20db405d..8b5f6b9e6 100644 --- a/programs/performance_package_v2/src/instructions/start_unlock.rs +++ b/programs/performance_package_v2/src/instructions/start_unlock.rs @@ -51,6 +51,7 @@ impl StartUnlock<'_> { // Record start snapshot (no-op for Time oracle, reads AMM for FutarchyTwap) pp.oracle_reader.record_start(ctx.remaining_accounts)?; + let start_oracle_value = pp.oracle_reader.start_snapshot(); // Transition to Unlocking status pp.status = PackageStatus::Unlocking; @@ -68,6 +69,7 @@ impl StartUnlock<'_> { }, performance_package: pp.key(), start_time: clock.unix_timestamp, + start_oracle_value, }); Ok(()) diff --git a/programs/performance_package_v2/src/state/performance_package.rs b/programs/performance_package_v2/src/state/performance_package.rs index 6d73b033b..0221ba825 100644 --- a/programs/performance_package_v2/src/state/performance_package.rs +++ b/programs/performance_package_v2/src/state/performance_package.rs @@ -143,6 +143,15 @@ impl OracleReader { } } + /// Returns the start snapshot recorded by `record_start`. + /// 0 for `Time` (no snapshot); `start_value` for `FutarchyTwap`. + pub fn start_snapshot(&self) -> u128 { + match self { + OracleReader::Time => 0, + OracleReader::FutarchyTwap { start_value, .. } => *start_value, + } + } + /// Records the end snapshot when unlock completes. /// For Time oracle, this is a no-op since it just reads current time on demand. /// For FutarchyTwap, reads the accumulator from the Dao's spot pool oracle. diff --git a/sdk/src/mint_governor/v0.7/types/mint_governor.ts b/sdk/src/mint_governor/v0.7/types/mint_governor.ts index b2d9b02c2..b126ad79d 100644 --- a/sdk/src/mint_governor/v0.7/types/mint_governor.ts +++ b/sdk/src/mint_governor/v0.7/types/mint_governor.ts @@ -659,6 +659,11 @@ export type MintGovernor = { type: "u64"; index: false; }, + { + name: "mintAuthority"; + type: "publicKey"; + index: false; + }, ]; }, { @@ -1396,6 +1401,11 @@ export const IDL: MintGovernor = { type: "u64", index: false, }, + { + name: "mintAuthority", + type: "publicKey", + index: false, + }, ], }, { diff --git a/sdk/src/performance_package_v2/v0.7/types/index.ts b/sdk/src/performance_package_v2/v0.7/types/index.ts index e6c7d5bd6..25a6141ca 100644 --- a/sdk/src/performance_package_v2/v0.7/types/index.ts +++ b/sdk/src/performance_package_v2/v0.7/types/index.ts @@ -1,4 +1,4 @@ -import { IdlAccounts, IdlTypes } from "@coral-xyz/anchor"; +import { IdlAccounts, IdlEvents, IdlTypes } from "@coral-xyz/anchor"; import { PerformancePackageV2 as PerformancePackageV2Program, IDL as PerformancePackageV2IDL, @@ -17,3 +17,30 @@ export type PerformancePackageV2PackageStatus = IdlTypes["PackageStatus"]; export type PerformancePackageV2ThresholdTranche = IdlTypes["ThresholdTranche"]; + +// Event aliases are prefixed because several event names (UnlockStartedEvent, +// UnlockCompletedEvent, ChangeProposedEvent, ChangeExecutedEvent) collide with +// the v1 `price_based_performance_package` module, which also re-exports them +// unqualified from the package root. +export type PerformancePackageV2CreatedEvent = + IdlEvents["PerformancePackageCreatedEvent"]; +export type PerformancePackageV2UnlockStartedEvent = + IdlEvents["UnlockStartedEvent"]; +export type PerformancePackageV2UnlockCompletedEvent = + IdlEvents["UnlockCompletedEvent"]; +export type PerformancePackageV2AuthorityChangedEvent = + IdlEvents["AuthorityChangedEvent"]; +export type PerformancePackageV2ChangeProposedEvent = + IdlEvents["ChangeProposedEvent"]; +export type PerformancePackageV2ChangeExecutedEvent = + IdlEvents["ChangeExecutedEvent"]; +export type PerformancePackageV2ClosedEvent = + IdlEvents["PerformancePackageClosedEvent"]; +export type PerformancePackageV2Event = + | PerformancePackageV2CreatedEvent + | PerformancePackageV2UnlockStartedEvent + | PerformancePackageV2UnlockCompletedEvent + | PerformancePackageV2AuthorityChangedEvent + | PerformancePackageV2ChangeProposedEvent + | PerformancePackageV2ChangeExecutedEvent + | PerformancePackageV2ClosedEvent; diff --git a/sdk/src/performance_package_v2/v0.7/types/performance_package_v2.ts b/sdk/src/performance_package_v2/v0.7/types/performance_package_v2.ts index 0956ed645..6a5fafd31 100644 --- a/sdk/src/performance_package_v2/v0.7/types/performance_package_v2.ts +++ b/sdk/src/performance_package_v2/v0.7/types/performance_package_v2.ts @@ -744,6 +744,25 @@ export type PerformancePackageV2 = { type: "u8"; index: false; }, + { + name: "oracleReader"; + type: { + defined: "OracleReader"; + }; + index: false; + }, + { + name: "rewardFunction"; + type: { + defined: "RewardFunction"; + }; + index: false; + }, + { + name: "minUnlockTimestamp"; + type: "i64"; + index: false; + }, ]; }, { @@ -766,6 +785,11 @@ export type PerformancePackageV2 = { type: "i64"; index: false; }, + { + name: "startOracleValue"; + type: "u128"; + index: false; + }, ]; }, { @@ -934,6 +958,11 @@ export type PerformancePackageV2 = { }; index: false; }, + { + name: "changeRequest"; + type: "publicKey"; + index: false; + }, ]; }, { @@ -1814,6 +1843,25 @@ export const IDL: PerformancePackageV2 = { type: "u8", index: false, }, + { + name: "oracleReader", + type: { + defined: "OracleReader", + }, + index: false, + }, + { + name: "rewardFunction", + type: { + defined: "RewardFunction", + }, + index: false, + }, + { + name: "minUnlockTimestamp", + type: "i64", + index: false, + }, ], }, { @@ -1836,6 +1884,11 @@ export const IDL: PerformancePackageV2 = { type: "i64", index: false, }, + { + name: "startOracleValue", + type: "u128", + index: false, + }, ], }, { @@ -2004,6 +2057,11 @@ export const IDL: PerformancePackageV2 = { }, index: false, }, + { + name: "changeRequest", + type: "publicKey", + index: false, + }, ], }, { From de2ed88457bc73ff87478d57983266fb56ebf226 Mon Sep 17 00:00:00 2001 From: Pileks Date: Wed, 13 May 2026 18:51:48 +0200 Subject: [PATCH 2/7] add pp_created_at_timestamp for ppv2 account delineation --- programs/performance_package_v2/src/events.rs | 2 ++ .../src/instructions/propose_change.rs | 1 + .../v0.7/types/performance_package_v2.ts | 10 ++++++++++ 3 files changed, 13 insertions(+) diff --git a/programs/performance_package_v2/src/events.rs b/programs/performance_package_v2/src/events.rs index 0915445e4..e899e6e56 100644 --- a/programs/performance_package_v2/src/events.rs +++ b/programs/performance_package_v2/src/events.rs @@ -68,6 +68,8 @@ pub struct ChangeProposedEvent { pub new_recipient: Option, pub new_oracle_reader: Option, pub new_reward_function: Option, + /// `PerformancePackage.created_at_timestamp` as stamped onto the ChangeRequest + pub pp_created_at_timestamp: i64, } /// Emitted by: `execute_change` diff --git a/programs/performance_package_v2/src/instructions/propose_change.rs b/programs/performance_package_v2/src/instructions/propose_change.rs index 2ca0b352e..6d968ac86 100644 --- a/programs/performance_package_v2/src/instructions/propose_change.rs +++ b/programs/performance_package_v2/src/instructions/propose_change.rs @@ -108,6 +108,7 @@ impl ProposeChange<'_> { new_recipient: args.new_recipient, new_oracle_reader: args.new_oracle_reader, new_reward_function: args.new_reward_function, + pp_created_at_timestamp: pp.created_at_timestamp, }); Ok(()) diff --git a/sdk/src/performance_package_v2/v0.7/types/performance_package_v2.ts b/sdk/src/performance_package_v2/v0.7/types/performance_package_v2.ts index 6a5fafd31..97214c5fc 100644 --- a/sdk/src/performance_package_v2/v0.7/types/performance_package_v2.ts +++ b/sdk/src/performance_package_v2/v0.7/types/performance_package_v2.ts @@ -911,6 +911,11 @@ export type PerformancePackageV2 = { }; index: false; }, + { + name: "ppCreatedAtTimestamp"; + type: "i64"; + index: false; + }, ]; }, { @@ -2010,6 +2015,11 @@ export const IDL: PerformancePackageV2 = { }, index: false, }, + { + name: "ppCreatedAtTimestamp", + type: "i64", + index: false, + }, ], }, { From 2e5fc943a9141b7d2151e6e95a809a3d5ac9b670 Mon Sep 17 00:00:00 2001 From: Pileks Date: Wed, 13 May 2026 20:02:24 +0200 Subject: [PATCH 3/7] bump sdk --- sdk/package.json | 2 +- yarn.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/package.json b/sdk/package.json index 775a0ed1e..d176b8d4d 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@metadaoproject/programs", - "version": "0.1.0-alpha.2", + "version": "0.1.0-alpha.3", "type": "module", "main": "dist/index.js", "module": "dist/index.js", diff --git a/yarn.lock b/yarn.lock index 3f05b3875..8128e9450 100644 --- a/yarn.lock +++ b/yarn.lock @@ -865,7 +865,7 @@ "@jridgewell/sourcemap-codec" "^1.4.10" "@metadaoproject/programs@./sdk": - version "0.1.0-alpha.2" + version "0.1.0-alpha.3" dependencies: "@coral-xyz/anchor" "^0.29.0" "@noble/hashes" "^1.4.0" From c372a2f5ba5b80942af8bc18740e5901491cac1b Mon Sep 17 00:00:00 2001 From: Pileks Date: Wed, 13 May 2026 21:21:42 +0200 Subject: [PATCH 4/7] add pp created at timestamp for unique pp identification --- programs/performance_package_v2/src/events.rs | 7 ++- .../src/instructions/change_authority.rs | 1 + .../instructions/close_performance_package.rs | 1 + .../src/instructions/complete_unlock.rs | 1 + .../src/instructions/execute_change.rs | 1 + .../initialize_performance_package.rs | 1 + .../src/instructions/start_unlock.rs | 1 + sdk/package.json | 2 +- .../v0.7/types/performance_package_v2.ts | 60 +++++++++++++++++++ yarn.lock | 2 +- 10 files changed, 74 insertions(+), 3 deletions(-) diff --git a/programs/performance_package_v2/src/events.rs b/programs/performance_package_v2/src/events.rs index e899e6e56..5357bc11a 100644 --- a/programs/performance_package_v2/src/events.rs +++ b/programs/performance_package_v2/src/events.rs @@ -24,6 +24,7 @@ pub struct PerformancePackageCreatedEvent { pub oracle_reader: OracleReader, pub reward_function: RewardFunction, pub min_unlock_timestamp: i64, + pub pp_created_at_timestamp: i64, } /// Emitted by: `start_unlock` @@ -32,8 +33,8 @@ pub struct UnlockStartedEvent { pub common: CommonFields, pub performance_package: Pubkey, pub start_time: i64, - /// Mirrors `UnlockCompletedEvent.oracle_value`. pub start_oracle_value: u128, + pub pp_created_at_timestamp: i64, } /// Emitted by: `complete_unlock` @@ -46,6 +47,7 @@ pub struct UnlockCompletedEvent { pub amount_minted: u64, /// Cumulative after this unlock pub total_rewards_paid_out: u64, + pub pp_created_at_timestamp: i64, } /// Emitted by: `change_authority` @@ -55,6 +57,7 @@ pub struct AuthorityChangedEvent { pub performance_package: Pubkey, pub old_authority: Pubkey, pub new_authority: Pubkey, + pub pp_created_at_timestamp: i64, } /// Emitted by: `propose_change` @@ -83,6 +86,7 @@ pub struct ChangeExecutedEvent { pub new_reward_function: Option, /// The ChangeRequest PDA that was executed (and closed) by this instruction pub change_request: Pubkey, + pub pp_created_at_timestamp: i64, } /// Emitted by: `close_performance_package` @@ -92,4 +96,5 @@ pub struct PerformancePackageClosedEvent { pub performance_package: Pubkey, /// Final cumulative amount paid pub total_rewards_paid_out: u64, + pub pp_created_at_timestamp: i64, } diff --git a/programs/performance_package_v2/src/instructions/change_authority.rs b/programs/performance_package_v2/src/instructions/change_authority.rs index 80c558f39..aacc5b5ee 100644 --- a/programs/performance_package_v2/src/instructions/change_authority.rs +++ b/programs/performance_package_v2/src/instructions/change_authority.rs @@ -47,6 +47,7 @@ impl ChangeAuthority<'_> { performance_package: pp.key(), old_authority: ctx.accounts.authority.key(), new_authority, + pp_created_at_timestamp: pp.created_at_timestamp, }); Ok(()) diff --git a/programs/performance_package_v2/src/instructions/close_performance_package.rs b/programs/performance_package_v2/src/instructions/close_performance_package.rs index dc8b3a6b1..72e4856d7 100644 --- a/programs/performance_package_v2/src/instructions/close_performance_package.rs +++ b/programs/performance_package_v2/src/instructions/close_performance_package.rs @@ -62,6 +62,7 @@ impl ClosePerformancePackage<'_> { }, performance_package: pp.key(), total_rewards_paid_out: pp.total_rewards_paid_out, + pp_created_at_timestamp: pp.created_at_timestamp, }); // The performance_package account is closed automatically via the `close = rent_destination` constraint diff --git a/programs/performance_package_v2/src/instructions/complete_unlock.rs b/programs/performance_package_v2/src/instructions/complete_unlock.rs index 4f8a7e980..43bb0a40d 100644 --- a/programs/performance_package_v2/src/instructions/complete_unlock.rs +++ b/programs/performance_package_v2/src/instructions/complete_unlock.rs @@ -163,6 +163,7 @@ impl CompleteUnlock<'_> { recipient: pp.recipient, amount_minted: mint_amount, total_rewards_paid_out: pp.total_rewards_paid_out, + pp_created_at_timestamp: pp.created_at_timestamp, }); Ok(()) diff --git a/programs/performance_package_v2/src/instructions/execute_change.rs b/programs/performance_package_v2/src/instructions/execute_change.rs index 5336bb428..1b76fba94 100644 --- a/programs/performance_package_v2/src/instructions/execute_change.rs +++ b/programs/performance_package_v2/src/instructions/execute_change.rs @@ -112,6 +112,7 @@ impl ExecuteChange<'_> { new_oracle_reader: cr.new_oracle_reader.clone(), new_reward_function: cr.new_reward_function.clone(), change_request: ctx.accounts.change_request.key(), + pp_created_at_timestamp: pp.created_at_timestamp, }); // The change_request account is closed automatically via the `close = rent_destination` constraint diff --git a/programs/performance_package_v2/src/instructions/initialize_performance_package.rs b/programs/performance_package_v2/src/instructions/initialize_performance_package.rs index 0beba0f4e..4d0754798 100644 --- a/programs/performance_package_v2/src/instructions/initialize_performance_package.rs +++ b/programs/performance_package_v2/src/instructions/initialize_performance_package.rs @@ -99,6 +99,7 @@ impl InitializePerformancePackage<'_> { oracle_reader: pp.oracle_reader.clone(), reward_function: pp.reward_function.clone(), min_unlock_timestamp: pp.min_unlock_timestamp, + pp_created_at_timestamp: pp.created_at_timestamp, }); Ok(()) diff --git a/programs/performance_package_v2/src/instructions/start_unlock.rs b/programs/performance_package_v2/src/instructions/start_unlock.rs index 8b5f6b9e6..7c667654f 100644 --- a/programs/performance_package_v2/src/instructions/start_unlock.rs +++ b/programs/performance_package_v2/src/instructions/start_unlock.rs @@ -70,6 +70,7 @@ impl StartUnlock<'_> { performance_package: pp.key(), start_time: clock.unix_timestamp, start_oracle_value, + pp_created_at_timestamp: pp.created_at_timestamp, }); Ok(()) diff --git a/sdk/package.json b/sdk/package.json index d176b8d4d..2fcb147b9 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@metadaoproject/programs", - "version": "0.1.0-alpha.3", + "version": "0.1.0-alpha.4", "type": "module", "main": "dist/index.js", "module": "dist/index.js", diff --git a/sdk/src/performance_package_v2/v0.7/types/performance_package_v2.ts b/sdk/src/performance_package_v2/v0.7/types/performance_package_v2.ts index 97214c5fc..64b030d7b 100644 --- a/sdk/src/performance_package_v2/v0.7/types/performance_package_v2.ts +++ b/sdk/src/performance_package_v2/v0.7/types/performance_package_v2.ts @@ -763,6 +763,11 @@ export type PerformancePackageV2 = { type: "i64"; index: false; }, + { + name: "ppCreatedAtTimestamp"; + type: "i64"; + index: false; + }, ]; }, { @@ -790,6 +795,11 @@ export type PerformancePackageV2 = { type: "u128"; index: false; }, + { + name: "ppCreatedAtTimestamp"; + type: "i64"; + index: false; + }, ]; }, { @@ -827,6 +837,11 @@ export type PerformancePackageV2 = { type: "u64"; index: false; }, + { + name: "ppCreatedAtTimestamp"; + type: "i64"; + index: false; + }, ]; }, { @@ -854,6 +869,11 @@ export type PerformancePackageV2 = { type: "publicKey"; index: false; }, + { + name: "ppCreatedAtTimestamp"; + type: "i64"; + index: false; + }, ]; }, { @@ -968,6 +988,11 @@ export type PerformancePackageV2 = { type: "publicKey"; index: false; }, + { + name: "ppCreatedAtTimestamp"; + type: "i64"; + index: false; + }, ]; }, { @@ -990,6 +1015,11 @@ export type PerformancePackageV2 = { type: "u64"; index: false; }, + { + name: "ppCreatedAtTimestamp"; + type: "i64"; + index: false; + }, ]; }, ]; @@ -1867,6 +1897,11 @@ export const IDL: PerformancePackageV2 = { type: "i64", index: false, }, + { + name: "ppCreatedAtTimestamp", + type: "i64", + index: false, + }, ], }, { @@ -1894,6 +1929,11 @@ export const IDL: PerformancePackageV2 = { type: "u128", index: false, }, + { + name: "ppCreatedAtTimestamp", + type: "i64", + index: false, + }, ], }, { @@ -1931,6 +1971,11 @@ export const IDL: PerformancePackageV2 = { type: "u64", index: false, }, + { + name: "ppCreatedAtTimestamp", + type: "i64", + index: false, + }, ], }, { @@ -1958,6 +2003,11 @@ export const IDL: PerformancePackageV2 = { type: "publicKey", index: false, }, + { + name: "ppCreatedAtTimestamp", + type: "i64", + index: false, + }, ], }, { @@ -2072,6 +2122,11 @@ export const IDL: PerformancePackageV2 = { type: "publicKey", index: false, }, + { + name: "ppCreatedAtTimestamp", + type: "i64", + index: false, + }, ], }, { @@ -2094,6 +2149,11 @@ export const IDL: PerformancePackageV2 = { type: "u64", index: false, }, + { + name: "ppCreatedAtTimestamp", + type: "i64", + index: false, + }, ], }, ], diff --git a/yarn.lock b/yarn.lock index 8128e9450..8ccd9545f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -865,7 +865,7 @@ "@jridgewell/sourcemap-codec" "^1.4.10" "@metadaoproject/programs@./sdk": - version "0.1.0-alpha.3" + version "0.1.0-alpha.4" dependencies: "@coral-xyz/anchor" "^0.29.0" "@noble/hashes" "^1.4.0" From 68791ef2a1883f8f58252aaff3798f3d84c7233d Mon Sep 17 00:00:00 2001 From: Pileks Date: Thu, 14 May 2026 22:56:26 +0200 Subject: [PATCH 5/7] add support for customizable position nft + different launchpad versions for meteora fee collection --- sdk/package.json | 2 +- sdk/src/futarchy/v0.6/FutarchyClient.ts | 18 ++++++++++++------ yarn.lock | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/sdk/package.json b/sdk/package.json index 2fcb147b9..33014621e 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@metadaoproject/programs", - "version": "0.1.0-alpha.4", + "version": "0.1.0-alpha.5", "type": "module", "main": "dist/index.js", "module": "dist/index.js", diff --git a/sdk/src/futarchy/v0.6/FutarchyClient.ts b/sdk/src/futarchy/v0.6/FutarchyClient.ts index 125843dff..ea76c6d9d 100644 --- a/sdk/src/futarchy/v0.6/FutarchyClient.ts +++ b/sdk/src/futarchy/v0.6/FutarchyClient.ts @@ -1011,6 +1011,8 @@ export class FutarchyClient { quoteMint = MAINNET_USDC, transactionIndex, meteoraConfig = LAUNCHPAD_V0_7_MAINNET_METEORA_CONFIG, + launchpadProgramId = LAUNCHPAD_V0_7_PROGRAM_ID, + positionNftMint = undefined, admin = this.provider.publicKey, }: { dao: PublicKey; @@ -1018,6 +1020,8 @@ export class FutarchyClient { quoteMint?: PublicKey; transactionIndex: bigint; meteoraConfig?: PublicKey; + launchpadProgramId?: PublicKey; + positionNftMint?: PublicKey; admin?: PublicKey; }) { // Squads accounts @@ -1068,18 +1072,20 @@ export class FutarchyClient { DAMM_V2_PROGRAM_ID, ); - const [positionNftMint] = PublicKey.findProgramAddressSync( - [Buffer.from("position_nft_mint"), baseMint.toBuffer()], - LAUNCHPAD_V0_7_PROGRAM_ID, - ); + const resolvedPositionNftMint = + positionNftMint ?? + PublicKey.findProgramAddressSync( + [Buffer.from("position_nft_mint"), baseMint.toBuffer()], + launchpadProgramId, + )[0]; const [positionNftAccount] = PublicKey.findProgramAddressSync( - [Buffer.from("position_nft_account"), positionNftMint.toBuffer()], + [Buffer.from("position_nft_account"), resolvedPositionNftMint.toBuffer()], DAMM_V2_PROGRAM_ID, ); const [position] = PublicKey.findProgramAddressSync( - [Buffer.from("position"), positionNftMint.toBuffer()], + [Buffer.from("position"), resolvedPositionNftMint.toBuffer()], DAMM_V2_PROGRAM_ID, ); diff --git a/yarn.lock b/yarn.lock index 8ccd9545f..a6f0dfa40 100644 --- a/yarn.lock +++ b/yarn.lock @@ -865,7 +865,7 @@ "@jridgewell/sourcemap-codec" "^1.4.10" "@metadaoproject/programs@./sdk": - version "0.1.0-alpha.4" + version "0.1.0-alpha.5" dependencies: "@coral-xyz/anchor" "^0.29.0" "@noble/hashes" "^1.4.0" From 02c8ef1319e744755dde083edbed88529d6c87d9 Mon Sep 17 00:00:00 2001 From: Pileks Date: Tue, 19 May 2026 15:54:35 -0700 Subject: [PATCH 6/7] update tests to prevent sudden duplicate transaction hashes --- tests/futarchy/unit/finalizeProposal.test.ts | 12 +++++++- tests/integration/fullLaunch.test.ts | 4 +++ tests/integration/fullLaunch_v7.test.ts | 3 ++ .../unit/completeUnlock.test.ts | 28 +++++++++++++++++++ .../unit/completeUnlock.test.ts | 7 +++++ 5 files changed, 53 insertions(+), 1 deletion(-) diff --git a/tests/futarchy/unit/finalizeProposal.test.ts b/tests/futarchy/unit/finalizeProposal.test.ts index cf2ea57d4..231c3c9e6 100644 --- a/tests/futarchy/unit/finalizeProposal.test.ts +++ b/tests/futarchy/unit/finalizeProposal.test.ts @@ -358,8 +358,18 @@ export default function suite() { "ProposalTooYoung", "proposal should not finalize before the deadline", ); + const storedProposalEarly = await this.futarchy.getProposal(proposal); await this.futarchy - .finalizeProposal(proposal) + .finalizeProposalIxV2({ + squadsProposal: storedProposalEarly.squadsProposal, + dao, + baseMint: META, + quoteMint: USDC, + }) + .preInstructions([ + ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 1 }), + ]) + .rpc() .then(earlyCallbacks[0], earlyCallbacks[1]); // Stop trading. Advance time past the proposal deadline (259,200s). diff --git a/tests/integration/fullLaunch.test.ts b/tests/integration/fullLaunch.test.ts index 4c756b6a5..b2914587c 100644 --- a/tests/integration/fullLaunch.test.ts +++ b/tests/integration/fullLaunch.test.ts @@ -1,4 +1,5 @@ import { + ComputeBudgetProgram, Keypair, PublicKey, Transaction, @@ -510,6 +511,9 @@ export default async function suite() { inputAmount: new BN(100 * 1_000_000), // 100 USDC minOutputAmount: new BN(0), }) + .preInstructions([ + ComputeBudgetProgram.setComputeUnitPrice({ microLamports: i }), + ]) .rpc(); } diff --git a/tests/integration/fullLaunch_v7.test.ts b/tests/integration/fullLaunch_v7.test.ts index 5687c10f7..e236370d0 100644 --- a/tests/integration/fullLaunch_v7.test.ts +++ b/tests/integration/fullLaunch_v7.test.ts @@ -585,6 +585,9 @@ export default async function suite() { inputAmount: new BN(100 * 1_000_000), // 100 USDC minOutputAmount: new BN(0), }) + .preInstructions([ + ComputeBudgetProgram.setComputeUnitPrice({ microLamports: i }), + ]) .rpc(); } diff --git a/tests/performancePackageV2/unit/completeUnlock.test.ts b/tests/performancePackageV2/unit/completeUnlock.test.ts index 1109dc15c..45d1b40d8 100644 --- a/tests/performancePackageV2/unit/completeUnlock.test.ts +++ b/tests/performancePackageV2/unit/completeUnlock.test.ts @@ -1,4 +1,5 @@ import { + ComputeBudgetProgram, Keypair, PublicKey, SystemProgram, @@ -285,6 +286,9 @@ export default function suite() { performancePackage, signer: recipient.publicKey, }) + .preInstructions([ + ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 1 }), + ]) .signers([recipient]) .rpc(); @@ -297,6 +301,9 @@ export default function suite() { recipient: recipient.publicKey, signer: authority.publicKey, }) + .preInstructions([ + ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 1 }), + ]) .signers([authority]) .rpc(); @@ -521,6 +528,9 @@ export default function suite() { performancePackage, signer: recipient.publicKey, }) + .preInstructions([ + ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 1 }), + ]) .signers([recipient]) .rpc(); @@ -704,6 +714,9 @@ export default function suite() { signer: authority.publicKey, dao, }) + .preInstructions([ + ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 1 }), + ]) .signers([authority]) .rpc(); @@ -790,6 +803,9 @@ export default function suite() { performancePackage, signer: recipient.publicKey, }) + .preInstructions([ + ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 1 }), + ]) .signers([recipient]) .rpc(); @@ -899,6 +915,9 @@ export default function suite() { performancePackage, signer: recipient.publicKey, }) + .preInstructions([ + ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 1 }), + ]) .signers([recipient]) .rpc(); @@ -914,6 +933,9 @@ export default function suite() { recipient: recipient.publicKey, signer: authority.publicKey, }) + .preInstructions([ + ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 1 }), + ]) .signers([authority]) .rpc(); @@ -933,6 +955,9 @@ export default function suite() { performancePackage, signer: recipient.publicKey, }) + .preInstructions([ + ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 2 }), + ]) .signers([recipient]) .rpc(); @@ -945,6 +970,9 @@ export default function suite() { recipient: recipient.publicKey, signer: authority.publicKey, }) + .preInstructions([ + ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 2 }), + ]) .signers([authority]) .rpc(); diff --git a/tests/priceBasedPerformancePackage/unit/completeUnlock.test.ts b/tests/priceBasedPerformancePackage/unit/completeUnlock.test.ts index fb5c4416d..e31845d32 100644 --- a/tests/priceBasedPerformancePackage/unit/completeUnlock.test.ts +++ b/tests/priceBasedPerformancePackage/unit/completeUnlock.test.ts @@ -4,6 +4,7 @@ import { Transaction, SystemProgram, TransactionInstruction, + ComputeBudgetProgram, } from "@solana/web3.js"; import { assert } from "chai"; import * as token from "@solana/spl-token"; @@ -242,6 +243,9 @@ export default function () { oracleAccount: oracleAccount.publicKey, recipient: recipient.publicKey, }) + .preInstructions([ + ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 1 }), + ]) .signers([recipient]) .rpc(); @@ -268,6 +272,9 @@ export default function () { tokenMint, tokenRecipient: recipient.publicKey, }) + .preInstructions([ + ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 1 }), + ]) .rpc(); const performancePackageAccount2 = From 15f44bb494c2552c44909348cf393a46dd53d1c7 Mon Sep 17 00:00:00 2001 From: Pileks Date: Tue, 19 May 2026 16:11:14 -0700 Subject: [PATCH 7/7] allow custom pool when attempting to withdraw DAMMv2 liquidity --- sdk/package.json | 2 +- sdk/src/futarchy/v0.6/FutarchyClient.ts | 31 +++++++++++++++++++------ yarn.lock | 2 +- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/sdk/package.json b/sdk/package.json index 33014621e..41b05d6ef 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@metadaoproject/programs", - "version": "0.1.0-alpha.5", + "version": "0.1.0-alpha.6", "type": "module", "main": "dist/index.js", "module": "dist/index.js", diff --git a/sdk/src/futarchy/v0.6/FutarchyClient.ts b/sdk/src/futarchy/v0.6/FutarchyClient.ts index ea76c6d9d..2468db649 100644 --- a/sdk/src/futarchy/v0.6/FutarchyClient.ts +++ b/sdk/src/futarchy/v0.6/FutarchyClient.ts @@ -1013,6 +1013,7 @@ export class FutarchyClient { meteoraConfig = LAUNCHPAD_V0_7_MAINNET_METEORA_CONFIG, launchpadProgramId = LAUNCHPAD_V0_7_PROGRAM_ID, positionNftMint = undefined, + pool = undefined, admin = this.provider.publicKey, }: { dao: PublicKey; @@ -1022,6 +1023,7 @@ export class FutarchyClient { meteoraConfig?: PublicKey; launchpadProgramId?: PublicKey; positionNftMint?: PublicKey; + pool?: PublicKey; admin?: PublicKey; }) { // Squads accounts @@ -1067,10 +1069,17 @@ export class FutarchyClient { const [sortedMint1, sortedMint2] = sortMints(baseMint, quoteMint); // Meteora DAMM accounts - const [pool] = PublicKey.findProgramAddressSync( - [Buffer.from("pool"), meteoraConfig.toBuffer(), sortedMint1, sortedMint2], - DAMM_V2_PROGRAM_ID, - ); + const resolvedPool = + pool ?? + PublicKey.findProgramAddressSync( + [ + Buffer.from("pool"), + meteoraConfig.toBuffer(), + sortedMint1, + sortedMint2, + ], + DAMM_V2_PROGRAM_ID, + )[0]; const resolvedPositionNftMint = positionNftMint ?? @@ -1090,12 +1099,20 @@ export class FutarchyClient { ); const [tokenAVault] = PublicKey.findProgramAddressSync( - [Buffer.from("token_vault"), baseMint.toBuffer(), pool.toBuffer()], + [ + Buffer.from("token_vault"), + baseMint.toBuffer(), + resolvedPool.toBuffer(), + ], DAMM_V2_PROGRAM_ID, ); const [tokenBVault] = PublicKey.findProgramAddressSync( - [Buffer.from("token_vault"), quoteMint.toBuffer(), pool.toBuffer()], + [ + Buffer.from("token_vault"), + quoteMint.toBuffer(), + resolvedPool.toBuffer(), + ], DAMM_V2_PROGRAM_ID, ); @@ -1113,7 +1130,7 @@ export class FutarchyClient { dammV2Program: DAMM_V2_PROGRAM_ID, dammV2EventAuthority, poolAuthority: DAMM_V2_POOL_AUTHORITY, - pool, + pool: resolvedPool, position, tokenAAccount: baseTokenAccount, tokenBAccount: quoteTokenAccount, diff --git a/yarn.lock b/yarn.lock index a6f0dfa40..0915209d9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -865,7 +865,7 @@ "@jridgewell/sourcemap-codec" "^1.4.10" "@metadaoproject/programs@./sdk": - version "0.1.0-alpha.5" + version "0.1.0-alpha.6" dependencies: "@coral-xyz/anchor" "^0.29.0" "@noble/hashes" "^1.4.0"