Skip to content

Commit 9c08d5e

Browse files
authored
Merge pull request #78 from metaproph3t/cu-limit-ixs
Add `ComputeBudgetProgram` instructions to proposal initialize script
2 parents 3e47ae5 + f4fe25d commit 9c08d5e

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

scripts/main.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,14 @@ async function initializeVault(
226226
systemProgram: SystemProgram.programId,
227227
})
228228
.signers([conditionalOnFinalizeKP, conditionalOnRevertKP])
229+
.preInstructions([
230+
ComputeBudgetProgram.setComputeUnitLimit({
231+
units: 150_000
232+
}),
233+
ComputeBudgetProgram.setComputeUnitPrice({
234+
microLamports: 100
235+
}),
236+
])
229237
.postInstructions([addMetadataToConditionalTokensIx])
230238
.rpc();
231239

@@ -403,13 +411,17 @@ export async function initializeProposal(
403411
daoTreasury
404412
);
405413

406-
const cuIx = ComputeBudgetProgram.setComputeUnitPrice({
414+
const cuPriceIx = ComputeBudgetProgram.setComputeUnitPrice({
407415
microLamports: 100,
408416
});
417+
const cuLimitIx = ComputeBudgetProgram.setComputeUnitLimit({
418+
units: 150_000
419+
});
409420

410421
let tx1 = new Transaction();
411422
tx1.add(...passMarketInstructions);
412-
tx1.add(cuIx);
423+
tx1.add(cuPriceIx);
424+
tx1.add(cuLimitIx);
413425

414426
let blockhash = await provider.connection.getLatestBlockhash();
415427
tx1.recentBlockhash = blockhash.blockhash;
@@ -451,7 +463,8 @@ export async function initializeProposal(
451463

452464
let tx = new Transaction();
453465
tx.add(...openbookFailMarketIx[0]);
454-
tx.add(cuIx);
466+
tx.add(cuPriceIx);
467+
tx.add(cuLimitIx);
455468

456469
blockhash = await provider.connection.getLatestBlockhash();
457470
tx.recentBlockhash = blockhash.blockhash;
@@ -480,6 +493,8 @@ export async function initializeProposal(
480493
twapMarket: openbookTwapFailMarket,
481494
})
482495
.instruction(),
496+
cuPriceIx,
497+
cuLimitIx,
483498
])
484499
.accounts({
485500
proposal: proposalKeypair.publicKey,

0 commit comments

Comments
 (0)