Skip to content

Commit

Permalink
fix: add mint/burn from admin pod functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Kim committed May 10, 2022
1 parent d491ab1 commit 666c9f2
Show file tree
Hide file tree
Showing 6 changed files with 262 additions and 111 deletions.
4 changes: 2 additions & 2 deletions scripts/approve-superproposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ async function main() {
console.log('Creating super proposal + sub proposal on subPod');
try {
if (isMember) {
await superPod.proposeBurnMemberFromPod(subPod, dummyAccount, walletOne);
await superPod.burnMemberFromSubPod(subPod, dummyAccount, walletOne);
} else {
await superPod.proposeMintMemberFromPod(subPod, dummyAccount, walletOne);
await superPod.mintMemberFromSubPod(subPod, dummyAccount, walletOne);
}
} catch (err) {
console.log(err);
Expand Down
43 changes: 43 additions & 0 deletions scripts/mint-from-admin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { getPod } from '../src';
import { adminPodAddress, dummyAccount, subPodAddress } from '../env.json';
import { setup, sleep } from './utils';

async function main() {
const { walletOne, walletTwo } = setup();

// Get the pod we're working with

const adminPod = await getPod(adminPodAddress);
const subPod = await getPod(subPodAddress)

if ((await adminPod.getProposals({ queued: true }))[0].status !== 'executed') {
throw new Error(
'Super pod had an active/queued transaction. This script expects no enqueued transactions',
);
}

console.log('subPod.admin', subPod.admin);

// We mint/burn the dummy account based on whether its a member or not.
const isMember = await subPod.isMember(dummyAccount);
if (isMember) {
await subPod.burnMemberFromAdminPod(adminPod, dummyAccount, walletOne);
} else {
await subPod.mintMemberFromAdminPod(adminPod, dummyAccount, walletOne);
}

const proposal = (await adminPod.getProposals())[0];

await proposal.approve(walletTwo);
await proposal.executeApprove(walletTwo);

// // Let gnosis catch up.
// await sleep(5000);

// if (proposal.status !== 'executed') throw new Error('Proposal status not right');
// const refetchProposal = (await adminPod.getProposals())[0];
// if (!refetchProposal.safeTransaction.isExecuted)
// throw new Error('Proposal not executed according to gnosis');
}

main();
4 changes: 2 additions & 2 deletions scripts/reject-superproposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ async function main() {
try {
if (isMember) {
console.log('Burning');
await superPod.proposeBurnMemberFromPod(subPod, dummyAccount, walletOne);
await superPod.burnMemberFromSubPod(subPod, dummyAccount, walletOne);
} else {
console.log('Minting');
await superPod.proposeMintMemberFromPod(subPod, dummyAccount, walletOne);
await superPod.mintMemberFromSubPod(subPod, dummyAccount, walletOne);
}
} catch (err) {
console.log(err);
Expand Down
Loading

0 comments on commit 666c9f2

Please sign in to comment.