From 87fa425dbfb7a85e13dbb17383b34946f357bc72 Mon Sep 17 00:00:00 2001 From: harsh9200 Date: Tue, 18 Jun 2024 23:19:52 +0530 Subject: [PATCH] Add blast network to price lib --- subgraphs/renzo/src/prices/common/utils.ts | 3 + subgraphs/renzo/src/prices/config/blast.ts | 131 +++++++++++++++++++++ 2 files changed, 134 insertions(+) create mode 100644 subgraphs/renzo/src/prices/config/blast.ts diff --git a/subgraphs/renzo/src/prices/common/utils.ts b/subgraphs/renzo/src/prices/common/utils.ts index 18116b8c92..6dcd6cc1f2 100644 --- a/subgraphs/renzo/src/prices/common/utils.ts +++ b/subgraphs/renzo/src/prices/common/utils.ts @@ -2,6 +2,7 @@ import * as BSC from "../config/bsc"; import * as CELO from "../config/celo"; import * as FUSE from "../config/fuse"; import * as XDAI from "../config/gnosis"; +import * as BLAST from "../config/blast"; import * as CRONOS from "../config/cronos"; import * as AURORA from "../config/aurora"; import * as FANTOM from "../config/fantom"; @@ -105,6 +106,8 @@ export function getConfig(): Configurations { return new CELO.config(); } else if (network == FUSE.NETWORK_STRING) { return new FUSE.config(); + } else if (network == BLAST.NETWORK_STRING) { + return new BLAST.config(); } return new TEMPLATE.config(); diff --git a/subgraphs/renzo/src/prices/config/blast.ts b/subgraphs/renzo/src/prices/config/blast.ts new file mode 100644 index 0000000000..8b788d0697 --- /dev/null +++ b/subgraphs/renzo/src/prices/config/blast.ts @@ -0,0 +1,131 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ +import * as constants from "../common/constants"; +import { Address, BigInt, ethereum } from "@graphprotocol/graph-ts"; +import { Configurations, OracleConfig, OracleContract } from "../common/types"; + +export const NETWORK_STRING = "blast-mainnet"; + +/////////////////////////////////////////////////////////////////////////// +///////////////////// CALCULATIONS/ORACLE CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_CONTRACT_ADDRESS = new OracleContract(); +export const CHAIN_LINK_CONTRACT_ADDRESS = new OracleContract(); +export const AAVE_ORACLE_CONTRACT_ADDRESS = new OracleContract(); +export const SUSHISWAP_CALCULATIONS_ADDRESS = new OracleContract(); + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////// CURVE CONTRACT ////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const CURVE_CALCULATIONS_ADDRESS = new OracleContract(); + +export const CURVE_REGISTRY_ADDRESSES: OracleContract[] = []; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// UNISWAP FORKS CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const UNISWAP_FORKS_ROUTER_ADDRESSES: OracleContract[] = [ + new OracleContract("0x98994a9a7a2570367554589189dc9772241650f6", 157110), // Thruster v2 Router1 + new OracleContract("0x44889b52b71e60de6ed7de82e2939fcc52fb2b4e", 157501), // Thruster v2 Router2 + new OracleContract("0x54cf3d259a06601b5bc45f61a16443ed5404dd64", 285726), // Sushiswap v2 Router02 +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// BLACKLISTED TOKENS //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_BLACKLIST: Address[] = []; +export const AAVE_ORACLE_BLACKLIST: Address[] = []; +export const CURVE_CALCULATIONS_BLACKSLIST: Address[] = []; +export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +//////////////////////////// HARDCODED STABLES //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const HARDCODED_STABLES: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////////// HELPERS ///////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const USDC_TOKEN_DECIMALS = BigInt.fromI32(18); + +export const ETH_ADDRESS = constants.NULL.TYPE_ADDRESS; +export const WETH_ADDRESS = Address.fromString( + "0x4300000000000000000000000000000000000004" +); +export const USDC_ADDRESS = Address.fromString( + "0x4300000000000000000000000000000000000003" +); + +export class config implements Configurations { + network(): string { + return NETWORK_STRING; + } + + yearnLens(): OracleContract { + return YEARN_LENS_CONTRACT_ADDRESS; + } + chainLink(): OracleContract { + return CHAIN_LINK_CONTRACT_ADDRESS; + } + yearnLensBlacklist(): Address[] { + return YEARN_LENS_BLACKLIST; + } + + aaveOracle(): OracleContract { + return AAVE_ORACLE_CONTRACT_ADDRESS; + } + aaveOracleBlacklist(): Address[] { + return AAVE_ORACLE_BLACKLIST; + } + + curveCalculations(): OracleContract { + return CURVE_CALCULATIONS_ADDRESS; + } + curveCalculationsBlacklist(): Address[] { + return CURVE_CALCULATIONS_BLACKSLIST; + } + + sushiCalculations(): OracleContract { + return SUSHISWAP_CALCULATIONS_ADDRESS; + } + sushiCalculationsBlacklist(): Address[] { + return SUSHI_CALCULATIONS_BLACKSLIST; + } + + uniswapForks(): OracleContract[] { + return UNISWAP_FORKS_ROUTER_ADDRESSES; + } + curveRegistry(): OracleContract[] { + return CURVE_REGISTRY_ADDRESSES; + } + + hardcodedStables(): Address[] { + return HARDCODED_STABLES; + } + + ethAddress(): Address { + return ETH_ADDRESS; + } + wethAddress(): Address { + return WETH_ADDRESS; + } + usdcAddress(): Address { + return USDC_ADDRESS; + } + + usdcTokenDecimals(): BigInt { + return USDC_TOKEN_DECIMALS; + } + + getOracleOverride( + tokenAddr: Address | null, + block: ethereum.Block | null + ): OracleConfig | null { + return null; + } +}