Skip to content

Commit

Permalink
Update initializeProposal so it's atomic
Browse files Browse the repository at this point in the history
  • Loading branch information
metaproph3t committed Jan 12, 2024
1 parent 5c759a0 commit 62f188b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
9 changes: 4 additions & 5 deletions scripts/initializeProposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ const { BN, Program } = anchor;
async function main() {
const memoText =
"I, glorious autocrat of the divine Meta-DAO, " +
"sanction the creation of this Saber vote market platform.\n\n" +
"That I shall bestow lavish rewards upon those who contribute to its creation is guaranteed. " +
"Remember that my word is not the word of a man but the word of a market.\n\n" +
"Godspeed, futards!";
"hereby endorse this endeavor to elevate the futarchy domain. " +
"Recognize that my utterance echoes not the voice of a mortal but resonates as the proclamation of an omniscient market." +
"Onward, futards, with the swiftness of the divine!";

const memoInstruction = {
programId: new PublicKey(MEMO_PROGRAM_ID),
Expand All @@ -28,7 +27,7 @@ async function main() {

await initializeProposal(
memoInstruction,
"https://hackmd.io/@jlPYU3_dTOuQkU5duRNUlg/rkhWWXjLp"
"https://bafybeicfx3w6om4sk6ly7lgfnoy7wj3qpfzv6iet6qvyjzu6yvubmgeu5i.ipfs.nftstorage.link/"
);
}

Expand Down
30 changes: 15 additions & 15 deletions scripts/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ export async function initializeProposal(

const quoteVault = await initializeVault(
daoTreasury,
DEVNET_USDC,
USDC,
baseNonce.or(new BN(1).shln(63))
);

Expand Down Expand Up @@ -325,13 +325,6 @@ export async function initializeProposal(
daoTreasury
);

await openbookTwap.methods
.createTwapMarket(new BN(10_000))
.accounts({
market: openbookPassMarket,
twapMarket: openbookTwapPassMarket,
})
.rpc();

let openbookFailMarketKP = Keypair.generate();

Expand Down Expand Up @@ -362,13 +355,6 @@ export async function initializeProposal(
openbookFailMarketKP,
daoTreasury
);
await openbookTwap.methods
.createTwapMarket(new BN(10_000))
.accounts({
market: openbookFailMarket,
twapMarket: openbookTwapFailMarket,
})
.rpc();

await autocratProgram.methods
.initializeProposal(proposalURL, instruction)
Expand All @@ -377,6 +363,20 @@ export async function initializeProposal(
proposalKeypair,
1500
),
await openbookTwap.methods
.createTwapMarket(new BN(10_000))
.accounts({
market: openbookPassMarket,
twapMarket: openbookTwapPassMarket,
})
.instruction(),
await openbookTwap.methods
.createTwapMarket(new BN(10_000))
.accounts({
market: openbookFailMarket,
twapMarket: openbookTwapFailMarket,
})
.instruction()
])
.accounts({
proposal: proposalKeypair.publicKey,
Expand Down

0 comments on commit 62f188b

Please sign in to comment.