From f9bcf579346ac3bb29fabff007132d555cfb358b Mon Sep 17 00:00:00 2001 From: rlekdms Date: Fri, 7 Feb 2025 19:59:52 +0900 Subject: [PATCH] Migrate vault assets from ethereum to silicon zkevm (#13410) Co-authored-by: Juan Ignacio Ubeira Co-authored-by: Juan Ignacio Ubeira Co-authored-by: Divyanshu Chauhan <53409372+divinit7@users.noreply.github.com> Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Co-authored-by: jan-magpie <155635960+jan-magpie@users.noreply.github.com> Co-authored-by: Fuxing Loh <4266087+fuxingloh@users.noreply.github.com> Co-authored-by: Pekaz --- projects/fizzswap-v2/index.js | 4 ++++ projects/fizzswap-v3/index.js | 35 +++++++++++++++++++++++++++++++++ projects/helper/chains.json | 1 + projects/helper/env.js | 1 + projects/helper/tokenMapping.js | 5 +++++ projects/orbitbridge/index.js | 5 ++++- 6 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 projects/fizzswap-v2/index.js create mode 100644 projects/fizzswap-v3/index.js diff --git a/projects/fizzswap-v2/index.js b/projects/fizzswap-v2/index.js new file mode 100644 index 0000000000..69e76d21f5 --- /dev/null +++ b/projects/fizzswap-v2/index.js @@ -0,0 +1,4 @@ +const { uniTvlExports } = require('../helper/unknownTokens') +module.exports = uniTvlExports({ + silicon_zk: '0xCB72354080A1d3B8A48425B889025d0799c52095' +}) diff --git a/projects/fizzswap-v3/index.js b/projects/fizzswap-v3/index.js new file mode 100644 index 0000000000..78f2b7f743 --- /dev/null +++ b/projects/fizzswap-v3/index.js @@ -0,0 +1,35 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') + +async function v3Tvl(api) { + const factory = '0x2aeEC787Be499ef6f68e527B64FADF969D048042'; + const WETH = '0xe66863b695a392507f5d68b6a7b8aa8218914059'.toLowerCase(); + + const fromBlock = 1; + const eventAbi = 'event PoolCreated(address indexed token0, address indexed token1, uint24 indexed fee, int24 tickSpacing, address pool, uint256 exid)'; + const topics = [ + '0x20a108faf9dc51ca2b459a109d08568e65a9cb87569b6b3a334c275d504ff94f', + ]; + + const logs = await getLogs({ + api, + target: factory, + topics, + fromBlock, + eventAbi, + onlyArgs: true, + }) + + return sumTokens2({ + api, ownerTokens: logs.map(i => { + return [[(i.token0.toLowerCase() == WETH) ? ADDRESSES.null : i.token0, i.token1], i.pool] + }), + }) +} + +module.exports = { + silicon_zk: { + tvl: v3Tvl, + }, +} \ No newline at end of file diff --git a/projects/helper/chains.json b/projects/helper/chains.json index c0268e2583..3315394d05 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -315,6 +315,7 @@ "shido", "shimmer_evm", "sifchain", + "silicon_zk", "smartbch", "solana", "sommelier", diff --git a/projects/helper/env.js b/projects/helper/env.js index c67c181ad3..b9d5c59bc1 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -27,6 +27,7 @@ const DEFAULTS = { ABSTRACT_RPC: "https://api.mainnet.abs.xyz", BERACHAIN_RPC: "https://rpc.berachain.com", BERACHAIN_RPC_MULTICALL: "0xcA11bde05977b3631167028862bE2a173976CA11", + SILICON_ZK_RPC_MULTICALL: "0x566da61a4D0841a67bA8F2c7e5975885fa0Af4DA", } const ENV_KEYS = [ diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index da4fca1184..8c5d1e6888 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -57,6 +57,11 @@ const fixBalancesTokens = { aptos: { '0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b': { coingeckoId: "usd-coin", decimals: 6 }, }, + silicon_zk: { + '0x0000000000000000000000000000000000000000': { coingeckoId: "ethereum", decimals: 18 }, + '0xe66863b695a392507f5d68b6a7b8aa8218914059': { coingeckoId: "ethereum", decimals: 18 }, + '0x1e4a5963abfd975d8c9021ce480b42188849d41d': { coingeckoId: "tether", decimals: 18 }, + }, } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) diff --git a/projects/orbitbridge/index.js b/projects/orbitbridge/index.js index b476704226..cae28d5a2c 100644 --- a/projects/orbitbridge/index.js +++ b/projects/orbitbridge/index.js @@ -18,7 +18,8 @@ const vaults = { klaytn: '0x9abc3f6c11dbd83234d6e6b2c373dfc1893f648d', polygon: '0x506DC4c6408813948470a06ef6e4a1DaF228dbd5', meta: '0x292A00F3b99e3CB9b324EdbaA92258C3C61b55ab', - wemix: '0x445F863df0090f423A6D7005581e30d5841e4D6d' + wemix: '0x445F863df0090f423A6D7005581e30d5841e4D6d', + silicon_zk: '0x5aAAcf28ECDd691b4a657684135d8848d38236Bb' } const farms = { @@ -48,6 +49,7 @@ async function tvl(api) { let targetChain = chain if (chain === 'ethereum') targetChain = 'eth' if (chain === 'polygon') targetChain = 'matic' + if (chain === 'silicon_zk') targetChain = 'silicon' const tokenListURL = 'https://bridge.orbitchain.io/open/v1/api/monitor/rawTokenList' tokenData = tokenData || getConfig('orbit-bridge', tokenListURL) @@ -83,6 +85,7 @@ module.exports = { polygon: { tvl }, meta: { tvl }, wemix: { tvl }, + silicon_zk: { tvl }, ripple: { tvl: sumTokensExport({ owner: 'rLcxBUrZESqHnruY4fX7GQthRjDCDSAWia' }) },