Skip to content
This repository has been archived by the owner on Feb 14, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop' of github.com:hop-protocol/explorer into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelmota committed Feb 7, 2024
2 parents ad0a0ae + 4992e03 commit 2a666e4
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 12 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ ARBITRUM_RPC=
NOVA_RPC=
BASE_RPC=
LINEA_RPC=
POLYGONZK_RPC=
```

```sh
Expand Down
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"typescript": "^4.6.3"
},
"dependencies": {
"@hop-protocol/core": "^0.0.1-beta.203",
"@hop-protocol/core": "^0.0.1-beta.219",
"@types/memory-cache": "^0.2.2",
"@types/pidusage": "^2.0.2",
"cors": "^2.8.5",
Expand Down
40 changes: 31 additions & 9 deletions backend/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const postgresConfig = {
maxConnections: process.env.POSTGRES_MAX_CONNECTIONS ? parseInt(process.env.POSTGRES_MAX_CONNECTIONS, 10) : 10
}
export const regenesisEnabled = process.env.REGENESIS_ENABLED === 'true'
export const CoingeckoApiKey = process.env.COINGECKO_API_KEY || ''

const tokenSet = new Set([])
const chainSet = new Set([])
Expand Down Expand Up @@ -61,7 +62,8 @@ export const transferTimes = {
gnosis: 20,
nova: 10,
base: 2,
linea: 20
linea: 20,
polygonzk: 20
},
optimism: {
ethereum: 25,
Expand All @@ -70,7 +72,8 @@ export const transferTimes = {
gnosis: 25,
nova: 25,
base: 25,
linea: 25
linea: 25,
polygonzk: 25
},
arbitrum: {
ethereum: 12,
Expand All @@ -79,7 +82,8 @@ export const transferTimes = {
gnosis: 12,
nova: 12,
base: 12,
linea: 12
linea: 12,
polygonzk: 12
},
polygon: {
ethereum: 10,
Expand All @@ -88,7 +92,8 @@ export const transferTimes = {
gnosis: 10,
nova: 10,
base: 10,
linea: 10
linea: 10,
polygonzk: 10
},
gnosis: {
ethereum: 4,
Expand All @@ -97,7 +102,8 @@ export const transferTimes = {
polygon: 4,
nova: 4,
base: 4,
linea: 4
linea: 4,
polygonzk: 4
},
nova: {
ethereum: 12,
Expand All @@ -106,7 +112,8 @@ export const transferTimes = {
polygon: 12,
gnosis: 12,
base: 12,
linea: 12
linea: 12,
polygonzk: 12
},
base: {
ethereum: 25,
Expand All @@ -115,7 +122,8 @@ export const transferTimes = {
polygon: 25,
gnosis: 25,
nova: 25,
linea: 25
linea: 25,
polygonzk: 25
},
linea: {
ethereum: 25,
Expand All @@ -124,7 +132,18 @@ export const transferTimes = {
polygon: 25,
gnosis: 25,
nova: 25,
base: 25
base: 25,
polygonzk: 25
},
polygonzk: {
ethereum: 5,
optimism: 5,
arbitrum: 5,
polygon: 5,
gnosis: 5,
nova: 5,
base: 5,
linea: 5
},
scroll: {
ethereum: 1,
Expand All @@ -133,7 +152,9 @@ export const transferTimes = {
polygon: 1,
gnosis: 1,
nova: 1,
base: 1
base: 1,
linea: 1,
polygonzk: 1
}
}

Expand All @@ -144,6 +165,7 @@ const _integrationsMap : Record<string, string> = {
'0x3a23f943181408eac424116af7b7790c94cb97a5': 'socket', // socket gateway
'0x362fa9d0bca5d19f743db50738345ce2b40ec99f': 'lifi',
'0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae': 'lifi',
'0xde1e598b81620773454588b85d6b5d4eec32573e': 'lifi',
'0x82e0b8cdd80af5930c4452c684e71c861148ec8a': 'metamask',
'0x0439e60f02a8900a951603950d8d4527f400c3f1': 'metamask', // mainnet
'0xb90357f2b86dbfd59c3502215d4060f71df8ca0e': 'metamask', // optimism
Expand Down
4 changes: 3 additions & 1 deletion backend/src/price.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fetch from 'isomorphic-fetch'
import { tokens } from '@hop-protocol/core/metadata'
import { CoingeckoApiKey } from './config'

function getCoinId (tokenSymbol: string) {
return tokens[tokenSymbol]?.coingeckoId
Expand All @@ -11,7 +12,7 @@ export async function getPriceHistory (tokenSymbol: string, days: number) {
throw new Error(`coingecko coin id not found for token "${tokenSymbol}"`)
}

const url = `https://api.coingecko.com/api/v3/coins/${coinId}/market_chart?vs_currency=usd&days=${days}&interval=daily`
const url = `https://pro-api.coingecko.com/api/v3/coins/${coinId}/market_chart?vs_currency=usd&days=${days}&interval=daily&x_cg_pro_api_key=${CoingeckoApiKey}`
console.log(url)
return Promise.race([fetch(url)
.then(async (res: any) => {
Expand All @@ -22,6 +23,7 @@ export async function getPriceHistory (tokenSymbol: string, days: number) {
})
.then((json: any) => {
console.log('fetched', coinId)
console.log('debug', JSON.stringify(json))
return json.prices.map((data: any[]) => {
data[0] = Math.floor(data[0] / 1000)
return data
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"dependencies": {
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@hop-protocol/core": "^0.0.1-beta.203",
"@hop-protocol/core": "^0.0.1-beta.204",
"@mui/icons-material": "^5.11.0",
"@mui/material": "^5.11.8",
"@mui/styles": "^5.11.7",
Expand Down

0 comments on commit 2a666e4

Please sign in to comment.