Skip to content

Commit

Permalink
feat: add generic propose function
Browse files Browse the repository at this point in the history
BREAKING CHANGE: removal of old propose functions
  • Loading branch information
Will Kim committed Jun 17, 2022
1 parent d058fc9 commit affa94b
Show file tree
Hide file tree
Showing 8 changed files with 150 additions and 15 deletions.
80 changes: 80 additions & 0 deletions docs/classes/Pod.html

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions docs/classes/Proposal.html

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions docs/modules.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scripts/approve-proposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async function main() {
data = pod.populateMint(dummyAccount);
}

const proposal = await pod.propose(data, walletOne.address)
const proposal = await pod.propose(data, walletOne.address);

// const [proposal] = await pod.getProposals();

Expand Down
2 changes: 1 addition & 1 deletion scripts/approve-superproposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async function main() {

console.log('Executing both sub proposals');
const subProposal = (await subPod.getProposals())[0];
await subProposal.approve(walletOne)
await subProposal.approve(walletOne);
await subProposal.executeApprove(walletOne);

const subProposalTwo = (await subPodTwo.getProposals())[0];
Expand Down
2 changes: 1 addition & 1 deletion scripts/reject-proposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async function main() {
data = pod.populateMint(dummyAccount);
}

const proposal = await pod.propose(data, walletOne.address)
const proposal = await pod.propose(data, walletOne.address);

await proposal.reject(walletOne);
await proposal.reject(walletTwo);
Expand Down
21 changes: 10 additions & 11 deletions test/propose.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ function mockGetPodFetchersByAddress(opts?: { overrideAdmin?: string }) {
getThreshold: jest
.fn()
.mockResolvedValueOnce({ toNumber: jest.fn().mockImplementation(() => 10) }),
}, podId: orcanautPod.id,
},
podId: orcanautPod.id,
Name: { name: orcanautPod.ensName },
});
}
Expand Down Expand Up @@ -100,12 +101,14 @@ beforeEach(() => {
test('Subpod members should be able to propose a mint member', async () => {
mockGetPodFetchersByAddress();
// Arbitrary return value.
const create = jest.spyOn(createSafe, 'createSafeTransaction').mockResolvedValue(erc20TransferTransaction);
const create = jest
.spyOn(createSafe, 'createSafeTransaction')
.mockResolvedValue(erc20TransferTransaction);
const pod = await sdk.getPod(orcanautAddress);

const mint = pod.populateMint(userAddress);
await pod.propose(mint, artNautPod.members[0]);

expect(create).toHaveBeenCalledWith({
sender: orcanautPod.members[0],
to: mint.to,
Expand All @@ -116,19 +119,15 @@ test('Subpod members should be able to propose a mint member', async () => {

test('Sub pod members should be able to propose a super pod mint', async () => {
setupAdminAndSubPod();
const create = jest.spyOn(createSafe, 'createSafeTransaction').mockResolvedValue(erc20TransferTransaction);
const create = jest
.spyOn(createSafe, 'createSafeTransaction')
.mockResolvedValue(erc20TransferTransaction);

const superPod = await sdk.getPod(orcanautAddress);
const subPod = await sdk.getPod(artNautPod.safe);
const mint = superPod.populateMint(userAddress);

await subPod.propose(
await superPod.propose(
mint,
orcanautPod.members[0]
),
artNautPod.members[0]
);
await subPod.propose(await superPod.propose(mint, orcanautPod.members[0]), artNautPod.members[0]);
expect(create).toHaveBeenNthCalledWith(1, {
sender: orcanautPod.members[0],
to: mint.to,
Expand Down
1 change: 0 additions & 1 deletion test/token.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,5 +160,4 @@ describe('member actions', () => {
'is already a member of this pod',
);
});

});

0 comments on commit affa94b

Please sign in to comment.