#PR1: classic-ui: Prefix static caches with network id and code quality #25
@ -31,6 +31,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
multicall: '0xeefba1e63905ef1d7acba5a8513c70307c1ce441',
|
multicall: '0xeefba1e63905ef1d7acba5a8513c70307c1ce441',
|
||||||
|
routerContract: '0xd90e2f925DA726b50C4Ed8D0Fb90Ad053324F31b',
|
||||||
registryContract: '0x58E8dCC13BE9780fC42E8723D8EaD4CF46943dF2',
|
registryContract: '0x58E8dCC13BE9780fC42E8723D8EaD4CF46943dF2',
|
||||||
echoContractAccount: '0x9B27DD5Bb15d42DC224FCD0B7caEbBe16161Df42',
|
echoContractAccount: '0x9B27DD5Bb15d42DC224FCD0B7caEbBe16161Df42',
|
||||||
aggregatorContract: '0xE8F47A78A6D52D317D0D2FFFac56739fE14D1b49',
|
aggregatorContract: '0xE8F47A78A6D52D317D0D2FFFac56739fE14D1b49',
|
||||||
|
@ -11,18 +11,20 @@ import { loadCachedEvents, getPastEvents } from './helpers'
|
|||||||
const EVENTS_PATH = './static/events/'
|
const EVENTS_PATH = './static/events/'
|
||||||
const EVENTS = ['Deposit', 'Withdrawal']
|
const EVENTS = ['Deposit', 'Withdrawal']
|
||||||
|
|
||||||
async function main(type, netId) {
|
async function main(type, netId, chosenToken) {
|
||||||
const { tokens, nativeCurrency, deployedBlock } = networkConfig[`netId${netId}`]
|
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)) {
|
for (const [instance, _contract] of Object.entries(CONTRACTS)) {
|
||||||
const cachedEvents = await loadCachedEvents({
|
const cachedEvents = loadCachedEvents({
|
||||||
name: `${type.toLowerCase()}s_${netId}_${nativeCurrency}_${instance}.json`,
|
name: `${type.toLowerCase()}s_${netId}_${token}_${instance}.json`,
|
||||||
directory: EVENTS_PATH,
|
directory: EVENTS_PATH,
|
||||||
deployedBlock
|
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('cachedEvents count - ', cachedEvents.events.length)
|
||||||
console.log('lastBlock - ', cachedEvents.lastBlock)
|
console.log('lastBlock - ', cachedEvents.lastBlock)
|
||||||
|
|
||||||
@ -72,22 +74,19 @@ async function main(type, netId) {
|
|||||||
|
|
||||||
const eventsJson = JSON.stringify(freshEvents, null, 2) + '\n'
|
const eventsJson = JSON.stringify(freshEvents, null, 2) + '\n'
|
||||||
|
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(`${EVENTS_PATH}${type.toLowerCase()}s_${netId}_${token}_${instance}.json`, eventsJson)
|
||||||
`${EVENTS_PATH}${type.toLowerCase()}s_${netId}_${nativeCurrency}_${instance}.json`,
|
|
||||||
eventsJson
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function start() {
|
async function start() {
|
||||||
const [, , , chain] = process.argv
|
const [, , , chain, chosenToken] = process.argv
|
||||||
|
|
||||||
if (!enabledChains.includes(chain)) {
|
if (!enabledChains.includes(chain)) {
|
||||||
throw new Error(`Supported chain ids ${enabledChains.join(', ')}`)
|
throw new Error(`Supported chain ids ${enabledChains.join(', ')}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const event of EVENTS) {
|
for (const event of EVENTS) {
|
||||||
await main(event, chain)
|
await main(event, chain, chosenToken)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user