forked from tornadocash/classic-ui
allow any token events to be updated
Signed-off-by: AlienTornadosaurusHex <>
This commit is contained in:
parent
2fbd860f51
commit
937c221e22
@ -31,6 +31,7 @@ export default {
|
||||
}
|
||||
},
|
||||
multicall: '0xeefba1e63905ef1d7acba5a8513c70307c1ce441',
|
||||
routerContract: '0xd90e2f925DA726b50C4Ed8D0Fb90Ad053324F31b',
|
||||
registryContract: '0x58E8dCC13BE9780fC42E8723D8EaD4CF46943dF2',
|
||||
echoContractAccount: '0x9B27DD5Bb15d42DC224FCD0B7caEbBe16161Df42',
|
||||
aggregatorContract: '0xE8F47A78A6D52D317D0D2FFFac56739fE14D1b49',
|
||||
|
@ -11,18 +11,20 @@ import { loadCachedEvents, getPastEvents } from './helpers'
|
||||
const EVENTS_PATH = './static/events/'
|
||||
const EVENTS = ['Deposit', 'Withdrawal']
|
||||
|
||||
async function main(type, netId) {
|
||||
async function main(type, netId, chosenToken) {
|
||||
const { tokens, nativeCurrency, deployedBlock } = networkConfig[`netId${netId}`]
|
||||
const CONTRACTS = tokens[nativeCurrency].instanceAddress
|
||||
const token = chosenToken !== undefined ? chosenToken : nativeCurrency
|
||||
|
||||
const CONTRACTS = tokens[token].instanceAddress
|
||||
|
||||
for (const [instance, _contract] of Object.entries(CONTRACTS)) {
|
||||
const cachedEvents = await loadCachedEvents({
|
||||
name: `${type.toLowerCase()}s_${netId}_${nativeCurrency}_${instance}.json`,
|
||||
const cachedEvents = loadCachedEvents({
|
||||
name: `${type.toLowerCase()}s_${netId}_${token}_${instance}.json`,
|
||||
directory: EVENTS_PATH,
|
||||
deployedBlock
|
||||
})
|
||||
|
||||
console.log('Update events for', instance, nativeCurrency.toUpperCase(), `${type.toLowerCase()}s`)
|
||||
console.log('Update events for', instance, token.toUpperCase(), `${type.toLowerCase()}s`)
|
||||
console.log('cachedEvents count - ', cachedEvents.events.length)
|
||||
console.log('lastBlock - ', cachedEvents.lastBlock)
|
||||
|
||||
@ -72,22 +74,19 @@ async function main(type, netId) {
|
||||
|
||||
const eventsJson = JSON.stringify(freshEvents, null, 2) + '\n'
|
||||
|
||||
fs.writeFileSync(
|
||||
`${EVENTS_PATH}${type.toLowerCase()}s_${netId}_${nativeCurrency}_${instance}.json`,
|
||||
eventsJson
|
||||
)
|
||||
fs.writeFileSync(`${EVENTS_PATH}${type.toLowerCase()}s_${netId}_${token}_${instance}.json`, eventsJson)
|
||||
}
|
||||
}
|
||||
|
||||
async function start() {
|
||||
const [, , , chain] = process.argv
|
||||
const [, , , chain, chosenToken] = process.argv
|
||||
|
||||
if (!enabledChains.includes(chain)) {
|
||||
throw new Error(`Supported chain ids ${enabledChains.join(', ')}`)
|
||||
}
|
||||
|
||||
for (const event of EVENTS) {
|
||||
await main(event, chain)
|
||||
await main(event, chain, chosenToken)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user