From d5b61bf88dcb6cf379f787323a46bbc6b17425fb Mon Sep 17 00:00:00 2001 From: Michael Wang <44713145+mzywang@users.noreply.github.com> Date: Fri, 8 Mar 2024 10:24:09 -0500 Subject: [PATCH] update for blast-mainnet --- src/utils/constants.ts | 2 +- src/utils/pricing.ts | 43 ++++++---------------- src/utils/staticTokenDefinition.ts | 58 +----------------------------- subgraph.yaml | 17 ++++----- 4 files changed, 19 insertions(+), 101 deletions(-) diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 52a71a92..c144fb08 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -3,7 +3,7 @@ import { BigInt, BigDecimal, Address } from '@graphprotocol/graph-ts' import { Factory as FactoryContract } from '../types/templates/Pool/Factory' export const ADDRESS_ZERO = '0x0000000000000000000000000000000000000000' -export const FACTORY_ADDRESS = '0x1F98431c8aD98523631AE4a59f267346ea31F984' +export const FACTORY_ADDRESS = '0x792edAdE80af5fC680d96a2eD80A44247D2Cf6Fd' export let ZERO_BI = BigInt.fromI32(0) export let ONE_BI = BigInt.fromI32(1) diff --git a/src/utils/pricing.ts b/src/utils/pricing.ts index 1a8a19cf..a61aa4e8 100644 --- a/src/utils/pricing.ts +++ b/src/utils/pricing.ts @@ -4,45 +4,22 @@ import { Bundle, Pool, Token } from './../types/schema' import { BigDecimal, BigInt } from '@graphprotocol/graph-ts' import { exponentToBigDecimal, safeDiv } from '../utils/index' -const WETH_ADDRESS = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' -const USDC_WETH_03_POOL = '0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8' +const WETH_ADDRESS = '0x4300000000000000000000000000000000000004' +const USDB_ADDRESS = '0x4300000000000000000000000000000000000003' // native blast stablecoin +const USDB_WETH_3000_POOL = '0xf52b4b69123cbcf07798ae8265642793b2e8990c' // token where amounts should contribute to tracked volume and liquidity // usually tokens that many tokens are paired with s export let WHITELIST_TOKENS: string[] = [ - WETH_ADDRESS, // WETH - '0x6b175474e89094c44da98b954eedeac495271d0f', // DAI - '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // USDC - '0xdac17f958d2ee523a2206206994597c13d831ec7', // USDT - '0x0000000000085d4780b73119b644ae5ecd22b376', // TUSD - '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', // WBTC - '0x5d3a536e4d6dbd6114cc1ead35777bab948e3643', // cDAI - '0x39aa39c021dfbae8fac545936693ac917d5e7563', // cUSDC - '0x86fadb80d8d2cff3c3680819e4da99c10232ba0f', // EBASE - '0x57ab1ec28d129707052df4df418d58a2d46d5f51', // sUSD - '0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2', // MKR - '0xc00e94cb662c3520282e6f5717214004a7f26888', // COMP - '0x514910771af9ca656af840dff83e8264ecf986ca', // LINK - '0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f', // SNX - '0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e', // YFI - '0x111111111117dc0aa78b770fa6a738034120c302', // 1INCH - '0xdf5e0e81dff6faf3a7e52ba697820c5e32d806a8', // yCurv - '0x956f47f50a910163d8bf957cf5846d573e7f87ca', // FEI - '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0', // MATIC - '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9', // AAVE - '0xfe2e637202056d30016725477c5da089ab0a043a' // sETH2 + WETH_ADDRESS, + USDB_ADDRESS ] let STABLE_COINS: string[] = [ - '0x6b175474e89094c44da98b954eedeac495271d0f', - '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', - '0xdac17f958d2ee523a2206206994597c13d831ec7', - '0x0000000000085d4780b73119b644ae5ecd22b376', - '0x956f47f50a910163d8bf957cf5846d573e7f87ca', - '0x4dd28568d05f09b02220b09c2cb307bfd837cb95' + USDB_ADDRESS ] -let MINIMUM_ETH_LOCKED = BigDecimal.fromString('60') +let MINIMUM_ETH_LOCKED = BigDecimal.fromString('1') let Q192 = 2 ** 192 export function sqrtPriceX96ToTokenPrices(sqrtPriceX96: BigInt, token0: Token, token1: Token): BigDecimal[] { @@ -59,9 +36,9 @@ export function sqrtPriceX96ToTokenPrices(sqrtPriceX96: BigInt, token0: Token, t export function getEthPriceInUSD(): BigDecimal { // fetch eth prices for each stablecoin - let usdcPool = Pool.load(USDC_WETH_03_POOL) // dai is token0 - if (usdcPool !== null) { - return usdcPool.token0Price + let usdbPool = Pool.load(USDB_WETH_3000_POOL) // usdb is token0 + if (usdbPool !== null) { + return usdbPool.token0Price } else { return ZERO_BD } diff --git a/src/utils/staticTokenDefinition.ts b/src/utils/staticTokenDefinition.ts index bb805f2d..69331d14 100644 --- a/src/utils/staticTokenDefinition.ts +++ b/src/utils/staticTokenDefinition.ts @@ -20,63 +20,7 @@ export class StaticTokenDefinition { // Get all tokens with a static defintion static getStaticDefinitions(): Array { - let staticDefinitions = new Array(6) - - // Add DGD - let tokenDGD = new StaticTokenDefinition( - Address.fromString('0xe0b7927c4af23765cb51314a0e0521a9645f0e2a'), - 'DGD', - 'DGD', - BigInt.fromI32(9) - ) - staticDefinitions.push(tokenDGD) - - // Add AAVE - let tokenAAVE = new StaticTokenDefinition( - Address.fromString('0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9'), - 'AAVE', - 'Aave Token', - BigInt.fromI32(18) - ) - staticDefinitions.push(tokenAAVE) - - // Add LIF - let tokenLIF = new StaticTokenDefinition( - Address.fromString('0xeb9951021698b42e4399f9cbb6267aa35f82d59d'), - 'LIF', - 'Lif', - BigInt.fromI32(18) - ) - staticDefinitions.push(tokenLIF) - - // Add SVD - let tokenSVD = new StaticTokenDefinition( - Address.fromString('0xbdeb4b83251fb146687fa19d1c660f99411eefe3'), - 'SVD', - 'savedroid', - BigInt.fromI32(18) - ) - staticDefinitions.push(tokenSVD) - - // Add TheDAO - let tokenTheDAO = new StaticTokenDefinition( - Address.fromString('0xbb9bc244d798123fde783fcc1c72d3bb8c189413'), - 'TheDAO', - 'TheDAO', - BigInt.fromI32(16) - ) - staticDefinitions.push(tokenTheDAO) - - // Add HPB - let tokenHPB = new StaticTokenDefinition( - Address.fromString('0x38c6a68304cdefb9bec48bbfaaba5c5b47818bb2'), - 'HPB', - 'HPBCoin', - BigInt.fromI32(18) - ) - staticDefinitions.push(tokenHPB) - - return staticDefinitions + return new Array(0) } // Helper for hardcoded tokens diff --git a/subgraph.yaml b/subgraph.yaml index ee6d649e..144542e7 100644 --- a/subgraph.yaml +++ b/subgraph.yaml @@ -3,19 +3,16 @@ description: Uniswap is a decentralized protocol for automated token exchange on repository: https://github.com/Uniswap/uniswap-v3-subgraph schema: file: ./schema.graphql -graft: - base: QmPrb5mvZj3ycUugZgwLWCvK93jfXfhvfjRXrFk4tRmyCX - block: 14292820 features: - nonFatalErrors dataSources: - kind: ethereum/contract name: Factory - network: mainnet + network: blast-mainnet source: - address: '0x1F98431c8aD98523631AE4a59f267346ea31F984' + address: '0x792edAdE80af5fC680d96a2eD80A44247D2Cf6Fd' abi: Factory - startBlock: 12369621 + startBlock: 400903 mapping: kind: ethereum/events apiVersion: 0.0.4 @@ -40,11 +37,11 @@ dataSources: handler: handlePoolCreated - kind: ethereum/contract name: NonfungiblePositionManager - network: mainnet + network: blast-mainnet source: - address: '0xC36442b4a4522E871399CD717aBDD847Ab11FE88' + address: '0xB218e4f7cF0533d4696fDfC419A0023D33345F28' abi: NonfungiblePositionManager - startBlock: 12369651 + startBlock: 400947 mapping: kind: ethereum/events apiVersion: 0.0.4 @@ -74,7 +71,7 @@ dataSources: templates: - kind: ethereum/contract name: Pool - network: mainnet + network: blast-mainnet source: abi: Pool mapping: