scripts: find unwanted relayers

Signed-off-by: AlienTornadosaurusHex <>
This commit is contained in:
AlienTornadosaurusHex 2023-05-19 01:19:05 +00:00
parent 937c221e22
commit fe64495581
7 changed files with 187 additions and 11 deletions

View file

@ -6,7 +6,7 @@ import { uniqBy } from 'lodash'
import networkConfig, { enabledChains } from '../networkConfig'
import ABI from '../abis/Instance.abi.json'
import { loadCachedEvents, getPastEvents } from './helpers'
import { loadCachedEvents, getPastEvents, needsArg } from './helpers'
const EVENTS_PATH = './static/events/'
const EVENTS = ['Deposit', 'Withdrawal']
@ -78,15 +78,21 @@ async function main(type, netId, chosenToken) {
}
}
/**
* @param netId The netId of the chain to synchronize deposits and withdrawal events for.
* @param chosenToken Optional. Default is native. The token for which to synchronize the events.
*/
async function start() {
const [, , , chain, chosenToken] = process.argv
const [, , , netId, chosenToken] = process.argv
if (!enabledChains.includes(chain)) {
if (!enabledChains.includes(netId)) {
throw new Error(`Supported chain ids ${enabledChains.join(', ')}`)
}
if (!netId) needsArg('netId')
for (const event of EVENTS) {
await main(event, chain, chosenToken)
await main(event, netId, chosenToken)
}
}