diff --git a/deployment/deployment.json b/deployment/deployment.json index 68d10f5284..4ea5c76648 100644 --- a/deployment/deployment.json +++ b/deployment/deployment.json @@ -7350,7 +7350,7 @@ "status": "prod", "versions": { "schema": "1.1.0", - "subgraph": "1.0.2", + "subgraph": "1.0.3", "methodology": "1.0.0" }, "files": { @@ -7372,7 +7372,7 @@ "status": "prod", "versions": { "schema": "1.1.0", - "subgraph": "1.0.2", + "subgraph": "1.0.3", "methodology": "1.0.0" }, "files": { @@ -7394,7 +7394,7 @@ "status": "prod", "versions": { "schema": "1.1.0", - "subgraph": "1.0.2", + "subgraph": "1.0.3", "methodology": "1.0.0" }, "files": { @@ -7416,7 +7416,7 @@ "status": "prod", "versions": { "schema": "1.1.0", - "subgraph": "1.0.2", + "subgraph": "1.0.3", "methodology": "1.0.0" }, "files": { @@ -7438,7 +7438,7 @@ "status": "prod", "versions": { "schema": "1.1.0", - "subgraph": "1.0.2", + "subgraph": "1.0.3", "methodology": "1.0.0" }, "files": { @@ -7460,7 +7460,7 @@ "status": "prod", "versions": { "schema": "1.1.0", - "subgraph": "1.0.2", + "subgraph": "1.0.3", "methodology": "1.0.0" }, "files": { @@ -7482,7 +7482,7 @@ "status": "prod", "versions": { "schema": "1.1.0", - "subgraph": "1.0.2", + "subgraph": "1.0.3", "methodology": "1.0.0" }, "files": { @@ -7498,6 +7498,28 @@ "query-id": "stargate-fantom" } } + }, + "stargate-base": { + "network": "base", + "status": "prod", + "versions": { + "schema": "1.1.0", + "subgraph": "1.0.3", + "methodology": "1.0.0" + }, + "files": { + "template": "stargate.template.yaml" + }, + "options": { + "prepare:yaml": true, + "prepare:constants": true + }, + "services": { + "hosted-service": { + "slug": "stargate-base", + "query-id": "stargate-base" + } + } } } }, diff --git a/schema-bridge.graphql b/schema-bridge.graphql index 1cd528bea1..a4f223ead1 100644 --- a/schema-bridge.graphql +++ b/schema-bridge.graphql @@ -6,6 +6,7 @@ enum Network { ARWEAVE_MAINNET AURORA AVALANCHE + BASE BOBA BSC # aka BNB Chain CELO diff --git a/subgraphs/stargate/configurations/configurations/configurations.ts b/subgraphs/stargate/configurations/configurations/configurations.ts index e32cda86be..16298583fb 100644 --- a/subgraphs/stargate/configurations/configurations/configurations.ts +++ b/subgraphs/stargate/configurations/configurations/configurations.ts @@ -6,6 +6,7 @@ import { StargateArbitrumConfigurations } from "../../protocols/stargate/config/ import { StargateOptimismConfigurations } from "../../protocols/stargate/config/deployments/stargate-optimism/configurations"; import { StargateFantomConfigurations } from "../../protocols/stargate/config/deployments/stargate-fantom/configurations"; import { StargateMetisConfigurations } from "../../protocols/stargate/config/deployments/stargate-metis/configurations"; +import { StargateBaseConfigurations } from "../../protocols/stargate/config/deployments/stargate-base/configurations"; import { Configurations } from "./interface"; import { Deploy } from "./deploy"; import { log } from "@graphprotocol/graph-ts"; @@ -36,6 +37,9 @@ export function getNetworkConfigurations(deploy: i32): Configurations { case Deploy.STARGATE_METIS: { return new StargateMetisConfigurations(); } + case Deploy.STARGATE_BASE: { + return new StargateBaseConfigurations(); + } default: { log.critical( "No configurations found for deployment protocol/network", diff --git a/subgraphs/stargate/configurations/configurations/deploy.ts b/subgraphs/stargate/configurations/configurations/deploy.ts index 018e42844f..f574c6d973 100644 --- a/subgraphs/stargate/configurations/configurations/deploy.ts +++ b/subgraphs/stargate/configurations/configurations/deploy.ts @@ -7,4 +7,5 @@ export namespace Deploy { export const STARGATE_OPTIMISM = 5; export const STARGATE_FANTOM = 6; export const STARGATE_METIS = 7; + export const STARGATE_BASE = 8; } diff --git a/subgraphs/stargate/protocols/stargate/config/deployments/stargate-arbitrum/configurations.json b/subgraphs/stargate/protocols/stargate/config/deployments/stargate-arbitrum/configurations.json index 0bb0f3d3a5..1abfa35655 100644 --- a/subgraphs/stargate/protocols/stargate/config/deployments/stargate-arbitrum/configurations.json +++ b/subgraphs/stargate/protocols/stargate/config/deployments/stargate-arbitrum/configurations.json @@ -4,7 +4,7 @@ "file": "./src/mappings/handlers.ts", "lpStaking": [ { - "name": "LPStaking", + "name": "LPStaking_0", "address": "0xeA8DfEE1898a7e0a59f7527F076106d7e44c2176", "startBlock": 8040516, "abi": "LPStaking", diff --git a/subgraphs/stargate/protocols/stargate/config/deployments/stargate-avalanche/configurations.json b/subgraphs/stargate/protocols/stargate/config/deployments/stargate-avalanche/configurations.json index 135e026a57..247ef81912 100644 --- a/subgraphs/stargate/protocols/stargate/config/deployments/stargate-avalanche/configurations.json +++ b/subgraphs/stargate/protocols/stargate/config/deployments/stargate-avalanche/configurations.json @@ -4,7 +4,7 @@ "file": "./src/mappings/handlers.ts", "lpStaking": [ { - "name": "LPStaking", + "name": "LPStaking_0", "address": "0x8731d54E9D02c286767d56ac03e8037C07e01e98", "startBlock": 12215240, "abi": "LPStaking", diff --git a/subgraphs/stargate/protocols/stargate/config/deployments/stargate-base/configurations.json b/subgraphs/stargate/protocols/stargate/config/deployments/stargate-base/configurations.json new file mode 100644 index 0000000000..fad9b6fd47 --- /dev/null +++ b/subgraphs/stargate/protocols/stargate/config/deployments/stargate-base/configurations.json @@ -0,0 +1,18 @@ +{ + "deployment": "STARGATE_BASE", + "network": "base", + "file": "./src/mappings/handlers.ts", + "lpStaking": [ + { + "name": "LPStaking_0", + "address": "0x06Eb48763f117c7Be887296CDcdfad2E4092739C", + "startBlock": 2127825, + "abi": "LPStakingTime", + "depositHandler": "handleStakeForTimeRewards", + "withdrawHandler": "handleUnstakeForTimeRewards" + } + ], + "graftEnabled": false, + "subgraphId": "", + "graftStartBlock": 0 +} diff --git a/subgraphs/stargate/protocols/stargate/config/deployments/stargate-base/configurations.ts b/subgraphs/stargate/protocols/stargate/config/deployments/stargate-base/configurations.ts new file mode 100644 index 0000000000..dbf06302b3 --- /dev/null +++ b/subgraphs/stargate/protocols/stargate/config/deployments/stargate-base/configurations.ts @@ -0,0 +1,21 @@ +import { Configurations } from "../../../../../configurations/configurations/interface"; +import { + PROTOCOL_NAME, + PROTOCOL_SLUG, +} from "../../../../../src/common/constants"; +import { Network } from "../../../../../src/sdk/util/constants"; + +export class StargateBaseConfigurations implements Configurations { + getNetwork(): string { + return Network.BASE; + } + getProtocolName(): string { + return PROTOCOL_NAME; + } + getProtocolSlug(): string { + return PROTOCOL_SLUG; + } + getFactoryAddress(): string { + return "0xaf5191b0de278c7286d6c7cc6ab6bb8a73ba2cd6"; + } +} diff --git a/subgraphs/stargate/protocols/stargate/config/deployments/stargate-bsc/configurations.json b/subgraphs/stargate/protocols/stargate/config/deployments/stargate-bsc/configurations.json index fd9f416d7c..93140d49ed 100644 --- a/subgraphs/stargate/protocols/stargate/config/deployments/stargate-bsc/configurations.json +++ b/subgraphs/stargate/protocols/stargate/config/deployments/stargate-bsc/configurations.json @@ -4,7 +4,7 @@ "file": "./src/mappings/handlers.ts", "lpStaking": [ { - "name": "LPStaking", + "name": "LPStaking_0", "address": "0x3052A0F6ab15b4AE1df39962d5DdEFacA86DaB47", "startBlock": 16132220, "abi": "LPStaking", @@ -12,7 +12,7 @@ "withdrawHandler": "handleUnstakeForBlockRewards" }, { - "name": "LPStakingTime", + "name": "LPStaking_1", "address": "0x2c6dcEd426D265045737Ff55C2D746C11b2F457a", "startBlock": 24735491, "abi": "LPStakingTime", diff --git a/subgraphs/stargate/protocols/stargate/config/deployments/stargate-ethereum/configurations.json b/subgraphs/stargate/protocols/stargate/config/deployments/stargate-ethereum/configurations.json index 7325c6a3ad..a8dced3e59 100644 --- a/subgraphs/stargate/protocols/stargate/config/deployments/stargate-ethereum/configurations.json +++ b/subgraphs/stargate/protocols/stargate/config/deployments/stargate-ethereum/configurations.json @@ -4,7 +4,7 @@ "file": "./src/mappings/handlers.ts", "lpStaking": [ { - "name": "LPStaking", + "name": "LPStaking_0", "address": "0xB0D502E938ed5f4df2E681fE6E419ff29631d62b", "startBlock": 14402874, "abi": "LPStaking", @@ -12,7 +12,7 @@ "withdrawHandler": "handleUnstakeForBlockRewards" }, { - "name": "LPStakingTime", + "name": "LPStaking_1", "address": "0x1c3000b8f475A958b87c73a5cc5780Ab763122FC", "startBlock": 16394021, "abi": "LPStakingTime", diff --git a/subgraphs/stargate/protocols/stargate/config/deployments/stargate-fantom/configurations.json b/subgraphs/stargate/protocols/stargate/config/deployments/stargate-fantom/configurations.json index f4168874eb..8fdc329ff1 100644 --- a/subgraphs/stargate/protocols/stargate/config/deployments/stargate-fantom/configurations.json +++ b/subgraphs/stargate/protocols/stargate/config/deployments/stargate-fantom/configurations.json @@ -4,7 +4,7 @@ "file": "./src/mappings/handlers.ts", "lpStaking": [ { - "name": "LPStaking", + "name": "LPStaking_0", "address": "0x224D8Fd7aB6AD4c6eb4611Ce56EF35Dec2277F03", "startBlock": 33646780, "abi": "LPStaking", diff --git a/subgraphs/stargate/protocols/stargate/config/deployments/stargate-metis/configurations.json b/subgraphs/stargate/protocols/stargate/config/deployments/stargate-metis/configurations.json index 7ede81ce58..9b23b8bc63 100644 --- a/subgraphs/stargate/protocols/stargate/config/deployments/stargate-metis/configurations.json +++ b/subgraphs/stargate/protocols/stargate/config/deployments/stargate-metis/configurations.json @@ -4,7 +4,7 @@ "file": "./src/mappings/handlers.ts", "lpStaking": [ { - "name": "LPStakingTime", + "name": "LPStaking_0", "address": "0x45A01E4e04F14f7A4a6702c74187c5F6222033cd", "startBlock": 4320637, "abi": "LPStakingTime", diff --git a/subgraphs/stargate/protocols/stargate/config/deployments/stargate-optimism/configurations.json b/subgraphs/stargate/protocols/stargate/config/deployments/stargate-optimism/configurations.json index fc2fd29eca..c00436be97 100644 --- a/subgraphs/stargate/protocols/stargate/config/deployments/stargate-optimism/configurations.json +++ b/subgraphs/stargate/protocols/stargate/config/deployments/stargate-optimism/configurations.json @@ -4,7 +4,7 @@ "file": "./src/mappings/handlers.ts", "lpStaking": [ { - "name": "LPStaking", + "name": "LPStaking_0", "address": "0x4a364f8c717cAAD9A442737Eb7b8A55cc6cf18D8", "startBlock": 4535236, "abi": "LPStaking", @@ -12,7 +12,7 @@ "withdrawHandler": "handleUnstakeForBlockRewards" }, { - "name": "LPStakingTime", + "name": "LPStaking_1", "address": "0x4DeA9e918c6289a52cd469cAC652727B7b412Cd2", "startBlock": 17500609, "abi": "LPStakingTime", diff --git a/subgraphs/stargate/protocols/stargate/config/deployments/stargate-polygon/configurations.json b/subgraphs/stargate/protocols/stargate/config/deployments/stargate-polygon/configurations.json index cd0b1976a7..b2430cb86a 100644 --- a/subgraphs/stargate/protocols/stargate/config/deployments/stargate-polygon/configurations.json +++ b/subgraphs/stargate/protocols/stargate/config/deployments/stargate-polygon/configurations.json @@ -4,7 +4,7 @@ "file": "./src/mappings/handlers.ts", "lpStaking": [ { - "name": "LPStaking", + "name": "LPStaking_0", "address": "0x8731d54E9D02c286767d56ac03e8037C07e01e98", "startBlock": 26032417, "abi": "LPStaking", diff --git a/subgraphs/stargate/schema.graphql b/subgraphs/stargate/schema.graphql index e79e9a526b..0a08c83a52 100644 --- a/subgraphs/stargate/schema.graphql +++ b/subgraphs/stargate/schema.graphql @@ -6,6 +6,7 @@ enum Network { ARWEAVE_MAINNET AURORA AVALANCHE + BASE BOBA BSC # aka BNB Chain CELO diff --git a/subgraphs/stargate/src/common/constants.ts b/subgraphs/stargate/src/common/constants.ts index 1010deb56f..635344770d 100644 --- a/subgraphs/stargate/src/common/constants.ts +++ b/subgraphs/stargate/src/common/constants.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-magic-numbers, rulesdir/no-checksum-addresses */ import { Address, BigInt, TypedMap } from "@graphprotocol/graph-ts"; import { Network } from "../sdk/util/constants"; @@ -201,3 +202,14 @@ metisPoolIDsToToken.set( Address.fromString("0x2b60473a7C41Deb80EDdaafD5560e963440eb632") ); crossPoolTokens.set(Network.METIS, metisPoolIDsToToken); + +export const basePoolIDsToToken = new TypedMap(); +basePoolIDsToToken.set( + BigInt.fromI32(1), + Address.fromString("0x4c80E24119CFB836cdF0a6b53dc23F04F7e652CA") +); +basePoolIDsToToken.set( + BigInt.fromI32(13), + Address.fromString("0x28fc411f9e1c480AD312b3d9C60c22b965015c6B") +); +crossPoolTokens.set(Network.BASE, basePoolIDsToToken); diff --git a/subgraphs/stargate/src/common/tokens.ts b/subgraphs/stargate/src/common/tokens.ts index 74b64672f5..45e0e178e0 100644 --- a/subgraphs/stargate/src/common/tokens.ts +++ b/subgraphs/stargate/src/common/tokens.ts @@ -1,8 +1,14 @@ /* eslint-disable prefer-const */ -import { ERC20 } from "../../generated/LPStaking/ERC20"; -import { ERC20SymbolBytes } from "../../generated/LPStaking/ERC20SymbolBytes"; -import { ERC20NameBytes } from "../../generated/LPStaking/ERC20NameBytes"; +import { ERC20 } from "../../generated/LPStaking_0/ERC20"; +import { ERC20SymbolBytes } from "../../generated/LPStaking_0/ERC20SymbolBytes"; +import { ERC20NameBytes } from "../../generated/LPStaking_0/ERC20NameBytes"; import { Address } from "@graphprotocol/graph-ts"; +import { + DEFAULT_DECIMALS, + INT_ZERO, + INT_NINE, + INT_SIXTEEN, +} from "../sdk/util/constants"; export const INVALID_TOKEN_DECIMALS = 0; export const UNKNOWN_TOKEN_VALUE = "unknown"; @@ -110,14 +116,14 @@ class StaticTokenDefinition { // Get all tokens with a static defintion static getStaticDefinitions(): Array { - let staticDefinitions = new Array(6); + let staticDefinitions = new Array(INT_ZERO); // Add DGD let tokenDGD = new StaticTokenDefinition( Address.fromString("0xe0b7927c4af23765cb51314a0e0521a9645f0e2a"), "DGD", "DGD", - 9 as i32 + INT_NINE ); staticDefinitions.push(tokenDGD); @@ -126,7 +132,7 @@ class StaticTokenDefinition { Address.fromString("0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9"), "AAVE", "Aave Token", - 18 as i32 + DEFAULT_DECIMALS as i32 ); staticDefinitions.push(tokenAAVE); @@ -135,7 +141,7 @@ class StaticTokenDefinition { Address.fromString("0xeb9951021698b42e4399f9cbb6267aa35f82d59d"), "LIF", "Lif", - 18 as i32 + DEFAULT_DECIMALS as i32 ); staticDefinitions.push(tokenLIF); @@ -144,7 +150,7 @@ class StaticTokenDefinition { Address.fromString("0xbdeb4b83251fb146687fa19d1c660f99411eefe3"), "SVD", "savedroid", - 18 as i32 + DEFAULT_DECIMALS as i32 ); staticDefinitions.push(tokenSVD); @@ -153,7 +159,7 @@ class StaticTokenDefinition { Address.fromString("0xbb9bc244d798123fde783fcc1c72d3bb8c189413"), "TheDAO", "TheDAO", - 16 as i32 + INT_SIXTEEN ); staticDefinitions.push(tokenTheDAO); @@ -162,7 +168,7 @@ class StaticTokenDefinition { Address.fromString("0x38c6a68304cdefb9bec48bbfaaba5c5b47818bb2"), "HPB", "HPBCoin", - 18 as i32 + DEFAULT_DECIMALS as i32 ); staticDefinitions.push(tokenHPB); diff --git a/subgraphs/stargate/src/mappings/handlers.ts b/subgraphs/stargate/src/mappings/handlers.ts index 881d562085..0744ad94dd 100644 --- a/subgraphs/stargate/src/mappings/handlers.ts +++ b/subgraphs/stargate/src/mappings/handlers.ts @@ -39,20 +39,20 @@ import { Swap, SwapRemote, Pool, -} from "../../generated/LPStaking/Pool"; +} from "../../generated/LPStaking_0/Pool"; import { PoolTemplate } from "../../generated/templates"; import { Token } from "../../generated/schema"; import { Deposit as DepositForBlockRewards, LPStaking, Withdraw as WithdrawForBlockRewards, -} from "../../generated/LPStaking/LPStaking"; +} from "../../generated/LPStaking_0/LPStaking"; import { Deposit as DepositForTimeRewards, LPStakingTime, Withdraw as WithdrawForTimeRewards, -} from "../../generated/LPStaking/LPStakingTime"; -import { _ERC20 } from "../../generated/LPStaking/_ERC20"; +} from "../../generated/LPStaking_0/LPStakingTime"; +import { _ERC20 } from "../../generated/LPStaking_0/_ERC20"; const conf = new BridgeConfig( NetworkConfigs.getFactoryAddress(), diff --git a/subgraphs/stargate/src/mappings/helpers.ts b/subgraphs/stargate/src/mappings/helpers.ts index 4634fe69f4..5d08bc46da 100644 --- a/subgraphs/stargate/src/mappings/helpers.ts +++ b/subgraphs/stargate/src/mappings/helpers.ts @@ -5,8 +5,8 @@ import { NetworkConfigs } from "../../configurations/configure"; import { SDK } from "../sdk/protocols/bridge"; import { BridgePoolType } from "../sdk/protocols/bridge/enums"; -import { Factory } from "../../generated/LPStaking/Factory"; -import { Pool } from "../../generated/LPStaking/Pool"; +import { Factory } from "../../generated/LPStaking_0/Factory"; +import { Pool } from "../../generated/LPStaking_0/Pool"; import { PoolTemplate } from "../../generated/templates"; export function checkPoolCount(sdk: SDK): void { diff --git a/subgraphs/stargate/src/prices/calculations/CalculationsCurve.ts b/subgraphs/stargate/src/prices/calculations/CalculationsCurve.ts index 7ceb54fd40..5acf9a9de8 100644 --- a/subgraphs/stargate/src/prices/calculations/CalculationsCurve.ts +++ b/subgraphs/stargate/src/prices/calculations/CalculationsCurve.ts @@ -2,7 +2,7 @@ import * as utils from "../common/utils"; import * as constants from "../common/constants"; import { CustomPriceType } from "../common/types"; import { Address, BigDecimal, BigInt } from "@graphprotocol/graph-ts"; -import { CalculationsCurve as CalculationsCurveContract } from "../../../generated/LPStaking/CalculationsCurve"; +import { CalculationsCurve as CalculationsCurveContract } from "../../../generated/LPStaking_0/CalculationsCurve"; export function getCalculationsCurveContract( contractAddress: Address diff --git a/subgraphs/stargate/src/prices/calculations/CalculationsSushiswap.ts b/subgraphs/stargate/src/prices/calculations/CalculationsSushiswap.ts index c35a233e17..eed2b5936d 100644 --- a/subgraphs/stargate/src/prices/calculations/CalculationsSushiswap.ts +++ b/subgraphs/stargate/src/prices/calculations/CalculationsSushiswap.ts @@ -2,7 +2,7 @@ import * as utils from "../common/utils"; import * as constants from "../common/constants"; import { CustomPriceType } from "../common/types"; import { Address, BigDecimal, BigInt } from "@graphprotocol/graph-ts"; -import { CalculationsSushiSwap as CalculationsSushiContract } from "../../../generated/LPStaking/CalculationsSushiSwap"; +import { CalculationsSushiSwap as CalculationsSushiContract } from "../../../generated/LPStaking_0/CalculationsSushiSwap"; export function getSushiSwapContract( contractAddress: Address diff --git a/subgraphs/stargate/src/prices/common/constants.ts b/subgraphs/stargate/src/prices/common/constants.ts index bc742d9953..308100cd66 100644 --- a/subgraphs/stargate/src/prices/common/constants.ts +++ b/subgraphs/stargate/src/prices/common/constants.ts @@ -15,6 +15,10 @@ export const CHAIN_LINK_USD_ADDRESS = Address.fromString( export const PRICE_LIB_VERSION = "1.1.0"; +export const INT_SEVEN = 7; +export const INT_EIGHT = 8; +export const INT_THIRTY = 30; + export const BIGINT_ZERO = BigInt.fromI32(0); export const BIGINT_ONE = BigInt.fromI32(1); export const BIGINT_TEN = BigInt.fromI32(10); diff --git a/subgraphs/stargate/src/prices/common/utils.ts b/subgraphs/stargate/src/prices/common/utils.ts index fec240e875..c91692faea 100644 --- a/subgraphs/stargate/src/prices/common/utils.ts +++ b/subgraphs/stargate/src/prices/common/utils.ts @@ -13,7 +13,7 @@ import * as ARBITRUM_ONE from "../config/arbitrum"; import { Configurations } from "./types"; import * as constants from "./constants"; import * as TEMPLATE from "../config/template"; -import { _ERC20 } from "../../../generated/LPStaking/_ERC20"; +import { _ERC20 } from "../../../generated/LPStaking_0/_ERC20"; import { Address, BigInt, dataSource, ethereum } from "@graphprotocol/graph-ts"; export function isNullAddress(tokenAddr: Address): boolean { diff --git a/subgraphs/stargate/src/prices/oracles/AaveOracle.ts b/subgraphs/stargate/src/prices/oracles/AaveOracle.ts index 8114ab3e2c..b1e391f193 100644 --- a/subgraphs/stargate/src/prices/oracles/AaveOracle.ts +++ b/subgraphs/stargate/src/prices/oracles/AaveOracle.ts @@ -2,7 +2,7 @@ import * as utils from "../common/utils"; import * as constants from "../common/constants"; import { CustomPriceType } from "../common/types"; import { Address, BigDecimal, BigInt } from "@graphprotocol/graph-ts"; -import { AaveOracleContract } from "../../../generated/LPStaking/AaveOracleContract"; +import { AaveOracleContract } from "../../../generated/LPStaking_0/AaveOracleContract"; export function getAaveOracleContract( contractAddress: Address diff --git a/subgraphs/stargate/src/prices/oracles/ChainLinkFeed.ts b/subgraphs/stargate/src/prices/oracles/ChainLinkFeed.ts index 0aa54e4fbc..f10d5a691f 100644 --- a/subgraphs/stargate/src/prices/oracles/ChainLinkFeed.ts +++ b/subgraphs/stargate/src/prices/oracles/ChainLinkFeed.ts @@ -2,7 +2,7 @@ import * as utils from "../common/utils"; import * as constants from "../common/constants"; import { Address } from "@graphprotocol/graph-ts"; import { CustomPriceType } from "../common/types"; -import { ChainLinkContract } from "../../../generated/LPStaking/ChainLinkContract"; +import { ChainLinkContract } from "../../../generated/LPStaking_0/ChainLinkContract"; export function getChainLinkContract(): ChainLinkContract | null { const config = utils.getConfig(); diff --git a/subgraphs/stargate/src/prices/oracles/YearnLensOracle.ts b/subgraphs/stargate/src/prices/oracles/YearnLensOracle.ts index 52b5082eb9..df9542c923 100644 --- a/subgraphs/stargate/src/prices/oracles/YearnLensOracle.ts +++ b/subgraphs/stargate/src/prices/oracles/YearnLensOracle.ts @@ -2,7 +2,7 @@ import * as utils from "../common/utils"; import * as constants from "../common/constants"; import { CustomPriceType } from "../common/types"; import { Address, BigDecimal, BigInt } from "@graphprotocol/graph-ts"; -import { YearnLensContract } from "../../../generated/LPStaking/YearnLensContract"; +import { YearnLensContract } from "../../../generated/LPStaking_0/YearnLensContract"; export function getYearnLensContract( contractAddress: Address diff --git a/subgraphs/stargate/src/prices/routers/CurveRouter.ts b/subgraphs/stargate/src/prices/routers/CurveRouter.ts index bf89c67115..ba123b8f05 100644 --- a/subgraphs/stargate/src/prices/routers/CurveRouter.ts +++ b/subgraphs/stargate/src/prices/routers/CurveRouter.ts @@ -3,8 +3,9 @@ import * as utils from "../common/utils"; import * as constants from "../common/constants"; import { CustomPriceType } from "../common/types"; import { BigInt, Address, BigDecimal } from "@graphprotocol/graph-ts"; -import { CurvePool as CurvePoolContract } from "../../../generated/LPStaking/CurvePool"; -import { CurveRegistry as CurveRegistryContract } from "../../../generated/LPStaking/CurveRegistry"; +import { CurvePool as CurvePoolContract } from "../../../generated/LPStaking_0/CurvePool"; +import { CurveRegistry as CurveRegistryContract } from "../../../generated/LPStaking_0/CurveRegistry"; +import { INT_EIGHT, INT_SEVEN } from "../common/constants"; export function isCurveLpToken(lpAddress: Address): bool { const poolAddress = getPoolFromLpToken(lpAddress); @@ -116,7 +117,7 @@ export function getUnderlyingCoinFromPool(poolAddress: Address): Address { export function getPreferredCoinFromCoins(coins: Address[]): Address { let preferredCoinAddress = constants.NULL.TYPE_ADDRESS; - for (let coinIdx = 0; coinIdx < 8; coinIdx++) { + for (let coinIdx = 0; coinIdx < INT_EIGHT; coinIdx++) { const coinAddress = coins[coinIdx]; if (coinAddress.notEqual(constants.NULL.TYPE_ADDRESS)) { @@ -126,7 +127,7 @@ export function getPreferredCoinFromCoins(coins: Address[]): Address { if ( (preferredCoinAddress.notEqual(constants.NULL.TYPE_ADDRESS) && coinAddress.equals(constants.NULL.TYPE_ADDRESS)) || - coinIdx == 7 + coinIdx == INT_SEVEN ) { break; } @@ -261,7 +262,7 @@ export function getPriceUsdc(tokenAddress: Address): CustomPriceType { .toBigDecimal(); const coins: Address[] = []; - for (let i = 0; i < 8; i++) { + for (let i = 0; i < INT_EIGHT; i++) { const coin = utils.readValue
( poolContract.try_coins(BigInt.fromI32(i)), constants.NULL.TYPE_ADDRESS diff --git a/subgraphs/stargate/src/prices/routers/UniswapForksRouter.ts b/subgraphs/stargate/src/prices/routers/UniswapForksRouter.ts index dcb1e66cdd..ac19ec3ca4 100644 --- a/subgraphs/stargate/src/prices/routers/UniswapForksRouter.ts +++ b/subgraphs/stargate/src/prices/routers/UniswapForksRouter.ts @@ -2,8 +2,9 @@ import * as utils from "../common/utils"; import * as constants from "../common/constants"; import { CustomPriceType } from "../common/types"; import { Address, BigInt, log } from "@graphprotocol/graph-ts"; -import { UniswapPair as UniswapPairContract } from "../../../generated/LPStaking/UniswapPair"; -import { UniswapRouter as UniswapRouterContract } from "../../../generated/LPStaking/UniswapRouter"; +import { UniswapPair as UniswapPairContract } from "../../../generated/LPStaking_0/UniswapPair"; +import { UniswapRouter as UniswapRouterContract } from "../../../generated/LPStaking_0/UniswapRouter"; +import { INT_THIRTY } from "../common/constants"; export function isLpToken(tokenAddress: Address, ethAddress: Address): bool { if (tokenAddress.equals(ethAddress)) return false; @@ -92,7 +93,7 @@ export function getPriceFromRouter( } } - const feeBips = BigInt.fromI32(30); + const feeBips = BigInt.fromI32(INT_THIRTY); const amountOutBigDecimal = amountOut .times(constants.BIGINT_TEN_THOUSAND) diff --git a/subgraphs/stargate/src/sdk/protocols/bridge/chainIds.ts b/subgraphs/stargate/src/sdk/protocols/bridge/chainIds.ts index f4527a36f4..4ef0e65e84 100644 --- a/subgraphs/stargate/src/sdk/protocols/bridge/chainIds.ts +++ b/subgraphs/stargate/src/sdk/protocols/bridge/chainIds.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-magic-numbers */ import { BigInt, TypedMap } from "@graphprotocol/graph-ts"; import { Network } from "../../util/constants"; @@ -40,3 +41,7 @@ setChainID(11, Network.OPTIMISM); setChainID(111, Network.OPTIMISM); setChainID(12, Network.FANTOM); setChainID(112, Network.FANTOM); +setChainID(51, Network.METIS); +setChainID(151, Network.METIS); +setChainID(84, Network.BASE); +setChainID(184, Network.BASE); diff --git a/subgraphs/stargate/src/sdk/util/constants.ts b/subgraphs/stargate/src/sdk/util/constants.ts index 53476998c6..671b05bfa0 100644 --- a/subgraphs/stargate/src/sdk/util/constants.ts +++ b/subgraphs/stargate/src/sdk/util/constants.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-magic-numbers, rulesdir/no-checksum-addresses */ import { BigDecimal, BigInt } from "@graphprotocol/graph-ts"; //////////////////////// @@ -86,6 +87,7 @@ export namespace Network { export const HARMONY = "HARMONY"; export const PALM = "PALM"; export const CURIO = "CURIO"; + export const BASE = "BASE"; export const UNKNOWN_NETWORK = "UNKNOWN_NETWORK"; } @@ -181,6 +183,8 @@ export const INT_ZERO = 0 as i32; export const INT_ONE = 1 as i32; export const INT_TWO = 2 as i32; export const INT_FOUR = 4 as i32; +export const INT_NINE = 9 as i32; +export const INT_SIXTEEN = 16 as i32; export const BIGDECIMAL_ZERO = new BigDecimal(BIGINT_ZERO); export const BIGDECIMAL_ONE = new BigDecimal(BIGINT_ONE);