Commit b2331d5c authored by Felipe Andrade's avatar Felipe Andrade

use ethers contract wrapper

parent 9fc86361
...@@ -7,6 +7,7 @@ import { ...@@ -7,6 +7,7 @@ import {
} from '@eth-optimism/common-ts' } from '@eth-optimism/common-ts'
import { Provider } from '@ethersproject/abstract-provider' import { Provider } from '@ethersproject/abstract-provider'
import { BigNumber, ethers } from 'ethers' import { BigNumber, ethers } from 'ethers'
import Safe from '@eth-optimism/contracts-bedrock/forge-artifacts/IGnosisSafe.sol/IGnosisSafe.0.8.19.json'
import { version } from '../../package.json' import { version } from '../../package.json'
...@@ -76,9 +77,8 @@ export class BalanceMonService extends BaseServiceV2< ...@@ -76,9 +77,8 @@ export class BalanceMonService extends BaseServiceV2<
protected async main(): Promise<void> { protected async main(): Promise<void> {
for (const account of this.state.accounts) { for (const account of this.state.accounts) {
let balance: ethers.BigNumber
try { try {
balance = await this.options.rpc.getBalance(account.address) const balance = await this.options.rpc.getBalance(account.address)
this.logger.info(`got balance`, { this.logger.info(`got balance`, {
address: account.address, address: account.address,
nickname: account.nickname, nickname: account.nickname,
...@@ -106,14 +106,13 @@ export class BalanceMonService extends BaseServiceV2< ...@@ -106,14 +106,13 @@ export class BalanceMonService extends BaseServiceV2<
// Get the safe nonce to report // Get the safe nonce to report
if (account.safe) { if (account.safe) {
let safeNonce: ethers.BigNumber
try { try {
safeNonce = BigNumber.from( const safeContract = new ethers.Contract(
await this.options.rpc.call({ account.address,
to: account.address, Safe.abi,
data: '0xaffed0e0', // call the nonce() function in the safe contract this.options.rpc
})
) )
const safeNonce = BigNumber.from(await safeContract.nonce())
this.logger.info(`got nonce`, { this.logger.info(`got nonce`, {
address: account.address, address: account.address,
nickname: account.nickname, nickname: account.nickname,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment