Skip to content

Commit

Permalink
feat: add isPodifyInProgress function
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Kim committed Aug 29, 2022
1 parent 6972554 commit 1e31552
Show file tree
Hide file tree
Showing 8 changed files with 407 additions and 299 deletions.
2 changes: 1 addition & 1 deletion docs/assets/search.js

Large diffs are not rendered by default.

62 changes: 31 additions & 31 deletions docs/classes/Pod.html

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions docs/classes/Proposal.html

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions docs/modules.html

Large diffs are not rendered by default.

24 changes: 11 additions & 13 deletions scripts/sandbox.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ethers } from 'ethers';
import { customSubgraphQuery, getUserPods, init } from '../src';
import { customSubgraphQuery, getUserPods, init, podifySafe } from '../src';
import { getPod, multiPodCreate } from '../src';
import { accountOne, accountTwo, adminPodAddress } from '../env.json';
import { setup, sleep } from './utils';
Expand All @@ -25,19 +25,17 @@ const multiPodInput = [
];

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

const butt = await customSubgraphQuery(`{
pods(where: {
id_in: [1, 2, 3]
}) {
id
users {
id
}
admin
}
}`);
// await podifySafe({
// admin: walletTwo.address,
// name: 'blargh',
// safe: '0x49E55999e9c47589Fd953747edffA1a754d9f8B5',
// }, walletTwo);

const pod = await getPod('0xA4fD170b92b9CBac066e4551DC4BdbbB85093c51');

const butt = await pod.isPodifyInProgress();
console.log('butt', butt);
}

Expand Down
22 changes: 22 additions & 0 deletions src/Pod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,28 @@ export default class Pod {
}
};

/**
*
*/
isPodifyInProgress = async () => {
const proposals = await this.getProposals();
let result = false;
proposals.forEach(proposal => {
if (proposal.status === 'executed') return;
if (proposal.method === 'enableModule') {
try {
// This throws if the provided address is not one of our controllers.
getControllerByAddress(proposal.parameters[0].value, config.network);
// Set to true if it doesn't throw.
result = true;
} catch {
// Do nothing.
}
}
});
return result;
};

/**
* Ejects a safe from the Orca ecosystem.
* This zeroes out all ENS + Controller data, removes the Orca module, and burns the pod's MemberTokens
Expand Down
53 changes: 53 additions & 0 deletions test/fixtures/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -561,3 +561,56 @@ const subProposalFixture = [
signatures: null,
},
];

export const enableModuleSafeTx = {
safe: '0x49E55999e9c47589Fd953747edffA1a754d9f8B5',
to: '0x49E55999e9c47589Fd953747edffA1a754d9f8B5',
value: '0',
data: '0x610b592500000000000000000000000011e2d4c75b9803ff5d6da8c30b354b44992e0248',
operation: 0,
gasToken: '0x0000000000000000000000000000000000000000',
safeTxGas: 0,
baseGas: 0,
gasPrice: '0',
refundReceiver: '0x0000000000000000000000000000000000000000',
nonce: 0,
executionDate: '2022-01-26T18:01:37Z',
submissionDate: '2022-01-26T18:01:25.726016Z',
modified: '2022-01-26T18:01:37Z',
blockNumber: 10059884,
transactionHash: '0xa00e81f88f4cb3df006779007424cc469ecc6bdfbac753dba383cfdb03ad97c1',
safeTxHash: '0x6723fd3b412953fe3a2c9c776805287d9c914964bc761604cbe73419f6169e80',
executor: '0x1cC62cE7cb56ed99513823064295761f9b7C856e',
isExecuted: true,
isSuccessful: true,
ethGasPrice: '2670677244',
maxFeePerGas: null,
maxPriorityFeePerGas: null,
gasUsed: 75937,
fee: '202803217877628',
origin: '{"url":"https://gnosis-zodiac-app.netlify.app/","name":"Zodiac"}',
dataDecoded: {
method: 'enableModule',
parameters: [
{
name: 'module',
type: 'address',
value: '0x4C98aF741e352C6551BfF9509b3f8ca9Dd4E6397',
},
],
},
confirmationsRequired: 1,
confirmations: [
{
owner: '0x1cC62cE7cb56ed99513823064295761f9b7C856e',
submissionDate: '2022-01-26T18:01:37Z',
transactionHash: null,
signature:
'0x0000000000000000000000001cc62ce7cb56ed99513823064295761f9b7c856e000000000000000000000000000000000000000000000000000000000000000001',
signatureType: 'APPROVED_HASH',
},
],
trusted: true,
signatures:
'0x0000000000000000000000001cc62ce7cb56ed99513823064295761f9b7c856e000000000000000000000000000000000000000000000000000000000000000001',
};
Loading

0 comments on commit 1e31552

Please sign in to comment.