diff --git a/subgraphs/renzo/protocols/renzo/config/deployments/renzo-arbitrum/configurations.json b/subgraphs/renzo/protocols/renzo/config/deployments/renzo-arbitrum/configurations.json index 8191e1d81a..303c76706f 100644 --- a/subgraphs/renzo/protocols/renzo/config/deployments/renzo-arbitrum/configurations.json +++ b/subgraphs/renzo/protocols/renzo/config/deployments/renzo-arbitrum/configurations.json @@ -1,6 +1,10 @@ { "network": "arbitrum-one", + "DepositQueue": { + "address": "0xf25484650484de3d554fb0b7125e7696efa4ab99", + "startBlock": "185410811" + }, "ezETH": { "address": "0x2416092f143378750bb29b79ed961ab195cceea5", "startBlock": "185410162" diff --git a/subgraphs/renzo/protocols/renzo/config/deployments/renzo-base/configurations.json b/subgraphs/renzo/protocols/renzo/config/deployments/renzo-base/configurations.json index a2cb4f77d3..503bd9b333 100644 --- a/subgraphs/renzo/protocols/renzo/config/deployments/renzo-base/configurations.json +++ b/subgraphs/renzo/protocols/renzo/config/deployments/renzo-base/configurations.json @@ -1,7 +1,11 @@ { "network": "base", - "RestakeManager": { + "DepositQueue": { + "address": "0xf25484650484de3d554fb0b7125e7696efa4ab99", + "startBlock": "12682217" + }, + "ezETH": { "address": "0x2416092f143378750bb29b79ed961ab195cceea5", "startBlock": "12682160" }, diff --git a/subgraphs/renzo/protocols/renzo/config/deployments/renzo-blast-mainnet/configurations.json b/subgraphs/renzo/protocols/renzo/config/deployments/renzo-blast-mainnet/configurations.json index ff7c5329d2..ef1076bbd6 100644 --- a/subgraphs/renzo/protocols/renzo/config/deployments/renzo-blast-mainnet/configurations.json +++ b/subgraphs/renzo/protocols/renzo/config/deployments/renzo-blast-mainnet/configurations.json @@ -1,6 +1,10 @@ { "network": "blast-mainnet", + "DepositQueue": { + "address": "0xe65843850106421eab49dd43d19fa2d75fc19a75", + "startBlock": "1031132" + }, "ezETH": { "address": "0x2416092f143378750bb29b79ed961ab195cceea5", "startBlock": "722967" diff --git a/subgraphs/renzo/protocols/renzo/config/deployments/renzo-bsc/configurations.json b/subgraphs/renzo/protocols/renzo/config/deployments/renzo-bsc/configurations.json index e5a96e6b54..6381c98f68 100644 --- a/subgraphs/renzo/protocols/renzo/config/deployments/renzo-bsc/configurations.json +++ b/subgraphs/renzo/protocols/renzo/config/deployments/renzo-bsc/configurations.json @@ -1,7 +1,11 @@ { "network": "bsc", - "RestakeManager": { + "DepositQueue": { + "address": "0xf25484650484de3d554fb0b7125e7696efa4ab99", + "startBlock": "36596596" + }, + "ezETH": { "address": "0x2416092f143378750bb29b79ed961ab195cceea5", "startBlock": "36596546" }, diff --git a/subgraphs/renzo/protocols/renzo/config/deployments/renzo-mode/configurations.json b/subgraphs/renzo/protocols/renzo/config/deployments/renzo-mode/configurations.json index a40b41e3e5..d937bfabad 100644 --- a/subgraphs/renzo/protocols/renzo/config/deployments/renzo-mode/configurations.json +++ b/subgraphs/renzo/protocols/renzo/config/deployments/renzo-mode/configurations.json @@ -1,7 +1,11 @@ { "network": "base", - "RestakeManager": { + "DepositQueue": { + "address": "0x4d7572040b84b41a6aa2efe4a93efff182388f88", + "startBlock": "5005667" + }, + "ezETH": { "address": "0x2416092f143378750bb29b79ed961ab195cceea5", "startBlock": "4749150" }, diff --git a/subgraphs/renzo/protocols/renzo/config/templates/renzo.template.yaml b/subgraphs/renzo/protocols/renzo/config/templates/renzo.template.yaml index 787296699d..a11eb83d75 100644 --- a/subgraphs/renzo/protocols/renzo/config/templates/renzo.template.yaml +++ b/subgraphs/renzo/protocols/renzo/config/templates/renzo.template.yaml @@ -88,6 +88,8 @@ dataSources: abis: - name: DepositQueue file: ./abis/DepositQueue.json + - name: RestakeManager + file: ./abis/RestakeManager.json - name: ERC20 file: ./abis/ERC20.json diff --git a/subgraphs/renzo/src/common/initializers.ts b/subgraphs/renzo/src/common/initializers.ts index a9cf6ae4b6..c82c433c03 100644 --- a/subgraphs/renzo/src/common/initializers.ts +++ b/subgraphs/renzo/src/common/initializers.ts @@ -3,11 +3,11 @@ import { SDK } from "../sdk/protocols/generic"; import * as constants from "../common/constants"; import { Pool } from "../sdk/protocols/generic/pool"; import { ProtocolConfig } from "../sdk/protocols/config"; -import { ERC20 } from "../../generated/RestakeManager/ERC20"; +import { ERC20 } from "../../generated/DepositQueue/ERC20"; import { Pricer, TokenInit, readValue } from "../common/utils"; import { Address, BigInt, ethereum } from "@graphprotocol/graph-ts"; -import { DepositQueue } from "../../generated/RestakeManager/DepositQueue"; -import { RestakeManager } from "../../generated/RestakeManager/RestakeManager"; +import { DepositQueue } from "../../generated/DepositQueue/DepositQueue"; +import { RestakeManager } from "../../generated/DepositQueue/RestakeManager"; export function initializeSDKFromEvent(event: ethereum.Event): SDK { const protocolConfig = new ProtocolConfig( diff --git a/subgraphs/renzo/src/common/utils.ts b/subgraphs/renzo/src/common/utils.ts index 24b0d49f64..4ca3d8b7eb 100644 --- a/subgraphs/renzo/src/common/utils.ts +++ b/subgraphs/renzo/src/common/utils.ts @@ -2,8 +2,8 @@ import { Token } from "../../generated/schema"; import * as constants from "../common/constants"; import { TokenPricer } from "../sdk/protocols/config"; import { bigIntToBigDecimal } from "../sdk/util/numbers"; +import { ERC20 } from "../../generated/DepositQueue/ERC20"; import { getUsdPrice, getUsdPricePerToken } from "../prices"; -import { ERC20 } from "../../generated/RestakeManager/ERC20"; import { Address, BigDecimal, BigInt, ethereum } from "@graphprotocol/graph-ts"; import { TokenParams, TokenInitializer } from "../sdk/protocols/generic/tokens"; diff --git a/subgraphs/renzo/src/mappings/ezEthMappings.ts b/subgraphs/renzo/src/mappings/ezEthMappings.ts index f4e2df8fb0..ec95a2d6e4 100644 --- a/subgraphs/renzo/src/mappings/ezEthMappings.ts +++ b/subgraphs/renzo/src/mappings/ezEthMappings.ts @@ -1,58 +1,12 @@ import { Versions } from "../versions"; -import { Token } from "../../generated/schema"; import { SDK } from "../sdk/protocols/generic"; import * as constants from "../common/constants"; import { ERC20 } from "../../generated/ezETH/ERC20"; import { Pool } from "../sdk/protocols/generic/pool"; -import { bigIntToBigDecimal } from "../sdk/util/numbers"; -import { getUsdPrice, getUsdPricePerToken } from "../prices"; +import { ProtocolConfig } from "../sdk/protocols/config"; +import { Pricer, TokenInit, readValue } from "../common/utils"; import { MintCall, BurnCall } from "../../generated/ezETH/ezETH"; -import { ProtocolConfig, TokenPricer } from "../sdk/protocols/config"; -import { Address, BigDecimal, BigInt, ethereum } from "@graphprotocol/graph-ts"; -import { TokenInitializer, TokenParams } from "../sdk/protocols/generic/tokens"; - -export function readValue( - callResult: ethereum.CallResult, - defaultValue: T -): T { - return callResult.reverted ? defaultValue : callResult.value; -} - -export class Pricer implements TokenPricer { - getTokenPrice(token: Token): BigDecimal { - const pricedToken = Address.fromBytes(token.id); - - return getUsdPricePerToken(pricedToken).usdPrice; - } - - getAmountValueUSD(token: Token, amount: BigInt): BigDecimal { - const pricedToken = Address.fromBytes(token.id); - const _amount = bigIntToBigDecimal(amount, token.decimals); - - return getUsdPrice(pricedToken, _amount); - } -} - -export class TokenInit implements TokenInitializer { - getTokenParams(address: Address): TokenParams { - const contract = ERC20.bind(address); - let default_name = "unknown"; - let default_symbol = "UNKNOWN"; - let default_decimals = constants.INT_ZERO as i32; - - if (address == Address.fromString(constants.ETH_ADDRESS)) { - default_name = constants.ETH_NAME; - default_symbol = constants.ETH_SYMBOL; - default_decimals = constants.DEFAULT_DECIMALS as i32; - } - - const name = readValue(contract.try_name(), default_name); - const symbol = readValue(contract.try_symbol(), default_symbol); - const decimals = readValue(contract.try_decimals(), default_decimals); - - return new TokenParams(name, symbol, decimals); - } -} +import { Address, BigInt, ethereum } from "@graphprotocol/graph-ts"; export function initializeSDKFromCall(call: ethereum.Call): SDK { const protocolConfig = new ProtocolConfig( diff --git a/subgraphs/renzo/src/prices/calculations/CalculationsCurve.ts b/subgraphs/renzo/src/prices/calculations/CalculationsCurve.ts index b462754363..70967b7c19 100644 --- a/subgraphs/renzo/src/prices/calculations/CalculationsCurve.ts +++ b/subgraphs/renzo/src/prices/calculations/CalculationsCurve.ts @@ -2,7 +2,7 @@ import * as utils from "../common/utils"; import * as constants from "../common/constants"; import { CustomPriceType, OracleContract } from "../common/types"; import { Address, BigDecimal, BigInt, ethereum } from "@graphprotocol/graph-ts"; -import { CalculationsCurve as CalculationsCurveContract } from "../../../generated/RestakeManager/CalculationsCurve"; +import { CalculationsCurve as CalculationsCurveContract } from "../../../generated/DepositQueue/CalculationsCurve"; export function getCalculationsCurveContract( contract: OracleContract, diff --git a/subgraphs/renzo/src/prices/calculations/CalculationsSushiswap.ts b/subgraphs/renzo/src/prices/calculations/CalculationsSushiswap.ts index d1c1f2198e..f89885947f 100644 --- a/subgraphs/renzo/src/prices/calculations/CalculationsSushiswap.ts +++ b/subgraphs/renzo/src/prices/calculations/CalculationsSushiswap.ts @@ -2,7 +2,7 @@ import * as utils from "../common/utils"; import * as constants from "../common/constants"; import { CustomPriceType, OracleContract } from "../common/types"; import { Address, BigDecimal, BigInt, ethereum } from "@graphprotocol/graph-ts"; -import { CalculationsSushiSwap as CalculationsSushiContract } from "../../../generated/RestakeManager/CalculationsSushiSwap"; +import { CalculationsSushiSwap as CalculationsSushiContract } from "../../../generated/DepositQueue/CalculationsSushiSwap"; export function getSushiSwapContract( contract: OracleContract, diff --git a/subgraphs/renzo/src/prices/common/utils.ts b/subgraphs/renzo/src/prices/common/utils.ts index 6dcd6cc1f2..5940749571 100644 --- a/subgraphs/renzo/src/prices/common/utils.ts +++ b/subgraphs/renzo/src/prices/common/utils.ts @@ -1,4 +1,6 @@ import * as BSC from "../config/bsc"; +import * as BASE from "../config/base"; +import * as MODE from "../config/mode"; import * as CELO from "../config/celo"; import * as FUSE from "../config/fuse"; import * as XDAI from "../config/gnosis"; @@ -6,6 +8,7 @@ import * as BLAST from "../config/blast"; import * as CRONOS from "../config/cronos"; import * as AURORA from "../config/aurora"; import * as FANTOM from "../config/fantom"; +import * as SCROLL from "../config/scroll"; import * as POLYGON from "../config/polygon"; import * as MAINNET from "../config/mainnet"; import * as HARMONY from "../config/harmony"; @@ -13,11 +16,13 @@ import * as MOONBEAM from "../config/moonbeam"; import * as OPTIMISM from "../config/optimism"; import * as AVALANCHE from "../config/avalanche"; import * as ARBITRUM_ONE from "../config/arbitrum"; +import * as ZKSYNC_ERA from "../config/zksync_era"; +import * as POLYGON_ZKEVM from "../config/polygon_zkevm"; import { Configurations, CustomPriceType } from "./types"; import * as constants from "./constants"; import * as TEMPLATE from "../config/template"; -import { _ERC20 } from "../../../generated/RestakeManager/_ERC20"; +import { _ERC20 } from "../../../generated/DepositQueue/_ERC20"; import { Address, BigInt, @@ -108,6 +113,16 @@ export function getConfig(): Configurations { return new FUSE.config(); } else if (network == BLAST.NETWORK_STRING) { return new BLAST.config(); + } else if (network == BASE.NETWORK_STRING) { + return new BASE.config(); + } else if (network == MODE.NETWORK_STRING) { + return new MODE.config(); + } else if (network == POLYGON_ZKEVM.NETWORK_STRING) { + return new POLYGON_ZKEVM.config(); + } else if (network == SCROLL.NETWORK_STRING) { + return new SCROLL.config(); + } else if (network == ZKSYNC_ERA.NETWORK_STRING) { + return new ZKSYNC_ERA.config(); } return new TEMPLATE.config(); diff --git a/subgraphs/renzo/src/prices/config/base.ts b/subgraphs/renzo/src/prices/config/base.ts new file mode 100644 index 0000000000..3a5d77e710 --- /dev/null +++ b/subgraphs/renzo/src/prices/config/base.ts @@ -0,0 +1,130 @@ +/* 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 = "base"; + +/////////////////////////////////////////////////////////////////////////// +///////////////////// 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("0x8cfe327cec66d1c090dd72bd0ff11d690c33a2eb", 2910568), + new OracleContract("0x6bded42c6da8fbf0d2ba55b2fa120c5e0c8d7891", 2631217), +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// 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(6); + +export const ETH_ADDRESS = constants.NULL.TYPE_ADDRESS; +export const WETH_ADDRESS = Address.fromString( + "0x4200000000000000000000000000000000000006" +); +export const USDC_ADDRESS = Address.fromString( + "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913" +); + +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; + } +} diff --git a/subgraphs/renzo/src/prices/config/mode.ts b/subgraphs/renzo/src/prices/config/mode.ts new file mode 100644 index 0000000000..72cd4a38c7 --- /dev/null +++ b/subgraphs/renzo/src/prices/config/mode.ts @@ -0,0 +1,129 @@ +/* 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 = "mode-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("0xc1e624c810d297fd70ef53b0e08f44fabe468591", 3325344), +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// 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(6); + +export const ETH_ADDRESS = constants.NULL.TYPE_ADDRESS; +export const WETH_ADDRESS = Address.fromString( + "0x4200000000000000000000000000000000000006" +); +export const USDC_ADDRESS = Address.fromString( + "0xd988097fb8612cc24eec14542bc03424c656005f" +); + +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; + } +} diff --git a/subgraphs/renzo/src/prices/config/polygon_zkevm.ts b/subgraphs/renzo/src/prices/config/polygon_zkevm.ts new file mode 100644 index 0000000000..1d9f176621 --- /dev/null +++ b/subgraphs/renzo/src/prices/config/polygon_zkevm.ts @@ -0,0 +1,129 @@ +/* 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 = "polygon-zkevm"; + +/////////////////////////////////////////////////////////////////////////// +///////////////////// 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("0x8cfe327cec66d1c090dd72bd0ff11d690c33a2eb", 749657), +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// 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(6); + +export const ETH_ADDRESS = constants.NULL.TYPE_ADDRESS; +export const WETH_ADDRESS = Address.fromString( + "0x4f9a0e7fd2bf6067db6994cf12e4495df938e6e9" +); +export const USDC_ADDRESS = Address.fromString( + "0xa8ce8aee21bc2a48a5ef670afcc9274c7bbbc035" +); + +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; + } +} diff --git a/subgraphs/renzo/src/prices/config/scroll.ts b/subgraphs/renzo/src/prices/config/scroll.ts new file mode 100644 index 0000000000..143ba93810 --- /dev/null +++ b/subgraphs/renzo/src/prices/config/scroll.ts @@ -0,0 +1,129 @@ +/* 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 = "scroll"; + +/////////////////////////////////////////////////////////////////////////// +///////////////////// 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("0x5aeaf2883fbf30f3d62471154eda3c0c1b05942d", 81845), +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// 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(6); + +export const ETH_ADDRESS = constants.NULL.TYPE_ADDRESS; +export const WETH_ADDRESS = Address.fromString( + "0x5300000000000000000000000000000000000004" +); +export const USDC_ADDRESS = Address.fromString( + "0x06efdbff2a14a7c8e15944d1f4a48f9f95f663a4" +); + +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; + } +} diff --git a/subgraphs/renzo/src/prices/config/zksync_era.ts b/subgraphs/renzo/src/prices/config/zksync_era.ts new file mode 100644 index 0000000000..6f1122b785 --- /dev/null +++ b/subgraphs/renzo/src/prices/config/zksync_era.ts @@ -0,0 +1,130 @@ +/* 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 = "zksync-era"; + +/////////////////////////////////////////////////////////////////////////// +///////////////////// 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("0x5aeaf2883fbf30f3d62471154eda3c0c1b05942d", 8637850), + new OracleContract("0x18381c0f738146fb694de18d1106bde2be040fa4", 4182380), +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// 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(6); + +export const ETH_ADDRESS = constants.NULL.TYPE_ADDRESS; +export const WETH_ADDRESS = Address.fromString( + "0x5aea5775959fbc2557cc8789bc1bf90a239d9a91" +); +export const USDC_ADDRESS = Address.fromString( + "0x1d17cbcf0d6d143135ae902365d2e5e2a16538d4" +); + +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; + } +} diff --git a/subgraphs/renzo/src/prices/oracles/AaveOracle.ts b/subgraphs/renzo/src/prices/oracles/AaveOracle.ts index ef61fd779a..513a556e32 100644 --- a/subgraphs/renzo/src/prices/oracles/AaveOracle.ts +++ b/subgraphs/renzo/src/prices/oracles/AaveOracle.ts @@ -2,7 +2,7 @@ import * as utils from "../common/utils"; import * as constants from "../common/constants"; import { CustomPriceType, OracleContract } from "../common/types"; import { Address, BigDecimal, BigInt, ethereum } from "@graphprotocol/graph-ts"; -import { AaveOracleContract } from "../../../generated/RestakeManager/AaveOracleContract"; +import { AaveOracleContract } from "../../../generated/DepositQueue/AaveOracleContract"; export function getAaveOracleContract( contract: OracleContract, diff --git a/subgraphs/renzo/src/prices/oracles/ChainLinkFeed.ts b/subgraphs/renzo/src/prices/oracles/ChainLinkFeed.ts index 261325b31e..d8c236fdc4 100644 --- a/subgraphs/renzo/src/prices/oracles/ChainLinkFeed.ts +++ b/subgraphs/renzo/src/prices/oracles/ChainLinkFeed.ts @@ -2,7 +2,7 @@ import * as utils from "../common/utils"; import * as constants from "../common/constants"; import { Address, ethereum } from "@graphprotocol/graph-ts"; import { CustomPriceType, OracleContract } from "../common/types"; -import { ChainLinkContract } from "../../../generated/RestakeManager/ChainLinkContract"; +import { ChainLinkContract } from "../../../generated/DepositQueue/ChainLinkContract"; export function getChainLinkContract( contract: OracleContract, diff --git a/subgraphs/renzo/src/prices/oracles/YearnLensOracle.ts b/subgraphs/renzo/src/prices/oracles/YearnLensOracle.ts index 341a087aec..d7dadda487 100644 --- a/subgraphs/renzo/src/prices/oracles/YearnLensOracle.ts +++ b/subgraphs/renzo/src/prices/oracles/YearnLensOracle.ts @@ -2,7 +2,7 @@ import * as utils from "../common/utils"; import * as constants from "../common/constants"; import { CustomPriceType, OracleContract } from "../common/types"; import { Address, BigDecimal, BigInt, ethereum } from "@graphprotocol/graph-ts"; -import { YearnLensContract } from "../../../generated/RestakeManager/YearnLensContract"; +import { YearnLensContract } from "../../../generated/DepositQueue/YearnLensContract"; export function getYearnLensContract( contract: OracleContract, diff --git a/subgraphs/renzo/src/prices/routers/CurveRouter.ts b/subgraphs/renzo/src/prices/routers/CurveRouter.ts index 28b7de7433..1285cd56b7 100644 --- a/subgraphs/renzo/src/prices/routers/CurveRouter.ts +++ b/subgraphs/renzo/src/prices/routers/CurveRouter.ts @@ -4,8 +4,8 @@ import * as utils from "../common/utils"; import * as constants from "../common/constants"; import { CustomPriceType } from "../common/types"; import { BigInt, Address, BigDecimal, ethereum } from "@graphprotocol/graph-ts"; -import { CurvePool as CurvePoolContract } from "../../../generated/RestakeManager/CurvePool"; -import { CurveRegistry as CurveRegistryContract } from "../../../generated/RestakeManager/CurveRegistry"; +import { CurvePool as CurvePoolContract } from "../../../generated/DepositQueue/CurvePool"; +import { CurveRegistry as CurveRegistryContract } from "../../../generated/DepositQueue/CurveRegistry"; export function isCurveLpToken( lpAddress: Address, diff --git a/subgraphs/renzo/src/prices/routers/UniswapForksRouter.ts b/subgraphs/renzo/src/prices/routers/UniswapForksRouter.ts index 16db3ac797..96ee5fafab 100644 --- a/subgraphs/renzo/src/prices/routers/UniswapForksRouter.ts +++ b/subgraphs/renzo/src/prices/routers/UniswapForksRouter.ts @@ -2,9 +2,9 @@ import * as utils from "../common/utils"; import * as constants from "../common/constants"; import { CustomPriceType } from "../common/types"; import { Address, BigInt, ethereum, log } from "@graphprotocol/graph-ts"; -import { UniswapPair as UniswapPairContract } from "../../../generated/RestakeManager/UniswapPair"; -import { UniswapRouter as UniswapRouterContract } from "../../../generated/RestakeManager/UniswapRouter"; -import { UniswapFactory as UniswapFactoryContract } from "../../../generated/RestakeManager/UniswapFactory"; +import { UniswapPair as UniswapPairContract } from "../../../generated/DepositQueue/UniswapPair"; +import { UniswapRouter as UniswapRouterContract } from "../../../generated/DepositQueue/UniswapRouter"; +import { UniswapFactory as UniswapFactoryContract } from "../../../generated/DepositQueue/UniswapFactory"; export function isLpToken(tokenAddress: Address, ethAddress: Address): bool { if (tokenAddress.equals(ethAddress)) return false;