Skip to content

Commit 3d0315f

Browse files
authored
fix: update butched snapshot.js calls (#4993)
1 parent 9e57314 commit 3d0315f

File tree

2 files changed

+33
-19
lines changed

2 files changed

+33
-19
lines changed

src/plugins/gnosis/index.ts

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ import snapshot from '@snapshot-labs/snapshot.js';
33

44
const UNISWAP_V2_SUBGRAPH_URL = {
55
'1': 'https://subgrapher.snapshot.org/subgraph/arbitrum/EYCKATKGBKLWvSfwvBjzfCBmGwYNdVkduYXVivCsLRFu',
6-
'100': 'https://subgrapher.snapshot.org/subgraph/arbitrum/F5u74NSaLF92s1qUSacQU4fmWizmK9yqDhXAq6RPtgky',
6+
'100':
7+
'https://subgrapher.snapshot.org/subgraph/arbitrum/F5u74NSaLF92s1qUSacQU4fmWizmK9yqDhXAq6RPtgky'
78
};
89

910
const OMEN_SUBGRAPH_URL = {
1011
'1': 'https://subgrapher.snapshot.org/subgraph/arbitrum/7JbjEfSTme3LioqJ7SJZ9Y1GhSD55X98Btd8fg7iYUPT',
11-
'100': 'https://subgrapher.snapshot.org/subgraph/arbitrum/9fUVQpFwzpdWS9bq5WkAnmKbNNcoBwatMR4yZq81pbbz'
12+
'100':
13+
'https://subgrapher.snapshot.org/subgraph/arbitrum/9fUVQpFwzpdWS9bq5WkAnmKbNNcoBwatMR4yZq81pbbz'
1214
};
1315

1416
const WETH_ADDRESS = {
@@ -473,10 +475,15 @@ const erc20Abi = [
473475
* @param method
474476
*/
475477
const getTokenInfo = async (web3, tokenAddress) => {
476-
return await snapshot.utils.multicall(web3._network.chainId.toString(), web3, erc20Abi, [
477-
[tokenAddress, 'name'],
478-
[tokenAddress, 'symbol']
479-
]);
478+
return await snapshot.utils.multicall(
479+
web3._network.chainId.toString(),
480+
web3,
481+
erc20Abi,
482+
[
483+
[tokenAddress, 'name'],
484+
[tokenAddress, 'symbol']
485+
]
486+
);
480487
};
481488

482489
export default class Plugin {
@@ -495,7 +502,7 @@ export default class Plugin {
495502
name: tokenInfo[0][0],
496503
symbol: tokenInfo[1][0]
497504
};
498-
} catch (e) {
505+
} catch (e: any) {
499506
throw new Error(e);
500507
}
501508
}
@@ -504,7 +511,10 @@ export default class Plugin {
504511
try {
505512
const query = OMEN_GQL_QUERY;
506513
query.condition.__args.id = conditionId;
507-
return await snapshot.utils.subgraphRequest(OMEN_SUBGRAPH_URL[network], query);
514+
return await snapshot.utils.subgraphRequest(
515+
OMEN_SUBGRAPH_URL[network],
516+
query
517+
);
508518
} catch (e) {
509519
console.error(e);
510520
}
@@ -529,7 +539,7 @@ export default class Plugin {
529539
token0: token1.toLowerCase(),
530540
token1: WETH_ADDRESS[network]
531541
};
532-
const result = await subgraphRequest(
542+
const result = await snapshot.utils.subgraphRequest(
533543
UNISWAP_V2_SUBGRAPH_URL[network],
534544
query
535545
);

src/plugins/safeSnap/index.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ export default class Plugin {
192192
transactions
193193
);
194194

195-
const approveTx = await sendTransaction(
195+
const approveTx = await snapshot.utils.sendTransaction(
196196
web3,
197197
moduleDetails.collateral,
198198
ERC20_ABI,
@@ -243,7 +243,7 @@ export default class Plugin {
243243
proposalId: string,
244244
txHashes: string[]
245245
) {
246-
const tx = await sendTransaction(
246+
const tx = await snapshot.utils.sendTransaction(
247247
web3,
248248
moduleAddress,
249249
REALITY_MODULE_ABI,
@@ -262,7 +262,7 @@ export default class Plugin {
262262
transactions: any
263263
) {
264264
const explanationBytes = toUtf8Bytes(explanation);
265-
const tx = await sendTransaction(
265+
const tx = await snapshot.utils.sendTransaction(
266266
web3,
267267
moduleAddress,
268268
UMA_MODULE_ABI,
@@ -389,14 +389,14 @@ export default class Plugin {
389389
questionId: string,
390390
claimParams: [string[], string[], number[], string[]]
391391
) {
392-
const currentHistoryHash = await call(web3, ORACLE_ABI, [
392+
const currentHistoryHash = await snapshot.utils.call(web3, ORACLE_ABI, [
393393
oracleAddress,
394394
'getHistoryHash',
395395
[questionId]
396396
]);
397397

398398
if (BigNumber.from(currentHistoryHash).eq(0)) {
399-
const withdrawTx = await sendTransaction(
399+
const withdrawTx = await snapshot.utils.sendTransaction(
400400
web3,
401401
oracleAddress,
402402
ORACLE_ABI,
@@ -409,7 +409,7 @@ export default class Plugin {
409409
return;
410410
}
411411

412-
const tx = await sendTransaction(
412+
const tx = await snapshot.utils.sendTransaction(
413413
web3,
414414
oracleAddress,
415415
ORACLE_ABI,
@@ -432,7 +432,7 @@ export default class Plugin {
432432
moduleTx: SafeTransaction,
433433
transactionIndex: number
434434
) {
435-
const tx = await sendTransaction(
435+
const tx = await snapshot.utils.sendTransaction(
436436
web3,
437437
moduleAddress,
438438
REALITY_MODULE_ABI,
@@ -457,7 +457,7 @@ export default class Plugin {
457457
moduleAddress: string,
458458
transactions: any
459459
) {
460-
const tx = await sendTransaction(
460+
const tx = await snapshot.utils.sendTransaction(
461461
web3,
462462
moduleAddress,
463463
UMA_MODULE_ABI,
@@ -477,7 +477,7 @@ export default class Plugin {
477477
minimumBondInDaoModule: string,
478478
answer: '1' | '0'
479479
) {
480-
const currentBond = await call(web3, ORACLE_ABI, [
480+
const currentBond = await snapshot.utils.call(web3, ORACLE_ABI, [
481481
oracleAddress,
482482
'getBond',
483483
[questionId]
@@ -504,7 +504,11 @@ export default class Plugin {
504504
// a RealitioERC20, otherwise the catch will handle the currency as ETH
505505
try {
506506
const account = (await web3.listAccounts())[0];
507-
const token = await snapshot.utils.call(web3, ORACLE_ABI, [oracleAddress, 'token', []]);
507+
const token = await snapshot.utils.call(web3, ORACLE_ABI, [
508+
oracleAddress,
509+
'token',
510+
[]
511+
]);
508512
const [[tokenDecimals], [allowance]] = await snapshot.utils.multicall(
509513
network,
510514
web3,

0 commit comments

Comments
 (0)