@@ -68,7 +68,7 @@ import { open } from "fs";
6868
6969// this test file isn't 'clean' or DRY or whatever; sorry!
7070const AUTOCRAT_PROGRAM_ID = new PublicKey (
71- "meta3cxKzFBmWYgCVozmvCQAS3y9b3fGxrG9HkHL7Wi "
71+ "metaX99LHn3A7Gr7VAcCfXhpfocvpMpqQ3eyp3PGUUq "
7272) ;
7373
7474const CONDITIONAL_VAULT_PROGRAM_ID = new PublicKey (
@@ -84,7 +84,7 @@ const OPENBOOK_PROGRAM_ID = new PublicKey(
8484) ;
8585
8686const AUTOCRAT_MIGRATOR_PROGRAM_ID = new PublicKey (
87- "8C4WEdr54tBPdtmeTPUBuZX5bgUMZw4XdvpNoNaQ6NwR "
87+ "migkwAXrXFN34voCYQUhFQBXZJjHrWnpEXbSGTqZdB3 "
8888) ;
8989
9090describe ( "autocrat_v0" , async function ( ) {
@@ -295,69 +295,83 @@ describe("autocrat_v0", async function () {
295295
296296 beforeEach ( async function ( ) {
297297 // just uncomment this and replace with another instruction that you wish to test
298- const accounts = [
299- {
300- pubkey : dao ,
301- isSigner : false ,
302- isWritable : true ,
303- } ,
304- {
305- pubkey : daoTreasury ,
306- isSigner : true ,
307- isWritable : false ,
308- } ,
309- ] ;
310- newPassThresholdBps = Math . floor ( Math . random ( ) * 1000 ) ;
311- const data = autocrat . coder . instruction . encode ( "update_dao" , {
312- daoParams : {
313- passThresholdBps : newPassThresholdBps ,
314- baseBurnLamports : null ,
315- burnDecayPerSlotLamports : null ,
316- slotsPerProposal : null ,
317- marketTakerFee : null ,
318- twapExpectedValue : null ,
319- }
320- } ) ;
321- instruction = {
322- programId : autocrat . programId ,
323- accounts,
324- data,
325- } ;
326-
327- // await mintToOverride(context, treasuryMetaAccount, 1_000_000_000n);
328- // await mintToOverride(context, treasuryUsdcAccount, 1_000_000n);
329-
330- // let receiver = Keypair.generate();
331- // let to0 = await createAccount(
332- // banksClient,
333- // payer,
334- // META,
335- // receiver.publicKey
336- // );
337- // let to1 = await createAccount(
338- // banksClient,
339- // payer,
340- // USDC,
341- // receiver.publicKey
342- // );
343-
344- // const ix = await migrator.methods
345- // .multiTransfer2()
346- // .accounts({
347- // authority: daoTreasury,
348- // from0: treasuryMetaAccount,
349- // to0,
350- // from1: treasuryUsdcAccount,
351- // to1,
352- // })
353- // .instruction();
354-
298+ // const accounts = [
299+ // {
300+ // pubkey: dao,
301+ // isSigner: false,
302+ // isWritable: true,
303+ // },
304+ // {
305+ // pubkey: daoTreasury,
306+ // isSigner: true,
307+ // isWritable: false,
308+ // },
309+ // ];
310+ // newPassThresholdBps = Math.floor(Math.random() * 1000);
311+ // const data = autocrat.coder.instruction.encode("update_dao", {
312+ // daoParams: {
313+ // passThresholdBps: newPassThresholdBps,
314+ // baseBurnLamports: null,
315+ // burnDecayPerSlotLamports: null,
316+ // slotsPerProposal: null,
317+ // marketTakerFee: null,
318+ // twapExpectedValue: null,
319+ // }
320+ // });
321+ // instruction = {
322+ // programId: autocrat.programId,
323+ // accounts,
324+ // data,
325+ // };
326+ // let lamportReceiver = Keypair.generate();
327+
328+ // let ix = anchor.web3.SystemProgram.transfer({
329+ // fromPubkey: daoTreasury,
330+ // toPubkey: lamportReceiver.publicKey,
331+ // lamports: 1_000_000,
332+ // });
333+
355334 // instruction = {
356335 // programId: ix.programId,
357336 // accounts: ix.keys,
358337 // data: ix.data,
359338 // };
360339
340+ await mintToOverride ( context , treasuryMetaAccount , 1_000_000_000n ) ;
341+ await mintToOverride ( context , treasuryUsdcAccount , 1_000_000n ) ;
342+
343+ let receiver = Keypair . generate ( ) ;
344+ let to0 = await createAccount (
345+ banksClient ,
346+ payer ,
347+ META ,
348+ receiver . publicKey
349+ ) ;
350+ let to1 = await createAccount (
351+ banksClient ,
352+ payer ,
353+ USDC ,
354+ receiver . publicKey
355+ ) ;
356+
357+ const ix = await migrator . methods
358+ . multiTransfer2 ( )
359+ . accounts ( {
360+ authority : daoTreasury ,
361+ from0 : treasuryMetaAccount ,
362+ to0,
363+ from1 : treasuryUsdcAccount ,
364+ to1,
365+ lamportReceiver : receiver . publicKey ,
366+ } )
367+ . instruction ( ) ;
368+
369+ instruction = {
370+ programId : ix . programId ,
371+ accounts : ix . keys ,
372+ data : ix . data ,
373+ } ;
374+
361375 proposal = await initializeProposal (
362376 autocrat ,
363377 instruction ,
@@ -411,6 +425,11 @@ describe("autocrat_v0", async function () {
411425 lamports : 1_000_000_000n ,
412426 toPubkey : alice . publicKey ,
413427 } ) ,
428+ anchor . web3 . SystemProgram . transfer ( {
429+ fromPubkey : payer . publicKey ,
430+ lamports : 1_000_000_000n ,
431+ toPubkey : daoTreasury ,
432+ } ) ,
414433 ] ;
415434 let tx = new anchor . web3 . Transaction ( ) . add ( ...ixs ) ;
416435 [ tx . recentBlockhash ] = await banksClient . getLatestBlockhash ( ) ;
@@ -790,16 +809,6 @@ describe("autocrat_v0", async function () {
790809 daoTreasury,
791810 } )
792811 . remainingAccounts (
793- // autocrat.instruction.setPassThresholdBps
794- // .accounts({
795- // dao,
796- // daoTreasury,
797- // })
798- // .concat({
799- // pubkey: autocrat.programId,
800- // isWritable: false,
801- // isSigner: false,
802- // })
803812 instruction . accounts
804813 . concat ( {
805814 pubkey : instruction . programId ,
@@ -812,7 +821,6 @@ describe("autocrat_v0", async function () {
812821 : meta
813822 )
814823 )
815- // .transaction();
816824 . rpc ( ) ;
817825
818826 let storedBaseVault = await vaultProgram . account . conditionalVault . fetch (
@@ -831,8 +839,10 @@ describe("autocrat_v0", async function () {
831839 assert ( ( await getAccount ( banksClient , treasuryMetaAccount ) ) . amount == 0n ) ;
832840 assert ( ( await getAccount ( banksClient , treasuryUsdcAccount ) ) . amount == 0n ) ;
833841
834- const storedDao = await autocrat . account . dao . fetch ( dao ) ;
835- assert . equal ( storedDao . passThresholdBps , newPassThresholdBps ) ;
842+ // console.log(await banksClient.getAccount(daoTreasury));
843+
844+ // const storedDao = await autocrat.account.dao.fetch(dao);
845+ // assert.equal(storedDao.passThresholdBps, newPassThresholdBps);
836846
837847 await redeemConditionalTokens (
838848 vaultProgram ,
0 commit comments