Skip to content

Commit 7f0bef4

Browse files
committed
chore: add it
1 parent 8d92b51 commit 7f0bef4

File tree

6 files changed

+123
-7
lines changed

6 files changed

+123
-7
lines changed

governance/xc_admin/packages/xc_admin_cli/src/index.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ import {
4747
idlSetBuffer,
4848
isPriceStorePublisherInitialized,
4949
lazerIdl,
50+
integrityPoolIdl,
51+
INTEGRITY_POOL_PROGRAM_ID,
5052
} from "@pythnetwork/xc-admin-common";
5153

5254
import {
@@ -1063,4 +1065,47 @@ multisigCommand(
10631065
}
10641066
});
10651067

1068+
multisigCommand(
1069+
"set-publisher-stake-account",
1070+
"Set a publisher stake account for the Integrity Pool program",
1071+
)
1072+
.requiredOption("-p, --publisher <pubkey>", "public key of the publisher")
1073+
.requiredOption(
1074+
"-s, --stake-account <pubkey>",
1075+
"public key of the stake account",
1076+
)
1077+
.action(async (options: any) => {
1078+
const vault = await loadVaultFromOptions(options);
1079+
const targetCluster: PythCluster = options.cluster;
1080+
1081+
const newStakeAccountPositionsOption = new PublicKey(options.stakeAccount);
1082+
1083+
// Create Anchor program instance
1084+
const integrityPoolProgram = new Program(
1085+
integrityPoolIdl as Idl,
1086+
INTEGRITY_POOL_PROGRAM_ID,
1087+
vault.getAnchorProvider(),
1088+
);
1089+
1090+
// Use Anchor to create the instruction
1091+
let setPublisherStakeAccountInstruction = await integrityPoolProgram.methods
1092+
.setPublisherStakeAccount?.()
1093+
.accounts({
1094+
signer: await vault.getVaultAuthorityPDA(targetCluster),
1095+
publisher: new PublicKey(options.publisher),
1096+
poolData: new PublicKey("poo1zPoi5xrNzi4yk4i23oWcJrNNkDYAniBCewJY8kb"),
1097+
currentStakeAccountPositionsOption: INTEGRITY_POOL_PROGRAM_ID,
1098+
newStakeAccountPositionsOption,
1099+
})
1100+
.instruction();
1101+
1102+
if (setPublisherStakeAccountInstruction) {
1103+
await vault.proposeInstructions(
1104+
[setPublisherStakeAccountInstruction],
1105+
targetCluster,
1106+
DEFAULT_PRIORITY_FEE_CONFIG,
1107+
);
1108+
}
1109+
});
1110+
10661111
program.parse();

governance/xc_admin/packages/xc_admin_common/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@
150150
"types": "./dist/multisig.d.ts",
151151
"default": "./dist/multisig.cjs"
152152
},
153+
"./multisig_transaction/AnchorMultisigInstruction": {
154+
"types": "./dist/multisig_transaction/AnchorMultisigInstruction.d.ts",
155+
"default": "./dist/multisig_transaction/AnchorMultisigInstruction.cjs"
156+
},
153157
"./multisig_transaction/BpfUpgradableLoaderMultisigInstruction": {
154158
"types": "./dist/multisig_transaction/BpfUpgradableLoaderMultisigInstruction.d.ts",
155159
"default": "./dist/multisig_transaction/BpfUpgradableLoaderMultisigInstruction.cjs"
@@ -158,10 +162,6 @@
158162
"types": "./dist/multisig_transaction/LazerMultisigInstruction.d.ts",
159163
"default": "./dist/multisig_transaction/LazerMultisigInstruction.cjs"
160164
},
161-
"./multisig_transaction/MessageBufferMultisigInstruction": {
162-
"types": "./dist/multisig_transaction/MessageBufferMultisigInstruction.d.ts",
163-
"default": "./dist/multisig_transaction/MessageBufferMultisigInstruction.cjs"
164-
},
165165
"./multisig_transaction/PythMultisigInstruction": {
166166
"types": "./dist/multisig_transaction/PythMultisigInstruction.d.ts",
167167
"default": "./dist/multisig_transaction/PythMultisigInstruction.cjs"

governance/xc_admin/packages/xc_admin_common/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ export * from "./chains";
1414
export * from "./deterministic_stake_accounts";
1515
export * from "./price_store";
1616
export { default as lazerIdl } from "./multisig_transaction/idl/lazer.json";
17+
export { default as integrityPoolIdl } from "./multisig_transaction/idl/integrity-pool.json";
18+
export { INTEGRITY_POOL_PROGRAM_ID } from "./multisig_transaction/AnchorMultisigInstruction";
1719

1820
export {
1921
ProgramType,
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { type Idl, BorshCoder } from "@coral-xyz/anchor";
1515
import { MESSAGE_BUFFER_PROGRAM_ID } from "../message_buffer";
1616
import meshIdl from "@sqds/mesh/lib/mesh-idl/mesh.json";
1717
import stakingIdl from "./idl/staking.json";
18+
import integrityPoolIdl from "./idl/integrity-pool.json";
1819
import {
1920
DEFAULT_RECEIVER_PROGRAM_ID,
2021
pythSolanaReceiverIdl,
@@ -26,6 +27,9 @@ export const MESH_PROGRAM_ID = new PublicKey(
2627
export const STAKING_PROGRAM_ID = new PublicKey(
2728
"pytS9TjG1qyAZypk7n8rw8gfW9sUaqqYyMhJQ4E7JCQ",
2829
);
30+
export const INTEGRITY_POOL_PROGRAM_ID = new PublicKey(
31+
"pyti8TM4zRVBjmarcgAPmTNNAXYKJv7WVHrkrm6woLN",
32+
);
2933

3034
export class AnchorMultisigInstruction implements MultisigInstruction {
3135
readonly program: MultisigInstructionProgram;
@@ -63,6 +67,10 @@ export class AnchorMultisigInstruction implements MultisigInstruction {
6367
idl = stakingIdl as Idl;
6468
program = MultisigInstructionProgram.Staking;
6569
break;
70+
case INTEGRITY_POOL_PROGRAM_ID.toBase58():
71+
idl = integrityPoolIdl as Idl;
72+
program = MultisigInstructionProgram.IntegrityPool;
73+
break;
6674
case DEFAULT_RECEIVER_PROGRAM_ID.toBase58():
6775
idl = pythSolanaReceiverIdl as Idl;
6876
program = MultisigInstructionProgram.SolanaReceiver;
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"version": "1.0.0",
3+
"name": "integrity-pool",
4+
"instructions": [
5+
{
6+
"name": "setPublisherStakeAccount",
7+
"accounts": [
8+
{
9+
"name": "signer",
10+
"isMut": false,
11+
"isSigner": true
12+
},
13+
{
14+
"name": "publisher",
15+
"isMut": false,
16+
"isSigner": false,
17+
"docs": [
18+
"CHECK : The publisher will be checked against data in the pool_data"
19+
]
20+
},
21+
{
22+
"name": "poolData",
23+
"isMut": true,
24+
"isSigner": false
25+
},
26+
{
27+
"name": "poolConfig",
28+
"isMut": false,
29+
"isSigner": false,
30+
"pda": {
31+
"seeds": [
32+
{
33+
"kind": "const",
34+
"type": "string",
35+
"value": "pool_config"
36+
}
37+
]
38+
}
39+
},
40+
{
41+
"name": "newStakeAccountPositionsOption",
42+
"isMut": false,
43+
"isSigner": false,
44+
"isOptional": true
45+
},
46+
{
47+
"name": "currentStakeAccountPositionsOption",
48+
"isMut": false,
49+
"isSigner": false,
50+
"isOptional": true
51+
}
52+
],
53+
"args": []
54+
}
55+
]
56+
}

governance/xc_admin/packages/xc_admin_common/src/multisig_transaction/index.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import {
1414
MESH_PROGRAM_ID,
1515
AnchorMultisigInstruction,
1616
STAKING_PROGRAM_ID,
17-
} from "./MessageBufferMultisigInstruction";
17+
INTEGRITY_POOL_PROGRAM_ID,
18+
} from "./AnchorMultisigInstruction";
1819
import { PythMultisigInstruction } from "./PythMultisigInstruction";
1920
import { WormholeMultisigInstruction } from "./WormholeMultisigInstruction";
2021
import { SystemProgramMultisigInstruction } from "./SystemProgramInstruction";
@@ -36,6 +37,7 @@ export enum MultisigInstructionProgram {
3637
WormholeBridge,
3738
MessageBuffer,
3839
Staking,
40+
IntegrityPool,
3941
Mesh,
4042
SystemProgram,
4143
BpfUpgradableLoader,
@@ -64,6 +66,8 @@ export function getProgramName(program: MultisigInstructionProgram) {
6466
return "Mesh Multisig Program";
6567
case MultisigInstructionProgram.Staking:
6668
return "Pyth Staking Program";
69+
case MultisigInstructionProgram.IntegrityPool:
70+
return "Integrity Pool";
6771
case MultisigInstructionProgram.SolanaReceiver:
6872
return "Pyth Solana Receiver";
6973
case MultisigInstructionProgram.PythPriceStore:
@@ -151,7 +155,8 @@ export class MultisigParser {
151155
instruction.programId.equals(MESSAGE_BUFFER_PROGRAM_ID) ||
152156
instruction.programId.equals(MESH_PROGRAM_ID) ||
153157
instruction.programId.equals(STAKING_PROGRAM_ID) ||
154-
instruction.programId.equals(DEFAULT_RECEIVER_PROGRAM_ID)
158+
instruction.programId.equals(DEFAULT_RECEIVER_PROGRAM_ID) ||
159+
instruction.programId.equals(INTEGRITY_POOL_PROGRAM_ID)
155160
) {
156161
return AnchorMultisigInstruction.fromTransactionInstruction(instruction);
157162
} else if (instruction.programId.equals(SystemProgram.programId)) {
@@ -179,7 +184,7 @@ export class MultisigParser {
179184
export { idlSetBuffer } from "./anchor";
180185
export { WormholeMultisigInstruction } from "./WormholeMultisigInstruction";
181186
export { PythMultisigInstruction } from "./PythMultisigInstruction";
182-
export { AnchorMultisigInstruction } from "./MessageBufferMultisigInstruction";
187+
export { AnchorMultisigInstruction } from "./AnchorMultisigInstruction";
183188
export { SystemProgramMultisigInstruction } from "./SystemProgramInstruction";
184189
export { BpfUpgradableLoaderInstruction } from "./BpfUpgradableLoaderMultisigInstruction";
185190
export {

0 commit comments

Comments
 (0)