Compare commits

...

7 Commits

205 changed files with 79 additions and 70 deletions

@ -1,13 +1,7 @@
PINATA_API_KEY=
PINATA_SECRET_API_KEY=
INFURA_KEY=
ALCHEMY_MAINNET_KEY=
ALCHEMY_POLYGON_KEY=
ALCHEMY_OPTIMISM_KEY=
ALCHEMY_ARBITRUM_KEY=
ALCHEMY_GOERLI_KEY=
CHAINNODES_KEY=
WC_BRIDGE=

@ -32,12 +32,7 @@ jobs:
- name: Build
run: yarn generate
env:
INFURA_KEY: ${{ secrets.INFURA_KEY }}
ALCHEMY_MAINNET_KEY: ${{ secrets.ALCHEMY_MAINNET_KEY }}
ALCHEMY_POLYGON_KEY: ${{ secrets.ALCHEMY_POLYGON_KEY }}
ALCHEMY_OPTIMISM_KEY: ${{ secrets.ALCHEMY_OPTIMISM_KEY }}
ALCHEMY_ARBITRUM_KEY: ${{ secrets.ALCHEMY_ARBITRUM_KEY }}
ALCHEMY_GOERLI_KEY: ${{ secrets.ALCHEMY_GOERLI_KEY }}
CHAINNODES_KEY: ${{ secrets.CHAINNODES_KEY }}
WC_BRIDGE: ${{ secrets.WC_BRIDGE }}
OLD_STORE_NAME: ${{ secrets.OLD_STORE_NAME }}
STORE_NAME: ${{ secrets.STORE_NAME }}

@ -72,6 +72,8 @@ export async function _encryptFormatTx({ dispatch, getters, rootGetters }, { eve
}
}
dispatch('loading/disable', {}, { root: true })
return formattingEvents(result)
}

@ -1,6 +1,5 @@
export const blockSyncInterval = 10000
export const enabledChains = ['1', '10', '56', '100', '137', '43114', '42161']
export const chainsWithEncryptedNotes = ['1', '5', '56', '100', '137']
export const enabledChains = ['1', '5', '10', '56', '100', '137', '42161', '43114']
export default {
netId1: {
rpcCallRetryAttempt: 15,
@ -78,9 +77,7 @@ export default {
usdc: {
instanceAddress: {
'100': '0xd96f2B1c14Db8458374d9Aca76E26c3D18364307',
'1000': '0x4736dCf1b7A3d580672CcE6E7c65cd5cc9cFBa9D',
'10000': '',
'100000': ''
'1000': '0x4736dCf1b7A3d580672CcE6E7c65cd5cc9cFBa9D'
},
tokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
symbol: 'USDC',
@ -90,9 +87,7 @@ export default {
usdt: {
instanceAddress: {
'100': '0x169AD27A470D064DEDE56a2D3ff727986b15D52B',
'1000': '0x0836222F2B2B24A3F36f98668Ed8F0B38D1a872f',
'10000': '',
'100000': ''
'1000': '0x0836222F2B2B24A3F36f98668Ed8F0B38D1a872f'
},
tokenAddress: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
symbol: 'USDT',
@ -103,8 +98,7 @@ export default {
instanceAddress: {
'0.1': '0x178169B423a011fff22B9e3F3abeA13414dDD0F1',
'1': '0x610B717796ad172B316836AC95a2ffad065CeaB4',
'10': '0xbB93e510BbCD0B7beb5A853875f9eC60275CF498',
'100': ''
'10': '0xbB93e510BbCD0B7beb5A853875f9eC60275CF498'
},
tokenAddress: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
symbol: 'WBTC',
@ -407,17 +401,17 @@ export default {
multicall: '0xe86e3989c74293Acc962156cd3F525c07b6a1B6e',
echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4',
rpcUrls: {
publicRpc1: {
name: 'Avalanche RPC',
url: 'https://endpoints.omniatech.io/v1/avax/mainnet/public'
},
meowRPC: {
name: 'Meow RPC',
url: 'https://avax.meowrpc.com'
},
communityRPC: {
name: 'Tornado RPC',
url: 'https://avalanche-rpc.tornado.ws/ext/bc/C/rpc'
},
publicRpc1: {
name: 'Avalanche RPC',
url: 'https://api.avax.network/ext/bc/C/rpc'
},
oneRpc: {
name: '1RPC',
ulr: 'https://1rpc.io/avax/'
}
},
tokens: {
@ -505,9 +499,7 @@ export default {
usdc: {
instanceAddress: {
'100': '0x05E0b5B40B7b66098C2161A5EE11C5740A3A7C45',
'1000': '0x23173fE8b96A4Ad8d2E17fB83EA5dcccdCa1Ae52',
'10000': '',
'100000': ''
'1000': '0x23173fE8b96A4Ad8d2E17fB83EA5dcccdCa1Ae52'
},
tokenAddress: '0xD87Ba7A50B2E7E660f678A895E4B72E7CB4CCd9C',
symbol: 'USDC',
@ -517,9 +509,7 @@ export default {
usdt: {
instanceAddress: {
'100': '0x538Ab61E8A9fc1b2f93b3dd9011d662d89bE6FE6',
'1000': '0x94Be88213a387E992Dd87DE56950a9aef34b9448',
'10000': '',
'100000': ''
'1000': '0x94Be88213a387E992Dd87DE56950a9aef34b9448'
},
tokenAddress: '0xb7FC2023D96AEa94Ba0254AA5Aeb93141e4aad66',
symbol: 'USDT',
@ -530,8 +520,7 @@ export default {
instanceAddress: {
'0.1': '0x242654336ca2205714071898f67E254EB49ACdCe',
'1': '0x776198CCF446DFa168347089d7338879273172cF',
'10': '0xeDC5d01286f99A066559F60a585406f3878a033e',
'100': ''
'10': '0xeDC5d01286f99A066559F60a585406f3878a033e'
},
tokenAddress: '0xC04B0d3107736C32e19F1c62b2aF67BE61d63a05',
symbol: 'WBTC',

@ -187,12 +187,7 @@ export default {
new webpack.IgnorePlugin(/worker_threads/),
new webpack.DefinePlugin({
'process.env': JSON.stringify({
INFURA_KEY: process.env.INFURA_KEY,
ALCHEMY_MAINNET_KEY: process.env.ALCHEMY_MAINNET_KEY,
ALCHEMY_POLYGON_KEY: process.env.ALCHEMY_POLYGON_KEY,
ALCHEMY_OPTIMISM_KEY: process.env.ALCHEMY_OPTIMISM_KEY,
ALCHEMY_ARBITRUM_KEY: process.env.ALCHEMY_ARBITRUM_KEY,
ALCHEMY_GOERLI_KEY: process.env.ALCHEMY_GOERLI_KEY,
CHAINNODES_KEY: process.env.CHAINNODES_KEY,
WC_BRIDGE: process.env.WC_BRIDGE,
OLD_STORE_NAME: process.env.OLD_STORE_NAME,
STORE_NAME: process.env.STORE_NAME,
@ -230,7 +225,7 @@ export default {
},
provider: {
rpcUrl: `https://mainnet.infura.io/v3/${process.env.INFURA_KEY}`
rpcUrl: `https://mainnet.chainnodes.org/${process.env.CHAINNODES_KEY}`
},
// todo make custom loading page

@ -39,10 +39,6 @@ export async function getPastEvents({ type, fromBlock, netId, events, contractAt
let [{ url: rpcUrl }] = Object.values(networkConfig[`netId${netId}`].rpcUrls)
if (netId === '5') {
rpcUrl = 'https://goerli.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161'
}
const provider = new Web3.providers.HttpProvider(rpcUrl)
const web3 = new Web3(provider)
const contract = new web3.eth.Contract(...contractAttrs)

@ -1,6 +1,6 @@
import { uniqBy } from 'lodash'
import networkConfig, { enabledChains, chainsWithEncryptedNotes } from '../networkConfig'
import networkConfig, { enabledChains } from '../networkConfig'
import { loadCachedEvents, save } from './helpers'
@ -68,7 +68,7 @@ async function main() {
for (let i = 0; i < enabledChains.length; i++) {
const netId = enabledChains[i]
if (netId === chainsWithEncryptedNotes[i]) updateEncrypted(netId)
updateEncrypted(netId)
await updateCommon(netId)
}

@ -2,7 +2,7 @@ import Web3 from 'web3'
import graph from '@/services/graph'
import { download } from '@/store/snark'
import networkConfig, { enabledChains } from '@/networkConfig'
import networkConfig, { enabledChains, blockSyncInterval } from '@/networkConfig'
import InstanceABI from '@/abis/Instance.abi.json'
import { CONTRACT_INSTANCES, eventsType, httpConfig } from '@/constants'
import { sleep, flattenNArray, formatEvents, capitalizeFirstLetter } from '@/utils'
@ -178,7 +178,7 @@ class EventService {
return events
}
const blockRange = 4950
const blockRange = Math.floor(blockSyncInterval / 2) - 1
const fromBlock = deployedBlock
const { blockDifference, currentBlockNumber } = await this.getBlocksDiff({ fromBlock })
@ -244,7 +244,7 @@ class EventService {
}
}
getPastEvents({ fromBlock, toBlock, type }, shouldRetry = false, i = 0) {
getPastEvents({ fromBlock, toBlock, type }, shouldRetry = false, retries = 0) {
return new Promise((resolve, reject) => {
this.contract
.getPastEvents(capitalizeFirstLetter(type), {
@ -253,13 +253,23 @@ class EventService {
})
.then((events) => resolve(events))
.catch((err) => {
i = i + 1
retries++
// If provider.getBlockNumber returned last block that isn't accepted (happened on Avalanche/Gnosis),
// get events to last accepted block
if (err.message.includes('after last accepted block')) {
const acceptedBlock = parseInt(err.message.split('after last accepted block ')[1])
toBlock = acceptedBlock
// Retries to 0, because it is not RPC error
retries = 0
}
// maximum 5 second buffer for rate-limiting
if (shouldRetry) {
const isRetry = i !== 5
const shouldRetryAgain = retries < 5
sleep(1000 * i).then(() =>
this.getPastEvents({ fromBlock, toBlock, type }, isRetry, i)
sleep(1000 * retries).then(() =>
this.getPastEvents({ fromBlock, toBlock, type }, shouldRetryAgain, retries)
.then((events) => resolve(events))
.catch((_) => resolve(undefined))
)
@ -324,19 +334,18 @@ class EventService {
async getBatchEventsFromRpc({ fromBlock, type }) {
try {
const batchSize = 10
const blockRange = 10000
let [events, failed] = [[], []]
let lastBlock = fromBlock
const { blockDifference, currentBlockNumber } = await this.getBlocksDiff({ fromBlock })
const batchDigest = blockDifference === 0 ? 1 : Math.ceil(blockDifference / blockRange)
const batchDigest = blockDifference === 0 ? 1 : Math.ceil(blockDifference / blockSyncInterval)
const blockDenom = Math.ceil(blockDifference / batchDigest)
const batchCount = Math.ceil(batchDigest / batchSize)
if (fromBlock < currentBlockNumber) {
await this.updateEventProgress(0, type)
this.updateEventProgress(0, type)
for (let batchIndex = 0; batchIndex < batchCount; batchIndex++) {
const isLastBatch = batchIndex === batchCount - 1
@ -365,7 +374,7 @@ class EventService {
throw new Error('Failed to batch events')
}
}
await this.updateEventProgress(progressIndex / batchCount, type)
this.updateEventProgress(progressIndex / batchCount, type)
}
return {
@ -383,11 +392,10 @@ class EventService {
async getEventsFromRpc({ fromBlock, type }) {
try {
const { blockDifference } = await this.getBlocksDiff({ fromBlock })
const blockRange = 10000
let events
if (blockDifference < blockRange) {
if (blockDifference < blockSyncInterval) {
const rpcEvents = await this.getEventsPartFromRpc({ fromBlock, toBlock: 'latest', type })
events = rpcEvents?.events || []
} else {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,2 @@
xÚ}ĐËjSQŕůyŠÍwđ_öËĚÄůâ`_i0&<26>¦ HßÝA-µ|_”~.)Ą´ŢŻë.­đCÄ
î­H=°m]¶,ŃöčĐ'R4µăáăŔőáµ7ÇXwiEÔ@Žěoy=_Ű·ĎĎß븭»<14>ŞDżłËóů|š§qűTž_ďq W±^<5E>J'<27>)-¬UíE´»ˇ)ąőaS©<53>RT\ŮU‡ľÝŢoĺňTÚýt˝üŻ Ęv'"˛ÜÍĘłeŤě•y ˘™zD*MÝ:4µG”uIéĺá_3lđDŽ®yşđFĽ/[Ű:€°Ú1äPŃĘ_fLh¨ŮÉB˙c†„úZés+G#Ă<>HÓ}­¤AÓ†9<14>ŽŤjs*śGŘśď˘ĺˇDx<08>MŇ>Ů@ϢӢ!dć†ÔÚ@'Ţ˝K†N„ëŇËňuůAČťŁ

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,2 @@
x<EFBFBD>ֱ1
€0 @ׁ»<D781>9C<39>$ַ)₪¬´U0המ¾<17>h<74><EFBFBD>?C7¡ת|<7C>^4¨«5»׀Ha <0A>;´<>~

@ -0,0 +1,2 @@
ÁK
ƒ0…ѽ|ã;øÕ˜Ê]Ž!”:ðÑBCöî9<C3AE>ž³xã1ÄYÿ¿ÄZ¯o-?ÜXïm+n]Ü{½ÜbÀ9‰/bÂ!NbÆ!2ŽÞûsý

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More