diff --git a/subgraphs/balancer-forks/abis/Prices/Aave/Oracle.json b/subgraphs/balancer-forks/abis/Prices/AaveOracle.json similarity index 100% rename from subgraphs/balancer-forks/abis/Prices/Aave/Oracle.json rename to subgraphs/balancer-forks/abis/Prices/AaveOracle.json diff --git a/subgraphs/balancer-forks/abis/Prices/Calculations/Curve.json b/subgraphs/balancer-forks/abis/Prices/Calculations/Curve.json index ca87f17950..b1f6da3de4 100644 --- a/subgraphs/balancer-forks/abis/Prices/Calculations/Curve.json +++ b/subgraphs/balancer-forks/abis/Prices/Calculations/Curve.json @@ -1,143 +1,143 @@ -[ - { - "inputs": [ - { - "internalType": "address", - "name": "_curveAddressProviderAddress", - "type": "address" - }, - { "internalType": "address", "name": "_oracleAddress", "type": "address" } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "curveAddressProviderAddress", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "curveMetapoolFactoryAddress", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "curveRegistryAddress", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "curveLpTokenAddress", - "type": "address" - } - ], - "name": "getBasePrice", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "curveLpTokenAddress", - "type": "address" - } - ], - "name": "getCurvePriceUsdc", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "tokenAddress", "type": "address" } - ], - "name": "getPool", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "assetAddress", "type": "address" } - ], - "name": "getPriceUsdc", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "poolAddress", "type": "address" } - ], - "name": "getUnderlyingCoinFromPool", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "curveLpTokenAddress", - "type": "address" - } - ], - "name": "getVirtualPrice", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "tokenAddress", "type": "address" } - ], - "name": "isBasicToken", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "tokenAddress", "type": "address" } - ], - "name": "isCurveLpToken", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "oracleAddress", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "ownerAddress", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "bytes32", "name": "slot", "type": "bytes32" }, - { "internalType": "bytes32", "name": "value", "type": "bytes32" } - ], - "name": "updateSlot", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -] +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_curveAddressProviderAddress", + "type": "address" + }, + { "internalType": "address", "name": "_oracleAddress", "type": "address" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "curveAddressProviderAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "curveMetapoolFactoryAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "curveRegistryAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "curveLpTokenAddress", + "type": "address" + } + ], + "name": "getBasePrice", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "curveLpTokenAddress", + "type": "address" + } + ], + "name": "getCurvePriceUsdc", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" } + ], + "name": "getPool", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "assetAddress", "type": "address" } + ], + "name": "getPriceUsdc", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "poolAddress", "type": "address" } + ], + "name": "getUnderlyingCoinFromPool", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "curveLpTokenAddress", + "type": "address" + } + ], + "name": "getVirtualPrice", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" } + ], + "name": "isBasicToken", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" } + ], + "name": "isCurveLpToken", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "oracleAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ownerAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "slot", "type": "bytes32" }, + { "internalType": "bytes32", "name": "value", "type": "bytes32" } + ], + "name": "updateSlot", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/subgraphs/balancer-forks/abis/Prices/Calculations/SushiSwap.json b/subgraphs/balancer-forks/abis/Prices/Calculations/SushiSwap.json index 04dc52461f..8b9718ae78 100644 --- a/subgraphs/balancer-forks/abis/Prices/Calculations/SushiSwap.json +++ b/subgraphs/balancer-forks/abis/Prices/Calculations/SushiSwap.json @@ -1,137 +1,137 @@ -[ - { - "inputs": [ - { - "internalType": "address", - "name": "_primaryRouterAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "_primaryFactoryAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "_secondaryRouterAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "_secondaryFactoryAddress", - "type": "address" - }, - { "internalType": "address", "name": "_usdcAddress", "type": "address" } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { "internalType": "address", "name": "tokenAddress", "type": "address" } - ], - "name": "getLpTokenPriceUsdc", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "tokenAddress", "type": "address" } - ], - "name": "getLpTokenTotalLiquidityUsdc", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "token0Address", "type": "address" }, - { "internalType": "address", "name": "token1Address", "type": "address" } - ], - "name": "getPriceFromRouter", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "tokenAddress", "type": "address" } - ], - "name": "getPriceFromRouterUsdc", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "tokenAddress", "type": "address" } - ], - "name": "getPriceUsdc", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "tokenAddress", "type": "address" } - ], - "name": "getRouterForLpToken", - "outputs": [ - { "internalType": "contract PriceRouter", "name": "", "type": "address" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "tokenAddress", "type": "address" } - ], - "name": "isLpToken", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "primaryFactoryAddress", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "primaryRouterAddress", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "secondaryFactoryAddress", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "secondaryRouterAddress", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "usdcAddress", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "wethAddress", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - } -] +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_primaryRouterAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_primaryFactoryAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_secondaryRouterAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_secondaryFactoryAddress", + "type": "address" + }, + { "internalType": "address", "name": "_usdcAddress", "type": "address" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" } + ], + "name": "getLpTokenPriceUsdc", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" } + ], + "name": "getLpTokenTotalLiquidityUsdc", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "token0Address", "type": "address" }, + { "internalType": "address", "name": "token1Address", "type": "address" } + ], + "name": "getPriceFromRouter", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" } + ], + "name": "getPriceFromRouterUsdc", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" } + ], + "name": "getPriceUsdc", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" } + ], + "name": "getRouterForLpToken", + "outputs": [ + { "internalType": "contract PriceRouter", "name": "", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" } + ], + "name": "isLpToken", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "primaryFactoryAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "primaryRouterAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "secondaryFactoryAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "secondaryRouterAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "usdcAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "wethAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/subgraphs/balancer-forks/abis/Prices/ChainLink.json b/subgraphs/balancer-forks/abis/Prices/ChainLink.json index 7000058391..55882931c3 100644 --- a/subgraphs/balancer-forks/abis/Prices/ChainLink.json +++ b/subgraphs/balancer-forks/abis/Prices/ChainLink.json @@ -1,530 +1,530 @@ -[ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "accessController", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "AccessControllerSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "asset", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "denomination", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "latestAggregator", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "previousAggregator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint16", - "name": "nextPhaseId", - "type": "uint16" - }, - { - "indexed": false, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "FeedConfirmed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "asset", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "denomination", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "proposedAggregator", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "currentAggregator", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "FeedProposed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "OwnershipTransferRequested", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "acceptOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "base", "type": "address" }, - { "internalType": "address", "name": "quote", "type": "address" }, - { "internalType": "address", "name": "aggregator", "type": "address" } - ], - "name": "confirmFeed", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "base", "type": "address" }, - { "internalType": "address", "name": "quote", "type": "address" } - ], - "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "base", "type": "address" }, - { "internalType": "address", "name": "quote", "type": "address" } - ], - "name": "description", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getAccessController", - "outputs": [ - { - "internalType": "contract AccessControllerInterface", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "base", "type": "address" }, - { "internalType": "address", "name": "quote", "type": "address" }, - { "internalType": "uint256", "name": "roundId", "type": "uint256" } - ], - "name": "getAnswer", - "outputs": [ - { "internalType": "int256", "name": "answer", "type": "int256" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "base", "type": "address" }, - { "internalType": "address", "name": "quote", "type": "address" } - ], - "name": "getCurrentPhaseId", - "outputs": [ - { "internalType": "uint16", "name": "currentPhaseId", "type": "uint16" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "base", "type": "address" }, - { "internalType": "address", "name": "quote", "type": "address" } - ], - "name": "getFeed", - "outputs": [ - { - "internalType": "contract AggregatorV2V3Interface", - "name": "aggregator", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "base", "type": "address" }, - { "internalType": "address", "name": "quote", "type": "address" }, - { "internalType": "uint80", "name": "roundId", "type": "uint80" } - ], - "name": "getNextRoundId", - "outputs": [ - { "internalType": "uint80", "name": "nextRoundId", "type": "uint80" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "base", "type": "address" }, - { "internalType": "address", "name": "quote", "type": "address" }, - { "internalType": "uint16", "name": "phaseId", "type": "uint16" } - ], - "name": "getPhase", - "outputs": [ - { - "components": [ - { "internalType": "uint16", "name": "phaseId", "type": "uint16" }, - { - "internalType": "uint80", - "name": "startingAggregatorRoundId", - "type": "uint80" - }, - { - "internalType": "uint80", - "name": "endingAggregatorRoundId", - "type": "uint80" - } - ], - "internalType": "struct FeedRegistryInterface.Phase", - "name": "phase", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "base", "type": "address" }, - { "internalType": "address", "name": "quote", "type": "address" }, - { "internalType": "uint16", "name": "phaseId", "type": "uint16" } - ], - "name": "getPhaseFeed", - "outputs": [ - { - "internalType": "contract AggregatorV2V3Interface", - "name": "aggregator", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "base", "type": "address" }, - { "internalType": "address", "name": "quote", "type": "address" }, - { "internalType": "uint16", "name": "phaseId", "type": "uint16" } - ], - "name": "getPhaseRange", - "outputs": [ - { "internalType": "uint80", "name": "startingRoundId", "type": "uint80" }, - { "internalType": "uint80", "name": "endingRoundId", "type": "uint80" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "base", "type": "address" }, - { "internalType": "address", "name": "quote", "type": "address" }, - { "internalType": "uint80", "name": "roundId", "type": "uint80" } - ], - "name": "getPreviousRoundId", - "outputs": [ - { "internalType": "uint80", "name": "previousRoundId", "type": "uint80" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "base", "type": "address" }, - { "internalType": "address", "name": "quote", "type": "address" } - ], - "name": "getProposedFeed", - "outputs": [ - { - "internalType": "contract AggregatorV2V3Interface", - "name": "proposedAggregator", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "base", "type": "address" }, - { "internalType": "address", "name": "quote", "type": "address" }, - { "internalType": "uint80", "name": "_roundId", "type": "uint80" } - ], - "name": "getRoundData", - "outputs": [ - { "internalType": "uint80", "name": "roundId", "type": "uint80" }, - { "internalType": "int256", "name": "answer", "type": "int256" }, - { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, - { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, - { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "base", "type": "address" }, - { "internalType": "address", "name": "quote", "type": "address" }, - { "internalType": "uint80", "name": "roundId", "type": "uint80" } - ], - "name": "getRoundFeed", - "outputs": [ - { - "internalType": "contract AggregatorV2V3Interface", - "name": "aggregator", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "base", "type": "address" }, - { "internalType": "address", "name": "quote", "type": "address" }, - { "internalType": "uint256", "name": "roundId", "type": "uint256" } - ], - "name": "getTimestamp", - "outputs": [ - { "internalType": "uint256", "name": "timestamp", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "aggregator", "type": "address" } - ], - "name": "isFeedEnabled", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "base", "type": "address" }, - { "internalType": "address", "name": "quote", "type": "address" } - ], - "name": "latestAnswer", - "outputs": [ - { "internalType": "int256", "name": "answer", "type": "int256" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "base", "type": "address" }, - { "internalType": "address", "name": "quote", "type": "address" } - ], - "name": "latestRound", - "outputs": [ - { "internalType": "uint256", "name": "roundId", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "base", "type": "address" }, - { "internalType": "address", "name": "quote", "type": "address" } - ], - "name": "latestRoundData", - "outputs": [ - { "internalType": "uint80", "name": "roundId", "type": "uint80" }, - { "internalType": "int256", "name": "answer", "type": "int256" }, - { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, - { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, - { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "base", "type": "address" }, - { "internalType": "address", "name": "quote", "type": "address" } - ], - "name": "latestTimestamp", - "outputs": [ - { "internalType": "uint256", "name": "timestamp", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "base", "type": "address" }, - { "internalType": "address", "name": "quote", "type": "address" }, - { "internalType": "address", "name": "aggregator", "type": "address" } - ], - "name": "proposeFeed", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "base", "type": "address" }, - { "internalType": "address", "name": "quote", "type": "address" }, - { "internalType": "uint80", "name": "roundId", "type": "uint80" } - ], - "name": "proposedGetRoundData", - "outputs": [ - { "internalType": "uint80", "name": "id", "type": "uint80" }, - { "internalType": "int256", "name": "answer", "type": "int256" }, - { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, - { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, - { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "base", "type": "address" }, - { "internalType": "address", "name": "quote", "type": "address" } - ], - "name": "proposedLatestRoundData", - "outputs": [ - { "internalType": "uint80", "name": "id", "type": "uint80" }, - { "internalType": "int256", "name": "answer", "type": "int256" }, - { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, - { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, - { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract AccessControllerInterface", - "name": "_accessController", - "type": "address" - } - ], - "name": "setAccessController", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "typeAndVersion", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "base", "type": "address" }, - { "internalType": "address", "name": "quote", "type": "address" } - ], - "name": "version", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - } -] +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "accessController", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "AccessControllerSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "denomination", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "latestAggregator", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "previousAggregator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "nextPhaseId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "FeedConfirmed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "denomination", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "proposedAggregator", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "currentAggregator", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "FeedProposed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "OwnershipTransferRequested", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" }, + { "internalType": "address", "name": "aggregator", "type": "address" } + ], + "name": "confirmFeed", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" } + ], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" } + ], + "name": "description", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAccessController", + "outputs": [ + { + "internalType": "contract AccessControllerInterface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" }, + { "internalType": "uint256", "name": "roundId", "type": "uint256" } + ], + "name": "getAnswer", + "outputs": [ + { "internalType": "int256", "name": "answer", "type": "int256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" } + ], + "name": "getCurrentPhaseId", + "outputs": [ + { "internalType": "uint16", "name": "currentPhaseId", "type": "uint16" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" } + ], + "name": "getFeed", + "outputs": [ + { + "internalType": "contract AggregatorV2V3Interface", + "name": "aggregator", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" }, + { "internalType": "uint80", "name": "roundId", "type": "uint80" } + ], + "name": "getNextRoundId", + "outputs": [ + { "internalType": "uint80", "name": "nextRoundId", "type": "uint80" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" }, + { "internalType": "uint16", "name": "phaseId", "type": "uint16" } + ], + "name": "getPhase", + "outputs": [ + { + "components": [ + { "internalType": "uint16", "name": "phaseId", "type": "uint16" }, + { + "internalType": "uint80", + "name": "startingAggregatorRoundId", + "type": "uint80" + }, + { + "internalType": "uint80", + "name": "endingAggregatorRoundId", + "type": "uint80" + } + ], + "internalType": "struct FeedRegistryInterface.Phase", + "name": "phase", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" }, + { "internalType": "uint16", "name": "phaseId", "type": "uint16" } + ], + "name": "getPhaseFeed", + "outputs": [ + { + "internalType": "contract AggregatorV2V3Interface", + "name": "aggregator", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" }, + { "internalType": "uint16", "name": "phaseId", "type": "uint16" } + ], + "name": "getPhaseRange", + "outputs": [ + { "internalType": "uint80", "name": "startingRoundId", "type": "uint80" }, + { "internalType": "uint80", "name": "endingRoundId", "type": "uint80" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" }, + { "internalType": "uint80", "name": "roundId", "type": "uint80" } + ], + "name": "getPreviousRoundId", + "outputs": [ + { "internalType": "uint80", "name": "previousRoundId", "type": "uint80" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" } + ], + "name": "getProposedFeed", + "outputs": [ + { + "internalType": "contract AggregatorV2V3Interface", + "name": "proposedAggregator", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" }, + { "internalType": "uint80", "name": "_roundId", "type": "uint80" } + ], + "name": "getRoundData", + "outputs": [ + { "internalType": "uint80", "name": "roundId", "type": "uint80" }, + { "internalType": "int256", "name": "answer", "type": "int256" }, + { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, + { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, + { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" }, + { "internalType": "uint80", "name": "roundId", "type": "uint80" } + ], + "name": "getRoundFeed", + "outputs": [ + { + "internalType": "contract AggregatorV2V3Interface", + "name": "aggregator", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" }, + { "internalType": "uint256", "name": "roundId", "type": "uint256" } + ], + "name": "getTimestamp", + "outputs": [ + { "internalType": "uint256", "name": "timestamp", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "aggregator", "type": "address" } + ], + "name": "isFeedEnabled", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" } + ], + "name": "latestAnswer", + "outputs": [ + { "internalType": "int256", "name": "answer", "type": "int256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" } + ], + "name": "latestRound", + "outputs": [ + { "internalType": "uint256", "name": "roundId", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" } + ], + "name": "latestRoundData", + "outputs": [ + { "internalType": "uint80", "name": "roundId", "type": "uint80" }, + { "internalType": "int256", "name": "answer", "type": "int256" }, + { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, + { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, + { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" } + ], + "name": "latestTimestamp", + "outputs": [ + { "internalType": "uint256", "name": "timestamp", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" }, + { "internalType": "address", "name": "aggregator", "type": "address" } + ], + "name": "proposeFeed", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" }, + { "internalType": "uint80", "name": "roundId", "type": "uint80" } + ], + "name": "proposedGetRoundData", + "outputs": [ + { "internalType": "uint80", "name": "id", "type": "uint80" }, + { "internalType": "int256", "name": "answer", "type": "int256" }, + { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, + { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, + { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" } + ], + "name": "proposedLatestRoundData", + "outputs": [ + { "internalType": "uint80", "name": "id", "type": "uint80" }, + { "internalType": "int256", "name": "answer", "type": "int256" }, + { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, + { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, + { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract AccessControllerInterface", + "name": "_accessController", + "type": "address" + } + ], + "name": "setAccessController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "typeAndVersion", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" } + ], + "name": "version", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/subgraphs/balancer-forks/abis/Prices/Curve/Factory.json b/subgraphs/balancer-forks/abis/Prices/Curve/Factory.json deleted file mode 100644 index ca87f17950..0000000000 --- a/subgraphs/balancer-forks/abis/Prices/Curve/Factory.json +++ /dev/null @@ -1,143 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "address", - "name": "_curveAddressProviderAddress", - "type": "address" - }, - { "internalType": "address", "name": "_oracleAddress", "type": "address" } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "curveAddressProviderAddress", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "curveMetapoolFactoryAddress", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "curveRegistryAddress", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "curveLpTokenAddress", - "type": "address" - } - ], - "name": "getBasePrice", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "curveLpTokenAddress", - "type": "address" - } - ], - "name": "getCurvePriceUsdc", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "tokenAddress", "type": "address" } - ], - "name": "getPool", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "assetAddress", "type": "address" } - ], - "name": "getPriceUsdc", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "poolAddress", "type": "address" } - ], - "name": "getUnderlyingCoinFromPool", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "curveLpTokenAddress", - "type": "address" - } - ], - "name": "getVirtualPrice", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "tokenAddress", "type": "address" } - ], - "name": "isBasicToken", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "tokenAddress", "type": "address" } - ], - "name": "isCurveLpToken", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "oracleAddress", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "ownerAddress", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "bytes32", "name": "slot", "type": "bytes32" }, - { "internalType": "bytes32", "name": "value", "type": "bytes32" } - ], - "name": "updateSlot", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -] diff --git a/subgraphs/balancer-forks/abis/Prices/Curve/Pool.json b/subgraphs/balancer-forks/abis/Prices/Curve/Pool.json new file mode 100644 index 0000000000..d4843cae7d --- /dev/null +++ b/subgraphs/balancer-forks/abis/Prices/Curve/Pool.json @@ -0,0 +1,916 @@ +[ + { + "name": "TokenExchange", + "inputs": [ + { "type": "address", "name": "buyer", "indexed": true }, + { "type": "int128", "name": "sold_id", "indexed": false }, + { "type": "uint256", "name": "tokens_sold", "indexed": false }, + { "type": "int128", "name": "bought_id", "indexed": false }, + { "type": "uint256", "name": "tokens_bought", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "TokenExchange", + "inputs": [ + { "name": "buyer", "type": "address", "indexed": true }, + { "name": "sold_id", "type": "uint256", "indexed": false }, + { "name": "tokens_sold", "type": "uint256", "indexed": false }, + { "name": "bought_id", "type": "uint256", "indexed": false }, + { "name": "tokens_bought", "type": "uint256", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "TokenExchangeUnderlying", + "inputs": [ + { "name": "buyer", "type": "address", "indexed": true }, + { "name": "sold_id", "type": "int128", "indexed": false }, + { "name": "tokens_sold", "type": "uint256", "indexed": false }, + { "name": "bought_id", "type": "int128", "indexed": false }, + { "name": "tokens_bought", "type": "uint256", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "AddLiquidity", + "inputs": [ + { "name": "provider", "type": "address", "indexed": true }, + { "name": "token_amounts", "type": "uint256[2]", "indexed": false }, + { "name": "fee", "type": "uint256", "indexed": false }, + { "name": "token_supply", "type": "uint256", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "AddLiquidity", + "inputs": [ + { "name": "provider", "type": "address", "indexed": true }, + { "name": "token_amounts", "type": "uint256[3]", "indexed": false }, + { "name": "fee", "type": "uint256", "indexed": false }, + { "name": "token_supply", "type": "uint256", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "AddLiquidity", + "inputs": [ + { "name": "provider", "type": "address", "indexed": true }, + { "name": "token_amounts", "type": "uint256[2]", "indexed": false }, + { "name": "fees", "type": "uint256[2]", "indexed": false }, + { "name": "invariant", "type": "uint256", "indexed": false }, + { "name": "token_supply", "type": "uint256", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "AddLiquidity", + "inputs": [ + { "type": "address", "name": "provider", "indexed": true }, + { "type": "uint256[3]", "name": "token_amounts", "indexed": false }, + { "type": "uint256[3]", "name": "fees", "indexed": false }, + { "type": "uint256", "name": "invariant", "indexed": false }, + { "type": "uint256", "name": "token_supply", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "AddLiquidity", + "inputs": [ + { "type": "address", "name": "provider", "indexed": true }, + { "type": "uint256[4]", "name": "token_amounts", "indexed": false }, + { "type": "uint256[4]", "name": "fees", "indexed": false }, + { "type": "uint256", "name": "invariant", "indexed": false }, + { "type": "uint256", "name": "token_supply", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RemoveLiquidity", + "inputs": [ + { "name": "provider", "type": "address", "indexed": true }, + { "name": "token_amounts", "type": "uint256[2]", "indexed": false }, + { "name": "token_supply", "type": "uint256", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RemoveLiquidity", + "inputs": [ + { "name": "provider", "type": "address", "indexed": true }, + { "name": "token_amounts", "type": "uint256[3]", "indexed": false }, + { "name": "token_supply", "type": "uint256", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RemoveLiquidity", + "inputs": [ + { "name": "provider", "type": "address", "indexed": true }, + { "name": "token_amounts", "type": "uint256[2]", "indexed": false }, + { "name": "fees", "type": "uint256[2]", "indexed": false }, + { "name": "token_supply", "type": "uint256", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RemoveLiquidity", + "inputs": [ + { "type": "address", "name": "provider", "indexed": true }, + { "type": "uint256[3]", "name": "token_amounts", "indexed": false }, + { "type": "uint256[3]", "name": "fees", "indexed": false }, + { "type": "uint256", "name": "token_supply", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RemoveLiquidity", + "inputs": [ + { "type": "address", "name": "provider", "indexed": true }, + { "type": "uint256[4]", "name": "token_amounts", "indexed": false }, + { "type": "uint256[4]", "name": "fees", "indexed": false }, + { "type": "uint256", "name": "token_supply", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RemoveLiquidityOne", + "inputs": [ + { "type": "address", "name": "provider", "indexed": true }, + { "type": "uint256", "name": "token_amount", "indexed": false }, + { "type": "uint256", "name": "coin_amount", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RemoveLiquidityOne", + "inputs": [ + { "name": "provider", "type": "address", "indexed": true }, + { "name": "token_amount", "type": "uint256", "indexed": false }, + { "name": "coin_amount", "type": "uint256", "indexed": false }, + { "name": "token_supply", "type": "uint256", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RemoveLiquidityImbalance", + "inputs": [ + { "type": "address", "name": "provider", "indexed": true }, + { "type": "uint256[2]", "name": "token_amounts", "indexed": false }, + { "type": "uint256[2]", "name": "fees", "indexed": false }, + { "type": "uint256", "name": "invariant", "indexed": false }, + { "type": "uint256", "name": "token_supply", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RemoveLiquidityImbalance", + "inputs": [ + { "type": "address", "name": "provider", "indexed": true }, + { "type": "uint256[3]", "name": "token_amounts", "indexed": false }, + { "type": "uint256[3]", "name": "fees", "indexed": false }, + { "type": "uint256", "name": "invariant", "indexed": false }, + { "type": "uint256", "name": "token_supply", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RemoveLiquidityImbalance", + "inputs": [ + { "type": "address", "name": "provider", "indexed": true }, + { "type": "uint256[4]", "name": "token_amounts", "indexed": false }, + { "type": "uint256[4]", "name": "fees", "indexed": false }, + { "type": "uint256", "name": "invariant", "indexed": false }, + { "type": "uint256", "name": "token_supply", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "NewFee", + "inputs": [ + { "type": "uint256", "name": "fee", "indexed": false }, + { "type": "uint256", "name": "admin_fee", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "NewFee", + "inputs": [ + { "type": "uint256", "name": "fee", "indexed": false }, + { "type": "uint256", "name": "admin_fee", "indexed": false }, + { "type": "uint256", "name": "offpeg_fee_multiplier", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + + { + "name": "CommitNewAdmin", + "inputs": [ + { "name": "deadline", "type": "uint256", "indexed": true }, + { "name": "admin", "type": "address", "indexed": true } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "NewAdmin", + "inputs": [{ "name": "admin", "type": "address", "indexed": true }], + "anonymous": false, + "type": "event" + }, + { + "name": "CommitNewParameters", + "inputs": [ + { "name": "deadline", "type": "uint256", "indexed": true }, + { "name": "admin_fee", "type": "uint256", "indexed": false }, + { "name": "mid_fee", "type": "uint256", "indexed": false }, + { "name": "out_fee", "type": "uint256", "indexed": false }, + { "name": "fee_gamma", "type": "uint256", "indexed": false }, + { "name": "allowed_extra_profit", "type": "uint256", "indexed": false }, + { "name": "adjustment_step", "type": "uint256", "indexed": false }, + { "name": "ma_half_time", "type": "uint256", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "NewParameters", + "inputs": [ + { "name": "admin_fee", "type": "uint256", "indexed": false }, + { "name": "mid_fee", "type": "uint256", "indexed": false }, + { "name": "out_fee", "type": "uint256", "indexed": false }, + { "name": "fee_gamma", "type": "uint256", "indexed": false }, + { "name": "allowed_extra_profit", "type": "uint256", "indexed": false }, + { "name": "adjustment_step", "type": "uint256", "indexed": false }, + { "name": "ma_half_time", "type": "uint256", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RampAgamma", + "inputs": [ + { "name": "initial_A", "type": "uint256", "indexed": false }, + { "name": "future_A", "type": "uint256", "indexed": false }, + { "name": "initial_gamma", "type": "uint256", "indexed": false }, + { "name": "future_gamma", "type": "uint256", "indexed": false }, + { "name": "initial_time", "type": "uint256", "indexed": false }, + { "name": "future_time", "type": "uint256", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "StopRampA", + "inputs": [ + { "name": "current_A", "type": "uint256", "indexed": false }, + { "name": "current_gamma", "type": "uint256", "indexed": false }, + { "name": "time", "type": "uint256", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "ClaimAdminFee", + "inputs": [ + { "name": "admin", "type": "address", "indexed": true }, + { "name": "tokens", "type": "uint256", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "stateMutability": "nonpayable", + "type": "constructor", + "inputs": [ + { "name": "owner", "type": "address" }, + { "name": "admin_fee_receiver", "type": "address" }, + { "name": "A", "type": "uint256" }, + { "name": "gamma", "type": "uint256" }, + { "name": "mid_fee", "type": "uint256" }, + { "name": "out_fee", "type": "uint256" }, + { "name": "allowed_extra_profit", "type": "uint256" }, + { "name": "fee_gamma", "type": "uint256" }, + { "name": "adjustment_step", "type": "uint256" }, + { "name": "admin_fee", "type": "uint256" }, + { "name": "ma_half_time", "type": "uint256" }, + { "name": "initial_price", "type": "uint256" } + ], + "outputs": [] + }, + { "stateMutability": "payable", "type": "fallback" }, + { + "stateMutability": "view", + "type": "function", + "name": "token", + "inputs": [], + "outputs": [{ "name": "", "type": "address" }], + "gas": 516 + }, + { + "stateMutability": "view", + "type": "function", + "name": "coins", + "inputs": [{ "name": "i", "type": "uint256" }], + "outputs": [{ "name": "", "type": "address" }], + "gas": 648 + }, + { + "stateMutability": "view", + "type": "function", + "name": "A", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 685 + }, + { + "stateMutability": "view", + "type": "function", + "name": "gamma", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 11789 + }, + { + "stateMutability": "view", + "type": "function", + "name": "fee", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 17633 + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_virtual_price", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 364797 + }, + { + "stateMutability": "payable", + "type": "function", + "name": "exchange", + "inputs": [ + { "name": "i", "type": "uint256" }, + { "name": "j", "type": "uint256" }, + { "name": "dx", "type": "uint256" }, + { "name": "min_dy", "type": "uint256" } + ], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 16775598 + }, + { + "stateMutability": "payable", + "type": "function", + "name": "exchange", + "inputs": [ + { "name": "i", "type": "uint256" }, + { "name": "j", "type": "uint256" }, + { "name": "dx", "type": "uint256" }, + { "name": "min_dy", "type": "uint256" }, + { "name": "use_eth", "type": "bool" } + ], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 16775598 + }, + { + "stateMutability": "payable", + "type": "function", + "name": "exchange_underlying", + "inputs": [ + { "name": "i", "type": "uint256" }, + { "name": "j", "type": "uint256" }, + { "name": "dx", "type": "uint256" }, + { "name": "min_dy", "type": "uint256" } + ], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 16775396 + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_dy", + "inputs": [ + { "name": "i", "type": "uint256" }, + { "name": "j", "type": "uint256" }, + { "name": "dx", "type": "uint256" } + ], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 4577515 + }, + { + "stateMutability": "payable", + "type": "function", + "name": "add_liquidity", + "inputs": [ + { "name": "amounts", "type": "uint256[2]" }, + { "name": "min_mint_amount", "type": "uint256" } + ], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 17694821 + }, + { + "stateMutability": "payable", + "type": "function", + "name": "add_liquidity", + "inputs": [ + { "name": "amounts", "type": "uint256[2]" }, + { "name": "min_mint_amount", "type": "uint256" }, + { "name": "use_eth", "type": "bool" } + ], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 17694821 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "remove_liquidity", + "inputs": [ + { "name": "_amount", "type": "uint256" }, + { "name": "min_amounts", "type": "uint256[2]" } + ], + "outputs": [], + "gas": 263729 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "remove_liquidity", + "inputs": [ + { "name": "_amount", "type": "uint256" }, + { "name": "min_amounts", "type": "uint256[2]" }, + { "name": "use_eth", "type": "bool" } + ], + "outputs": [], + "gas": 263729 + }, + { + "stateMutability": "view", + "type": "function", + "name": "calc_token_amount", + "inputs": [{ "name": "amounts", "type": "uint256[2]" }], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 5200947 + }, + { + "stateMutability": "view", + "type": "function", + "name": "calc_withdraw_one_coin", + "inputs": [ + { "name": "token_amount", "type": "uint256" }, + { "name": "i", "type": "uint256" } + ], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 12584 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "remove_liquidity_one_coin", + "inputs": [ + { "name": "token_amount", "type": "uint256" }, + { "name": "i", "type": "uint256" }, + { "name": "min_amount", "type": "uint256" } + ], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 16702178 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "remove_liquidity_one_coin", + "inputs": [ + { "name": "token_amount", "type": "uint256" }, + { "name": "i", "type": "uint256" }, + { "name": "min_amount", "type": "uint256" }, + { "name": "use_eth", "type": "bool" } + ], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 16702178 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "claim_admin_fees", + "inputs": [], + "outputs": [], + "gas": 3250985 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "ramp_A_gamma", + "inputs": [ + { "name": "future_A", "type": "uint256" }, + { "name": "future_gamma", "type": "uint256" }, + { "name": "future_time", "type": "uint256" } + ], + "outputs": [], + "gas": 161698 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "stop_ramp_A_gamma", + "inputs": [], + "outputs": [], + "gas": 156743 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "commit_new_parameters", + "inputs": [ + { "name": "_new_mid_fee", "type": "uint256" }, + { "name": "_new_out_fee", "type": "uint256" }, + { "name": "_new_admin_fee", "type": "uint256" }, + { "name": "_new_fee_gamma", "type": "uint256" }, + { "name": "_new_allowed_extra_profit", "type": "uint256" }, + { "name": "_new_adjustment_step", "type": "uint256" }, + { "name": "_new_ma_half_time", "type": "uint256" } + ], + "outputs": [], + "gas": 305084 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "apply_new_parameters", + "inputs": [], + "outputs": [], + "gas": 3543175 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "revert_new_parameters", + "inputs": [], + "outputs": [], + "gas": 23142 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "commit_transfer_ownership", + "inputs": [{ "name": "_owner", "type": "address" }], + "outputs": [], + "gas": 78827 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "apply_transfer_ownership", + "inputs": [], + "outputs": [], + "gas": 67042 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "revert_transfer_ownership", + "inputs": [], + "outputs": [], + "gas": 23232 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "kill_me", + "inputs": [], + "outputs": [], + "gas": 40455 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "unkill_me", + "inputs": [], + "outputs": [], + "gas": 23292 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_admin_fee_receiver", + "inputs": [{ "name": "_admin_fee_receiver", "type": "address" }], + "outputs": [], + "gas": 38482 + }, + { + "stateMutability": "view", + "type": "function", + "name": "lp_price", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 217046 + }, + { + "stateMutability": "view", + "type": "function", + "name": "price_scale", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3426 + }, + { + "stateMutability": "view", + "type": "function", + "name": "price_oracle", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3456 + }, + { + "stateMutability": "view", + "type": "function", + "name": "price_oracle", + "inputs": [{ "name": "", "type": "uint256" }], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3456 + }, + { + "stateMutability": "view", + "type": "function", + "name": "last_prices", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3486 + }, + { + "stateMutability": "view", + "type": "function", + "name": "last_prices_timestamp", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3516 + }, + { + "stateMutability": "view", + "type": "function", + "name": "initial_A_gamma", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3546 + }, + { + "stateMutability": "view", + "type": "function", + "name": "future_A_gamma", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3576 + }, + { + "stateMutability": "view", + "type": "function", + "name": "initial_A_gamma_time", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3606 + }, + { + "stateMutability": "view", + "type": "function", + "name": "future_A_gamma_time", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3636 + }, + { + "stateMutability": "view", + "type": "function", + "name": "allowed_extra_profit", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3666 + }, + { + "stateMutability": "view", + "type": "function", + "name": "future_allowed_extra_profit", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3696 + }, + { + "stateMutability": "view", + "type": "function", + "name": "fee_gamma", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3726 + }, + { + "stateMutability": "view", + "type": "function", + "name": "future_fee_gamma", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3756 + }, + { + "stateMutability": "view", + "type": "function", + "name": "adjustment_step", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3786 + }, + { + "stateMutability": "view", + "type": "function", + "name": "future_adjustment_step", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3816 + }, + { + "stateMutability": "view", + "type": "function", + "name": "ma_half_time", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3846 + }, + { + "stateMutability": "view", + "type": "function", + "name": "future_ma_half_time", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3876 + }, + { + "stateMutability": "view", + "type": "function", + "name": "mid_fee", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3906 + }, + { + "stateMutability": "view", + "type": "function", + "name": "out_fee", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3936 + }, + { + "stateMutability": "view", + "type": "function", + "name": "admin_fee", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3966 + }, + { + "stateMutability": "view", + "type": "function", + "name": "future_mid_fee", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3996 + }, + { + "stateMutability": "view", + "type": "function", + "name": "future_out_fee", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 4026 + }, + { + "stateMutability": "view", + "type": "function", + "name": "future_admin_fee", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 4056 + }, + { + "stateMutability": "view", + "type": "function", + "name": "balances", + "inputs": [{ "name": "arg0", "type": "uint256" }], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 4131 + }, + { + "stateMutability": "view", + "type": "function", + "name": "D", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 4116 + }, + { + "stateMutability": "view", + "type": "function", + "name": "owner", + "inputs": [], + "outputs": [{ "name": "", "type": "address" }], + "gas": 4146 + }, + { + "stateMutability": "view", + "type": "function", + "name": "future_owner", + "inputs": [], + "outputs": [{ "name": "", "type": "address" }], + "gas": 4176 + }, + { + "stateMutability": "view", + "type": "function", + "name": "xcp_profit", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 4206 + }, + { + "stateMutability": "view", + "type": "function", + "name": "xcp_profit_a", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 4236 + }, + { + "stateMutability": "view", + "type": "function", + "name": "virtual_price", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 4266 + }, + { + "stateMutability": "view", + "type": "function", + "name": "is_killed", + "inputs": [], + "outputs": [{ "name": "", "type": "bool" }], + "gas": 4296 + }, + { + "stateMutability": "view", + "type": "function", + "name": "kill_deadline", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 4326 + }, + { + "stateMutability": "view", + "type": "function", + "name": "transfer_ownership_deadline", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 4356 + }, + { + "stateMutability": "view", + "type": "function", + "name": "admin_actions_deadline", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 4386 + }, + { + "stateMutability": "view", + "type": "function", + "name": "admin_fee_receiver", + "inputs": [], + "outputs": [{ "name": "", "type": "address" }], + "gas": 4416 + }, + { + "name": "lp_token", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 2291 + } +] diff --git a/subgraphs/balancer-forks/abis/Prices/Curve/PoolRegistry.json b/subgraphs/balancer-forks/abis/Prices/Curve/PoolRegistry.json deleted file mode 100644 index 62b67c1cda..0000000000 --- a/subgraphs/balancer-forks/abis/Prices/Curve/PoolRegistry.json +++ /dev/null @@ -1,294 +0,0 @@ -[ - { - "name": "PoolAdded", - "inputs": [{ "name": "pool", "type": "address", "indexed": true }], - "anonymous": false, - "type": "event" - }, - { - "name": "PoolRemoved", - "inputs": [{ "name": "pool", "type": "address", "indexed": true }], - "anonymous": false, - "type": "event" - }, - { - "stateMutability": "nonpayable", - "type": "constructor", - "inputs": [{ "name": "_address_provider", "type": "address" }], - "outputs": [] - }, - { - "stateMutability": "view", - "type": "function", - "name": "find_pool_for_coins", - "inputs": [ - { "name": "_from", "type": "address" }, - { "name": "_to", "type": "address" } - ], - "outputs": [{ "name": "", "type": "address" }], - "gas": 3111 - }, - { - "stateMutability": "view", - "type": "function", - "name": "find_pool_for_coins", - "inputs": [ - { "name": "_from", "type": "address" }, - { "name": "_to", "type": "address" }, - { "name": "i", "type": "uint256" } - ], - "outputs": [{ "name": "", "type": "address" }], - "gas": 3111 - }, - { - "stateMutability": "view", - "type": "function", - "name": "get_n_coins", - "inputs": [{ "name": "_pool", "type": "address" }], - "outputs": [{ "name": "", "type": "uint256" }], - "gas": 2834 - }, - { - "stateMutability": "view", - "type": "function", - "name": "get_coins", - "inputs": [{ "name": "_pool", "type": "address" }], - "outputs": [{ "name": "", "type": "address[8]" }], - "gas": 22975 - }, - { - "stateMutability": "view", - "type": "function", - "name": "get_decimals", - "inputs": [{ "name": "_pool", "type": "address" }], - "outputs": [{ "name": "", "type": "uint256[8]" }], - "gas": 9818 - }, - { - "stateMutability": "view", - "type": "function", - "name": "get_gauges", - "inputs": [{ "name": "_pool", "type": "address" }], - "outputs": [ - { "name": "", "type": "address[10]" }, - { "name": "", "type": "int128[10]" } - ], - "gas": 26055 - }, - { - "stateMutability": "view", - "type": "function", - "name": "get_balances", - "inputs": [{ "name": "_pool", "type": "address" }], - "outputs": [{ "name": "", "type": "uint256[8]" }], - "gas": 41626 - }, - { - "stateMutability": "view", - "type": "function", - "name": "get_virtual_price_from_lp_token", - "inputs": [{ "name": "_token", "type": "address" }], - "outputs": [{ "name": "", "type": "uint256" }], - "gas": 5321 - }, - { - "stateMutability": "view", - "type": "function", - "name": "get_A", - "inputs": [{ "name": "_pool", "type": "address" }], - "outputs": [{ "name": "", "type": "uint256" }], - "gas": 3139 - }, - { - "stateMutability": "view", - "type": "function", - "name": "get_D", - "inputs": [{ "name": "_pool", "type": "address" }], - "outputs": [{ "name": "", "type": "uint256" }], - "gas": 3169 - }, - { - "stateMutability": "view", - "type": "function", - "name": "get_gamma", - "inputs": [{ "name": "_pool", "type": "address" }], - "outputs": [{ "name": "", "type": "uint256" }], - "gas": 3199 - }, - { - "stateMutability": "view", - "type": "function", - "name": "get_fees", - "inputs": [{ "name": "_pool", "type": "address" }], - "outputs": [{ "name": "", "type": "uint256[4]" }], - "gas": 10333 - }, - { - "stateMutability": "view", - "type": "function", - "name": "get_admin_balances", - "inputs": [{ "name": "_pool", "type": "address" }], - "outputs": [{ "name": "", "type": "uint256[8]" }], - "gas": 85771 - }, - { - "stateMutability": "view", - "type": "function", - "name": "get_coin_indices", - "inputs": [ - { "name": "_pool", "type": "address" }, - { "name": "_from", "type": "address" }, - { "name": "_to", "type": "address" } - ], - "outputs": [ - { "name": "", "type": "uint256" }, - { "name": "", "type": "uint256" } - ], - "gas": 23608 - }, - { - "stateMutability": "view", - "type": "function", - "name": "get_pool_name", - "inputs": [{ "name": "_pool", "type": "address" }], - "outputs": [{ "name": "", "type": "string" }], - "gas": 13576 - }, - { - "stateMutability": "view", - "type": "function", - "name": "get_coin_swap_count", - "inputs": [{ "name": "_coin", "type": "address" }], - "outputs": [{ "name": "", "type": "uint256" }], - "gas": 3224 - }, - { - "stateMutability": "view", - "type": "function", - "name": "get_coin_swap_complement", - "inputs": [ - { "name": "_coin", "type": "address" }, - { "name": "_index", "type": "uint256" } - ], - "outputs": [{ "name": "", "type": "address" }], - "gas": 3299 - }, - { - "stateMutability": "nonpayable", - "type": "function", - "name": "add_pool", - "inputs": [ - { "name": "_pool", "type": "address" }, - { "name": "_n_coins", "type": "uint256" }, - { "name": "_lp_token", "type": "address" }, - { "name": "_gauge", "type": "address" }, - { "name": "_zap", "type": "address" }, - { "name": "_decimals", "type": "uint256" }, - { "name": "_name", "type": "string" } - ], - "outputs": [], - "gas": 18586944 - }, - { - "stateMutability": "nonpayable", - "type": "function", - "name": "remove_pool", - "inputs": [{ "name": "_pool", "type": "address" }], - "outputs": [], - "gas": 399675363514 - }, - { - "stateMutability": "nonpayable", - "type": "function", - "name": "set_liquidity_gauges", - "inputs": [ - { "name": "_pool", "type": "address" }, - { "name": "_liquidity_gauges", "type": "address[10]" } - ], - "outputs": [], - "gas": 422284 - }, - { - "stateMutability": "nonpayable", - "type": "function", - "name": "batch_set_liquidity_gauges", - "inputs": [ - { "name": "_pools", "type": "address[10]" }, - { "name": "_liquidity_gauges", "type": "address[10]" } - ], - "outputs": [], - "gas": 444084 - }, - { - "stateMutability": "view", - "type": "function", - "name": "address_provider", - "inputs": [], - "outputs": [{ "name": "", "type": "address" }], - "gas": 3126 - }, - { - "stateMutability": "view", - "type": "function", - "name": "pool_list", - "inputs": [{ "name": "arg0", "type": "uint256" }], - "outputs": [{ "name": "", "type": "address" }], - "gas": 3201 - }, - { - "stateMutability": "view", - "type": "function", - "name": "pool_count", - "inputs": [], - "outputs": [{ "name": "", "type": "uint256" }], - "gas": 3186 - }, - { - "stateMutability": "view", - "type": "function", - "name": "coin_count", - "inputs": [], - "outputs": [{ "name": "", "type": "uint256" }], - "gas": 3216 - }, - { - "stateMutability": "view", - "type": "function", - "name": "get_coin", - "inputs": [{ "name": "arg0", "type": "uint256" }], - "outputs": [{ "name": "", "type": "address" }], - "gas": 3291 - }, - { - "stateMutability": "view", - "type": "function", - "name": "get_pool_from_lp_token", - "inputs": [{ "name": "arg0", "type": "address" }], - "outputs": [{ "name": "", "type": "address" }], - "gas": 3548 - }, - { - "stateMutability": "view", - "type": "function", - "name": "get_lp_token", - "inputs": [{ "name": "arg0", "type": "address" }], - "outputs": [{ "name": "", "type": "address" }], - "gas": 3578 - }, - { - "stateMutability": "view", - "type": "function", - "name": "get_zap", - "inputs": [{ "name": "arg0", "type": "address" }], - "outputs": [{ "name": "", "type": "address" }], - "gas": 3608 - }, - { - "stateMutability": "view", - "type": "function", - "name": "last_updated", - "inputs": [], - "outputs": [{ "name": "", "type": "uint256" }], - "gas": 3366 - } -] diff --git a/subgraphs/balancer-forks/abis/Prices/Curve/Registry.json b/subgraphs/balancer-forks/abis/Prices/Curve/Registry.json index 1b6f69c498..9747624cc9 100644 --- a/subgraphs/balancer-forks/abis/Prices/Curve/Registry.json +++ b/subgraphs/balancer-forks/abis/Prices/Curve/Registry.json @@ -1,337 +1,337 @@ -[ - { - "name": "PoolAdded", - "inputs": [ - { "type": "address", "name": "pool", "indexed": true }, - { "type": "bytes", "name": "rate_method_id", "indexed": false } - ], - "anonymous": false, - "type": "event" - }, - { - "name": "PoolRemoved", - "inputs": [{ "type": "address", "name": "pool", "indexed": true }], - "anonymous": false, - "type": "event" - }, - { - "outputs": [], - "inputs": [ - { "type": "address", "name": "_address_provider" }, - { "type": "address", "name": "_gauge_controller" } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "name": "find_pool_for_coins", - "outputs": [{ "type": "address", "name": "" }], - "inputs": [ - { "type": "address", "name": "_from" }, - { "type": "address", "name": "_to" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "name": "find_pool_for_coins", - "outputs": [{ "type": "address", "name": "" }], - "inputs": [ - { "type": "address", "name": "_from" }, - { "type": "address", "name": "_to" }, - { "type": "uint256", "name": "i" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "name": "get_n_coins", - "outputs": [{ "type": "uint256[2]", "name": "" }], - "inputs": [{ "type": "address", "name": "_pool" }], - "stateMutability": "view", - "type": "function", - "gas": 1704 - }, - { - "name": "get_coins", - "outputs": [{ "type": "address[8]", "name": "" }], - "inputs": [{ "type": "address", "name": "_pool" }], - "stateMutability": "view", - "type": "function", - "gas": 12285 - }, - { - "name": "get_underlying_coins", - "outputs": [{ "type": "address[8]", "name": "" }], - "inputs": [{ "type": "address", "name": "_pool" }], - "stateMutability": "view", - "type": "function", - "gas": 12347 - }, - { - "name": "get_decimals", - "outputs": [{ "type": "uint256[8]", "name": "" }], - "inputs": [{ "type": "address", "name": "_pool" }], - "stateMutability": "view", - "type": "function", - "gas": 8199 - }, - { - "name": "get_underlying_decimals", - "outputs": [{ "type": "uint256[8]", "name": "" }], - "inputs": [{ "type": "address", "name": "_pool" }], - "stateMutability": "view", - "type": "function", - "gas": 8261 - }, - { - "name": "get_rates", - "outputs": [{ "type": "uint256[8]", "name": "" }], - "inputs": [{ "type": "address", "name": "_pool" }], - "stateMutability": "view", - "type": "function", - "gas": 34780 - }, - { - "name": "get_gauges", - "outputs": [ - { "type": "address[10]", "name": "" }, - { "type": "int128[10]", "name": "" } - ], - "inputs": [{ "type": "address", "name": "_pool" }], - "stateMutability": "view", - "type": "function", - "gas": 20310 - }, - { - "name": "get_balances", - "outputs": [{ "type": "uint256[8]", "name": "" }], - "inputs": [{ "type": "address", "name": "_pool" }], - "stateMutability": "view", - "type": "function", - "gas": 16818 - }, - { - "name": "get_underlying_balances", - "outputs": [{ "type": "uint256[8]", "name": "" }], - "inputs": [{ "type": "address", "name": "_pool" }], - "stateMutability": "view", - "type": "function", - "gas": 158953 - }, - { - "name": "get_virtual_price_from_lp_token", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [{ "type": "address", "name": "_token" }], - "stateMutability": "view", - "type": "function", - "gas": 2080 - }, - { - "name": "get_A", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [{ "type": "address", "name": "_pool" }], - "stateMutability": "view", - "type": "function", - "gas": 1198 - }, - { - "name": "get_parameters", - "outputs": [ - { "type": "uint256", "name": "A" }, - { "type": "uint256", "name": "future_A" }, - { "type": "uint256", "name": "fee" }, - { "type": "uint256", "name": "admin_fee" }, - { "type": "uint256", "name": "future_fee" }, - { "type": "uint256", "name": "future_admin_fee" }, - { "type": "address", "name": "future_owner" }, - { "type": "uint256", "name": "initial_A" }, - { "type": "uint256", "name": "initial_A_time" }, - { "type": "uint256", "name": "future_A_time" } - ], - "inputs": [{ "type": "address", "name": "_pool" }], - "stateMutability": "view", - "type": "function", - "gas": 6458 - }, - { - "name": "get_fees", - "outputs": [{ "type": "uint256[2]", "name": "" }], - "inputs": [{ "type": "address", "name": "_pool" }], - "stateMutability": "view", - "type": "function", - "gas": 1603 - }, - { - "name": "get_admin_balances", - "outputs": [{ "type": "uint256[8]", "name": "" }], - "inputs": [{ "type": "address", "name": "_pool" }], - "stateMutability": "view", - "type": "function", - "gas": 36719 - }, - { - "name": "get_coin_indices", - "outputs": [ - { "type": "int128", "name": "" }, - { "type": "int128", "name": "" }, - { "type": "bool", "name": "" } - ], - "inputs": [ - { "type": "address", "name": "_pool" }, - { "type": "address", "name": "_from" }, - { "type": "address", "name": "_to" } - ], - "stateMutability": "view", - "type": "function", - "gas": 27456 - }, - { - "name": "estimate_gas_used", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [ - { "type": "address", "name": "_pool" }, - { "type": "address", "name": "_from" }, - { "type": "address", "name": "_to" } - ], - "stateMutability": "view", - "type": "function", - "gas": 32329 - }, - { - "name": "add_pool", - "outputs": [], - "inputs": [ - { "type": "address", "name": "_pool" }, - { "type": "uint256", "name": "_n_coins" }, - { "type": "address", "name": "_lp_token" }, - { "type": "bytes32", "name": "_rate_method_id" }, - { "type": "uint256", "name": "_decimals" }, - { "type": "uint256", "name": "_underlying_decimals" }, - { "type": "bool", "name": "_has_initial_A" }, - { "type": "bool", "name": "_is_v1" } - ], - "stateMutability": "nonpayable", - "type": "function", - "gas": 10196577 - }, - { - "name": "add_pool_without_underlying", - "outputs": [], - "inputs": [ - { "type": "address", "name": "_pool" }, - { "type": "uint256", "name": "_n_coins" }, - { "type": "address", "name": "_lp_token" }, - { "type": "bytes32", "name": "_rate_method_id" }, - { "type": "uint256", "name": "_decimals" }, - { "type": "uint256", "name": "_use_rates" }, - { "type": "bool", "name": "_has_initial_A" }, - { "type": "bool", "name": "_is_v1" } - ], - "stateMutability": "nonpayable", - "type": "function", - "gas": 5590664 - }, - { - "name": "add_metapool", - "outputs": [], - "inputs": [ - { "type": "address", "name": "_pool" }, - { "type": "uint256", "name": "_n_coins" }, - { "type": "address", "name": "_lp_token" }, - { "type": "uint256", "name": "_decimals" } - ], - "stateMutability": "nonpayable", - "type": "function", - "gas": 10226976 - }, - { - "name": "remove_pool", - "outputs": [], - "inputs": [{ "type": "address", "name": "_pool" }], - "stateMutability": "nonpayable", - "type": "function", - "gas": 779646579509 - }, - { - "name": "set_coin_gas_estimates", - "outputs": [], - "inputs": [ - { "type": "address[10]", "name": "_addr" }, - { "type": "uint256[10]", "name": "_amount" } - ], - "stateMutability": "nonpayable", - "type": "function", - "gas": 357165 - }, - { - "name": "set_gas_estimate_contract", - "outputs": [], - "inputs": [ - { "type": "address", "name": "_pool" }, - { "type": "address", "name": "_estimator" } - ], - "stateMutability": "nonpayable", - "type": "function", - "gas": 37747 - }, - { - "name": "set_liquidity_gauges", - "outputs": [], - "inputs": [ - { "type": "address", "name": "_pool" }, - { "type": "address[10]", "name": "_liquidity_gauges" } - ], - "stateMutability": "nonpayable", - "type": "function", - "gas": 365793 - }, - { - "name": "address_provider", - "outputs": [{ "type": "address", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 2111 - }, - { - "name": "gauge_controller", - "outputs": [{ "type": "address", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 2141 - }, - { - "name": "pool_list", - "outputs": [{ "type": "address", "name": "" }], - "inputs": [{ "type": "uint256", "name": "arg0" }], - "stateMutability": "view", - "type": "function", - "gas": 2280 - }, - { - "name": "pool_count", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 2201 - }, - { - "name": "get_pool_from_lp_token", - "outputs": [{ "type": "address", "name": "" }], - "inputs": [{ "type": "address", "name": "arg0" }], - "stateMutability": "view", - "type": "function", - "gas": 2446 - }, - { - "name": "get_lp_token", - "outputs": [{ "type": "address", "name": "" }], - "inputs": [{ "type": "address", "name": "arg0" }], - "stateMutability": "view", - "type": "function", - "gas": 2476 - } -] +[ + { + "name": "PoolAdded", + "inputs": [ + { "type": "address", "name": "pool", "indexed": true }, + { "type": "bytes", "name": "rate_method_id", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "PoolRemoved", + "inputs": [{ "type": "address", "name": "pool", "indexed": true }], + "anonymous": false, + "type": "event" + }, + { + "outputs": [], + "inputs": [ + { "type": "address", "name": "_address_provider" }, + { "type": "address", "name": "_gauge_controller" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "name": "find_pool_for_coins", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [ + { "type": "address", "name": "_from" }, + { "type": "address", "name": "_to" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "name": "find_pool_for_coins", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [ + { "type": "address", "name": "_from" }, + { "type": "address", "name": "_to" }, + { "type": "uint256", "name": "i" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "name": "get_n_coins", + "outputs": [{ "type": "uint256[2]", "name": "" }], + "inputs": [{ "type": "address", "name": "_pool" }], + "stateMutability": "view", + "type": "function", + "gas": 1704 + }, + { + "name": "get_coins", + "outputs": [{ "type": "address[8]", "name": "" }], + "inputs": [{ "type": "address", "name": "_pool" }], + "stateMutability": "view", + "type": "function", + "gas": 12285 + }, + { + "name": "get_underlying_coins", + "outputs": [{ "type": "address[8]", "name": "" }], + "inputs": [{ "type": "address", "name": "_pool" }], + "stateMutability": "view", + "type": "function", + "gas": 12347 + }, + { + "name": "get_decimals", + "outputs": [{ "type": "uint256[8]", "name": "" }], + "inputs": [{ "type": "address", "name": "_pool" }], + "stateMutability": "view", + "type": "function", + "gas": 8199 + }, + { + "name": "get_underlying_decimals", + "outputs": [{ "type": "uint256[8]", "name": "" }], + "inputs": [{ "type": "address", "name": "_pool" }], + "stateMutability": "view", + "type": "function", + "gas": 8261 + }, + { + "name": "get_rates", + "outputs": [{ "type": "uint256[8]", "name": "" }], + "inputs": [{ "type": "address", "name": "_pool" }], + "stateMutability": "view", + "type": "function", + "gas": 34780 + }, + { + "name": "get_gauges", + "outputs": [ + { "type": "address[10]", "name": "" }, + { "type": "int128[10]", "name": "" } + ], + "inputs": [{ "type": "address", "name": "_pool" }], + "stateMutability": "view", + "type": "function", + "gas": 20310 + }, + { + "name": "get_balances", + "outputs": [{ "type": "uint256[8]", "name": "" }], + "inputs": [{ "type": "address", "name": "_pool" }], + "stateMutability": "view", + "type": "function", + "gas": 16818 + }, + { + "name": "get_underlying_balances", + "outputs": [{ "type": "uint256[8]", "name": "" }], + "inputs": [{ "type": "address", "name": "_pool" }], + "stateMutability": "view", + "type": "function", + "gas": 158953 + }, + { + "name": "get_virtual_price_from_lp_token", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [{ "type": "address", "name": "_token" }], + "stateMutability": "view", + "type": "function", + "gas": 2080 + }, + { + "name": "get_A", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [{ "type": "address", "name": "_pool" }], + "stateMutability": "view", + "type": "function", + "gas": 1198 + }, + { + "name": "get_parameters", + "outputs": [ + { "type": "uint256", "name": "A" }, + { "type": "uint256", "name": "future_A" }, + { "type": "uint256", "name": "fee" }, + { "type": "uint256", "name": "admin_fee" }, + { "type": "uint256", "name": "future_fee" }, + { "type": "uint256", "name": "future_admin_fee" }, + { "type": "address", "name": "future_owner" }, + { "type": "uint256", "name": "initial_A" }, + { "type": "uint256", "name": "initial_A_time" }, + { "type": "uint256", "name": "future_A_time" } + ], + "inputs": [{ "type": "address", "name": "_pool" }], + "stateMutability": "view", + "type": "function", + "gas": 6458 + }, + { + "name": "get_fees", + "outputs": [{ "type": "uint256[2]", "name": "" }], + "inputs": [{ "type": "address", "name": "_pool" }], + "stateMutability": "view", + "type": "function", + "gas": 1603 + }, + { + "name": "get_admin_balances", + "outputs": [{ "type": "uint256[8]", "name": "" }], + "inputs": [{ "type": "address", "name": "_pool" }], + "stateMutability": "view", + "type": "function", + "gas": 36719 + }, + { + "name": "get_coin_indices", + "outputs": [ + { "type": "int128", "name": "" }, + { "type": "int128", "name": "" }, + { "type": "bool", "name": "" } + ], + "inputs": [ + { "type": "address", "name": "_pool" }, + { "type": "address", "name": "_from" }, + { "type": "address", "name": "_to" } + ], + "stateMutability": "view", + "type": "function", + "gas": 27456 + }, + { + "name": "estimate_gas_used", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [ + { "type": "address", "name": "_pool" }, + { "type": "address", "name": "_from" }, + { "type": "address", "name": "_to" } + ], + "stateMutability": "view", + "type": "function", + "gas": 32329 + }, + { + "name": "add_pool", + "outputs": [], + "inputs": [ + { "type": "address", "name": "_pool" }, + { "type": "uint256", "name": "_n_coins" }, + { "type": "address", "name": "_lp_token" }, + { "type": "bytes32", "name": "_rate_method_id" }, + { "type": "uint256", "name": "_decimals" }, + { "type": "uint256", "name": "_underlying_decimals" }, + { "type": "bool", "name": "_has_initial_A" }, + { "type": "bool", "name": "_is_v1" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 10196577 + }, + { + "name": "add_pool_without_underlying", + "outputs": [], + "inputs": [ + { "type": "address", "name": "_pool" }, + { "type": "uint256", "name": "_n_coins" }, + { "type": "address", "name": "_lp_token" }, + { "type": "bytes32", "name": "_rate_method_id" }, + { "type": "uint256", "name": "_decimals" }, + { "type": "uint256", "name": "_use_rates" }, + { "type": "bool", "name": "_has_initial_A" }, + { "type": "bool", "name": "_is_v1" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 5590664 + }, + { + "name": "add_metapool", + "outputs": [], + "inputs": [ + { "type": "address", "name": "_pool" }, + { "type": "uint256", "name": "_n_coins" }, + { "type": "address", "name": "_lp_token" }, + { "type": "uint256", "name": "_decimals" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 10226976 + }, + { + "name": "remove_pool", + "outputs": [], + "inputs": [{ "type": "address", "name": "_pool" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 779646579509 + }, + { + "name": "set_coin_gas_estimates", + "outputs": [], + "inputs": [ + { "type": "address[10]", "name": "_addr" }, + { "type": "uint256[10]", "name": "_amount" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 357165 + }, + { + "name": "set_gas_estimate_contract", + "outputs": [], + "inputs": [ + { "type": "address", "name": "_pool" }, + { "type": "address", "name": "_estimator" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 37747 + }, + { + "name": "set_liquidity_gauges", + "outputs": [], + "inputs": [ + { "type": "address", "name": "_pool" }, + { "type": "address[10]", "name": "_liquidity_gauges" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 365793 + }, + { + "name": "address_provider", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 2111 + }, + { + "name": "gauge_controller", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 2141 + }, + { + "name": "pool_list", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [{ "type": "uint256", "name": "arg0" }], + "stateMutability": "view", + "type": "function", + "gas": 2280 + }, + { + "name": "pool_count", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 2201 + }, + { + "name": "get_pool_from_lp_token", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [{ "type": "address", "name": "arg0" }], + "stateMutability": "view", + "type": "function", + "gas": 2446 + }, + { + "name": "get_lp_token", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [{ "type": "address", "name": "arg0" }], + "stateMutability": "view", + "type": "function", + "gas": 2476 + } +] diff --git a/subgraphs/balancer-forks/abis/Prices/ERC20.json b/subgraphs/balancer-forks/abis/Prices/ERC20.json index 7c457fe906..5c47f76a53 100644 --- a/subgraphs/balancer-forks/abis/Prices/ERC20.json +++ b/subgraphs/balancer-forks/abis/Prices/ERC20.json @@ -1,828 +1,828 @@ -[ - { - "name": "Transfer", - "inputs": [ - { "type": "address", "name": "sender", "indexed": true }, - { "type": "address", "name": "receiver", "indexed": true }, - { "type": "uint256", "name": "value", "indexed": false } - ], - "anonymous": false, - "type": "event" - }, - { - "name": "Approval", - "inputs": [ - { "type": "address", "name": "owner", "indexed": true }, - { "type": "address", "name": "spender", "indexed": true }, - { "type": "uint256", "name": "value", "indexed": false } - ], - "anonymous": false, - "type": "event" - }, - { - "name": "StrategyAdded", - "inputs": [ - { "type": "address", "name": "strategy", "indexed": true }, - { "type": "uint256", "name": "debtRatio", "indexed": false }, - { "type": "uint256", "name": "rateLimit", "indexed": false }, - { "type": "uint256", "name": "performanceFee", "indexed": false } - ], - "anonymous": false, - "type": "event" - }, - { - "name": "StrategyReported", - "inputs": [ - { "type": "address", "name": "strategy", "indexed": true }, - { "type": "uint256", "name": "gain", "indexed": false }, - { "type": "uint256", "name": "loss", "indexed": false }, - { "type": "uint256", "name": "totalGain", "indexed": false }, - { "type": "uint256", "name": "totalLoss", "indexed": false }, - { "type": "uint256", "name": "totalDebt", "indexed": false }, - { "type": "uint256", "name": "debtAdded", "indexed": false }, - { "type": "uint256", "name": "debtRatio", "indexed": false } - ], - "anonymous": false, - "type": "event" - }, - { - "name": "UpdateGovernance", - "inputs": [{ "type": "address", "name": "governance", "indexed": false }], - "anonymous": false, - "type": "event" - }, - { - "name": "UpdateManagement", - "inputs": [{ "type": "address", "name": "management", "indexed": false }], - "anonymous": false, - "type": "event" - }, - { - "name": "UpdateGuestList", - "inputs": [{ "type": "address", "name": "guestList", "indexed": false }], - "anonymous": false, - "type": "event" - }, - { - "name": "UpdateRewards", - "inputs": [{ "type": "address", "name": "rewards", "indexed": false }], - "anonymous": false, - "type": "event" - }, - { - "name": "UpdateDepositLimit", - "inputs": [{ "type": "uint256", "name": "depositLimit", "indexed": false }], - "anonymous": false, - "type": "event" - }, - { - "name": "UpdatePerformanceFee", - "inputs": [ - { "type": "uint256", "name": "performanceFee", "indexed": false } - ], - "anonymous": false, - "type": "event" - }, - { - "name": "UpdateManagementFee", - "inputs": [ - { "type": "uint256", "name": "managementFee", "indexed": false } - ], - "anonymous": false, - "type": "event" - }, - { - "name": "UpdateGuardian", - "inputs": [{ "type": "address", "name": "guardian", "indexed": false }], - "anonymous": false, - "type": "event" - }, - { - "name": "EmergencyShutdown", - "inputs": [{ "type": "bool", "name": "active", "indexed": false }], - "anonymous": false, - "type": "event" - }, - { - "name": "UpdateWithdrawalQueue", - "inputs": [{ "type": "address[20]", "name": "queue", "indexed": false }], - "anonymous": false, - "type": "event" - }, - { - "name": "StrategyUpdateDebtRatio", - "inputs": [ - { "type": "address", "name": "strategy", "indexed": true }, - { "type": "uint256", "name": "debtRatio", "indexed": false } - ], - "anonymous": false, - "type": "event" - }, - { - "name": "StrategyUpdateRateLimit", - "inputs": [ - { "type": "address", "name": "strategy", "indexed": true }, - { "type": "uint256", "name": "rateLimit", "indexed": false } - ], - "anonymous": false, - "type": "event" - }, - { - "name": "StrategyUpdatePerformanceFee", - "inputs": [ - { "type": "address", "name": "strategy", "indexed": true }, - { "type": "uint256", "name": "performanceFee", "indexed": false } - ], - "anonymous": false, - "type": "event" - }, - { - "name": "StrategyMigrated", - "inputs": [ - { "type": "address", "name": "oldVersion", "indexed": true }, - { "type": "address", "name": "newVersion", "indexed": true } - ], - "anonymous": false, - "type": "event" - }, - { - "name": "StrategyRevoked", - "inputs": [{ "type": "address", "name": "strategy", "indexed": true }], - "anonymous": false, - "type": "event" - }, - { - "name": "StrategyRemovedFromQueue", - "inputs": [{ "type": "address", "name": "strategy", "indexed": true }], - "anonymous": false, - "type": "event" - }, - { - "name": "StrategyAddedToQueue", - "inputs": [{ "type": "address", "name": "strategy", "indexed": true }], - "anonymous": false, - "type": "event" - }, - { - "name": "initialize", - "outputs": [], - "inputs": [ - { "type": "address", "name": "token" }, - { "type": "address", "name": "governance" }, - { "type": "address", "name": "rewards" }, - { "type": "string", "name": "nameOverride" }, - { "type": "string", "name": "symbolOverride" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "name": "initialize", - "outputs": [], - "inputs": [ - { "type": "address", "name": "token" }, - { "type": "address", "name": "governance" }, - { "type": "address", "name": "rewards" }, - { "type": "string", "name": "nameOverride" }, - { "type": "string", "name": "symbolOverride" }, - { "type": "address", "name": "guardian" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "name": "apiVersion", - "outputs": [{ "type": "string", "name": "" }], - "inputs": [], - "stateMutability": "pure", - "type": "function", - "gas": 4519 - }, - { - "name": "setName", - "outputs": [], - "inputs": [{ "type": "string", "name": "name" }], - "stateMutability": "nonpayable", - "type": "function", - "gas": 107017 - }, - { - "name": "setSymbol", - "outputs": [], - "inputs": [{ "type": "string", "name": "symbol" }], - "stateMutability": "nonpayable", - "type": "function", - "gas": 71867 - }, - { - "name": "setGovernance", - "outputs": [], - "inputs": [{ "type": "address", "name": "governance" }], - "stateMutability": "nonpayable", - "type": "function", - "gas": 36338 - }, - { - "name": "acceptGovernance", - "outputs": [], - "inputs": [], - "stateMutability": "nonpayable", - "type": "function", - "gas": 37610 - }, - { - "name": "setManagement", - "outputs": [], - "inputs": [{ "type": "address", "name": "management" }], - "stateMutability": "nonpayable", - "type": "function", - "gas": 37748 - }, - { - "name": "setGuestList", - "outputs": [], - "inputs": [{ "type": "address", "name": "guestList" }], - "stateMutability": "nonpayable", - "type": "function", - "gas": 37778 - }, - { - "name": "setRewards", - "outputs": [], - "inputs": [{ "type": "address", "name": "rewards" }], - "stateMutability": "nonpayable", - "type": "function", - "gas": 37808 - }, - { - "name": "setDepositLimit", - "outputs": [], - "inputs": [{ "type": "uint256", "name": "limit" }], - "stateMutability": "nonpayable", - "type": "function", - "gas": 37738 - }, - { - "name": "setPerformanceFee", - "outputs": [], - "inputs": [{ "type": "uint256", "name": "fee" }], - "stateMutability": "nonpayable", - "type": "function", - "gas": 37872 - }, - { - "name": "setManagementFee", - "outputs": [], - "inputs": [{ "type": "uint256", "name": "fee" }], - "stateMutability": "nonpayable", - "type": "function", - "gas": 37902 - }, - { - "name": "setGuardian", - "outputs": [], - "inputs": [{ "type": "address", "name": "guardian" }], - "stateMutability": "nonpayable", - "type": "function", - "gas": 39146 - }, - { - "name": "setEmergencyShutdown", - "outputs": [], - "inputs": [{ "type": "bool", "name": "active" }], - "stateMutability": "nonpayable", - "type": "function", - "gas": 39217 - }, - { - "name": "setWithdrawalQueue", - "outputs": [], - "inputs": [{ "type": "address[20]", "name": "queue" }], - "stateMutability": "nonpayable", - "type": "function", - "gas": 763893 - }, - { - "name": "transfer", - "outputs": [{ "type": "bool", "name": "" }], - "inputs": [ - { "type": "address", "name": "receiver" }, - { "type": "uint256", "name": "amount" } - ], - "stateMutability": "nonpayable", - "type": "function", - "gas": 76733 - }, - { - "name": "transferFrom", - "outputs": [{ "type": "bool", "name": "" }], - "inputs": [ - { "type": "address", "name": "sender" }, - { "type": "address", "name": "receiver" }, - { "type": "uint256", "name": "amount" } - ], - "stateMutability": "nonpayable", - "type": "function", - "gas": 116496 - }, - { - "name": "approve", - "outputs": [{ "type": "bool", "name": "" }], - "inputs": [ - { "type": "address", "name": "spender" }, - { "type": "uint256", "name": "amount" } - ], - "stateMutability": "nonpayable", - "type": "function", - "gas": 38244 - }, - { - "name": "increaseAllowance", - "outputs": [{ "type": "bool", "name": "" }], - "inputs": [ - { "type": "address", "name": "spender" }, - { "type": "uint256", "name": "amount" } - ], - "stateMutability": "nonpayable", - "type": "function", - "gas": 40285 - }, - { - "name": "decreaseAllowance", - "outputs": [{ "type": "bool", "name": "" }], - "inputs": [ - { "type": "address", "name": "spender" }, - { "type": "uint256", "name": "amount" } - ], - "stateMutability": "nonpayable", - "type": "function", - "gas": 40309 - }, - { - "name": "permit", - "outputs": [{ "type": "bool", "name": "" }], - "inputs": [ - { "type": "address", "name": "owner" }, - { "type": "address", "name": "spender" }, - { "type": "uint256", "name": "amount" }, - { "type": "uint256", "name": "expiry" }, - { "type": "bytes", "name": "signature" } - ], - "stateMutability": "nonpayable", - "type": "function", - "gas": 81237 - }, - { - "name": "totalAssets", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 4123 - }, - { - "name": "deposit", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "name": "deposit", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [{ "type": "uint256", "name": "_amount" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "name": "deposit", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [ - { "type": "uint256", "name": "_amount" }, - { "type": "address", "name": "recipient" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "name": "maxAvailableShares", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 364171 - }, - { - "name": "withdraw", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "name": "withdraw", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [{ "type": "uint256", "name": "maxShares" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "name": "withdraw", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [ - { "type": "uint256", "name": "maxShares" }, - { "type": "address", "name": "recipient" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "name": "withdraw", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [ - { "type": "uint256", "name": "maxShares" }, - { "type": "address", "name": "recipient" }, - { "type": "uint256", "name": "maxLoss" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "name": "pricePerShare", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 12412 - }, - { - "name": "addStrategy", - "outputs": [], - "inputs": [ - { "type": "address", "name": "strategy" }, - { "type": "uint256", "name": "debtRatio" }, - { "type": "uint256", "name": "rateLimit" }, - { "type": "uint256", "name": "performanceFee" } - ], - "stateMutability": "nonpayable", - "type": "function", - "gas": 1450351 - }, - { - "name": "updateStrategyDebtRatio", - "outputs": [], - "inputs": [ - { "type": "address", "name": "strategy" }, - { "type": "uint256", "name": "debtRatio" } - ], - "stateMutability": "nonpayable", - "type": "function", - "gas": 115316 - }, - { - "name": "updateStrategyRateLimit", - "outputs": [], - "inputs": [ - { "type": "address", "name": "strategy" }, - { "type": "uint256", "name": "rateLimit" } - ], - "stateMutability": "nonpayable", - "type": "function", - "gas": 41467 - }, - { - "name": "updateStrategyPerformanceFee", - "outputs": [], - "inputs": [ - { "type": "address", "name": "strategy" }, - { "type": "uint256", "name": "performanceFee" } - ], - "stateMutability": "nonpayable", - "type": "function", - "gas": 41344 - }, - { - "name": "migrateStrategy", - "outputs": [], - "inputs": [ - { "type": "address", "name": "oldVersion" }, - { "type": "address", "name": "newVersion" } - ], - "stateMutability": "nonpayable", - "type": "function", - "gas": 1105801 - }, - { - "name": "revokeStrategy", - "outputs": [], - "inputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "name": "revokeStrategy", - "outputs": [], - "inputs": [{ "type": "address", "name": "strategy" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "name": "addStrategyToQueue", - "outputs": [], - "inputs": [{ "type": "address", "name": "strategy" }], - "stateMutability": "nonpayable", - "type": "function", - "gas": 1196920 - }, - { - "name": "removeStrategyFromQueue", - "outputs": [], - "inputs": [{ "type": "address", "name": "strategy" }], - "stateMutability": "nonpayable", - "type": "function", - "gas": 23091666 - }, - { - "name": "debtOutstanding", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function" - }, - { - "name": "debtOutstanding", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [{ "type": "address", "name": "strategy" }], - "stateMutability": "view", - "type": "function" - }, - { - "name": "creditAvailable", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function" - }, - { - "name": "creditAvailable", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [{ "type": "address", "name": "strategy" }], - "stateMutability": "view", - "type": "function" - }, - { - "name": "availableDepositLimit", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 9808 - }, - { - "name": "expectedReturn", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function" - }, - { - "name": "expectedReturn", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [{ "type": "address", "name": "strategy" }], - "stateMutability": "view", - "type": "function" - }, - { - "name": "report", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [ - { "type": "uint256", "name": "gain" }, - { "type": "uint256", "name": "loss" }, - { "type": "uint256", "name": "_debtPayment" } - ], - "stateMutability": "nonpayable", - "type": "function", - "gas": 937520 - }, - { - "name": "sweep", - "outputs": [], - "inputs": [{ "type": "address", "name": "token" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "name": "sweep", - "outputs": [], - "inputs": [ - { "type": "address", "name": "token" }, - { "type": "uint256", "name": "amount" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "name": "name", - "outputs": [{ "type": "string", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 9053 - }, - { - "name": "symbol", - "outputs": [{ "type": "string", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 8106 - }, - { - "name": "decimals", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 2711 - }, - { - "name": "balanceOf", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [{ "type": "address", "name": "arg0" }], - "stateMutability": "view", - "type": "function", - "gas": 2956 - }, - { - "name": "allowance", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [ - { "type": "address", "name": "arg0" }, - { "type": "address", "name": "arg1" } - ], - "stateMutability": "view", - "type": "function", - "gas": 3201 - }, - { - "name": "totalSupply", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 2801 - }, - { - "name": "token", - "outputs": [{ "type": "address", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 2831 - }, - { - "name": "governance", - "outputs": [{ "type": "address", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 2861 - }, - { - "name": "management", - "outputs": [{ "type": "address", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 2891 - }, - { - "name": "guardian", - "outputs": [{ "type": "address", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 2921 - }, - { - "name": "guestList", - "outputs": [{ "type": "address", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 2951 - }, - { - "name": "strategies", - "outputs": [ - { "type": "uint256", "name": "performanceFee" }, - { "type": "uint256", "name": "activation" }, - { "type": "uint256", "name": "debtRatio" }, - { "type": "uint256", "name": "rateLimit" }, - { "type": "uint256", "name": "lastReport" }, - { "type": "uint256", "name": "totalDebt" }, - { "type": "uint256", "name": "totalGain" }, - { "type": "uint256", "name": "totalLoss" } - ], - "inputs": [{ "type": "address", "name": "arg0" }], - "stateMutability": "view", - "type": "function", - "gas": 10322 - }, - { - "name": "withdrawalQueue", - "outputs": [{ "type": "address", "name": "" }], - "inputs": [{ "type": "uint256", "name": "arg0" }], - "stateMutability": "view", - "type": "function", - "gas": 3120 - }, - { - "name": "emergencyShutdown", - "outputs": [{ "type": "bool", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 3041 - }, - { - "name": "depositLimit", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 3071 - }, - { - "name": "debtRatio", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 3101 - }, - { - "name": "totalDebt", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 3131 - }, - { - "name": "lastReport", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 3161 - }, - { - "name": "activation", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 3191 - }, - { - "name": "rewards", - "outputs": [{ "type": "address", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 3221 - }, - { - "name": "managementFee", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 3251 - }, - { - "name": "performanceFee", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 3281 - }, - { - "name": "nonces", - "outputs": [{ "type": "uint256", "name": "" }], - "inputs": [{ "type": "address", "name": "arg0" }], - "stateMutability": "view", - "type": "function", - "gas": 3526 - }, - { - "name": "DOMAIN_SEPARATOR", - "outputs": [{ "type": "bytes32", "name": "" }], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 3341 - } -] +[ + { + "name": "Transfer", + "inputs": [ + { "type": "address", "name": "sender", "indexed": true }, + { "type": "address", "name": "receiver", "indexed": true }, + { "type": "uint256", "name": "value", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "Approval", + "inputs": [ + { "type": "address", "name": "owner", "indexed": true }, + { "type": "address", "name": "spender", "indexed": true }, + { "type": "uint256", "name": "value", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "StrategyAdded", + "inputs": [ + { "type": "address", "name": "strategy", "indexed": true }, + { "type": "uint256", "name": "debtRatio", "indexed": false }, + { "type": "uint256", "name": "rateLimit", "indexed": false }, + { "type": "uint256", "name": "performanceFee", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "StrategyReported", + "inputs": [ + { "type": "address", "name": "strategy", "indexed": true }, + { "type": "uint256", "name": "gain", "indexed": false }, + { "type": "uint256", "name": "loss", "indexed": false }, + { "type": "uint256", "name": "totalGain", "indexed": false }, + { "type": "uint256", "name": "totalLoss", "indexed": false }, + { "type": "uint256", "name": "totalDebt", "indexed": false }, + { "type": "uint256", "name": "debtAdded", "indexed": false }, + { "type": "uint256", "name": "debtRatio", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdateGovernance", + "inputs": [{ "type": "address", "name": "governance", "indexed": false }], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdateManagement", + "inputs": [{ "type": "address", "name": "management", "indexed": false }], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdateGuestList", + "inputs": [{ "type": "address", "name": "guestList", "indexed": false }], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdateRewards", + "inputs": [{ "type": "address", "name": "rewards", "indexed": false }], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdateDepositLimit", + "inputs": [{ "type": "uint256", "name": "depositLimit", "indexed": false }], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdatePerformanceFee", + "inputs": [ + { "type": "uint256", "name": "performanceFee", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdateManagementFee", + "inputs": [ + { "type": "uint256", "name": "managementFee", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdateGuardian", + "inputs": [{ "type": "address", "name": "guardian", "indexed": false }], + "anonymous": false, + "type": "event" + }, + { + "name": "EmergencyShutdown", + "inputs": [{ "type": "bool", "name": "active", "indexed": false }], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdateWithdrawalQueue", + "inputs": [{ "type": "address[20]", "name": "queue", "indexed": false }], + "anonymous": false, + "type": "event" + }, + { + "name": "StrategyUpdateDebtRatio", + "inputs": [ + { "type": "address", "name": "strategy", "indexed": true }, + { "type": "uint256", "name": "debtRatio", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "StrategyUpdateRateLimit", + "inputs": [ + { "type": "address", "name": "strategy", "indexed": true }, + { "type": "uint256", "name": "rateLimit", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "StrategyUpdatePerformanceFee", + "inputs": [ + { "type": "address", "name": "strategy", "indexed": true }, + { "type": "uint256", "name": "performanceFee", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "StrategyMigrated", + "inputs": [ + { "type": "address", "name": "oldVersion", "indexed": true }, + { "type": "address", "name": "newVersion", "indexed": true } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "StrategyRevoked", + "inputs": [{ "type": "address", "name": "strategy", "indexed": true }], + "anonymous": false, + "type": "event" + }, + { + "name": "StrategyRemovedFromQueue", + "inputs": [{ "type": "address", "name": "strategy", "indexed": true }], + "anonymous": false, + "type": "event" + }, + { + "name": "StrategyAddedToQueue", + "inputs": [{ "type": "address", "name": "strategy", "indexed": true }], + "anonymous": false, + "type": "event" + }, + { + "name": "initialize", + "outputs": [], + "inputs": [ + { "type": "address", "name": "token" }, + { "type": "address", "name": "governance" }, + { "type": "address", "name": "rewards" }, + { "type": "string", "name": "nameOverride" }, + { "type": "string", "name": "symbolOverride" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "name": "initialize", + "outputs": [], + "inputs": [ + { "type": "address", "name": "token" }, + { "type": "address", "name": "governance" }, + { "type": "address", "name": "rewards" }, + { "type": "string", "name": "nameOverride" }, + { "type": "string", "name": "symbolOverride" }, + { "type": "address", "name": "guardian" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "name": "apiVersion", + "outputs": [{ "type": "string", "name": "" }], + "inputs": [], + "stateMutability": "pure", + "type": "function", + "gas": 4519 + }, + { + "name": "setName", + "outputs": [], + "inputs": [{ "type": "string", "name": "name" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 107017 + }, + { + "name": "setSymbol", + "outputs": [], + "inputs": [{ "type": "string", "name": "symbol" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 71867 + }, + { + "name": "setGovernance", + "outputs": [], + "inputs": [{ "type": "address", "name": "governance" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 36338 + }, + { + "name": "acceptGovernance", + "outputs": [], + "inputs": [], + "stateMutability": "nonpayable", + "type": "function", + "gas": 37610 + }, + { + "name": "setManagement", + "outputs": [], + "inputs": [{ "type": "address", "name": "management" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 37748 + }, + { + "name": "setGuestList", + "outputs": [], + "inputs": [{ "type": "address", "name": "guestList" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 37778 + }, + { + "name": "setRewards", + "outputs": [], + "inputs": [{ "type": "address", "name": "rewards" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 37808 + }, + { + "name": "setDepositLimit", + "outputs": [], + "inputs": [{ "type": "uint256", "name": "limit" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 37738 + }, + { + "name": "setPerformanceFee", + "outputs": [], + "inputs": [{ "type": "uint256", "name": "fee" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 37872 + }, + { + "name": "setManagementFee", + "outputs": [], + "inputs": [{ "type": "uint256", "name": "fee" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 37902 + }, + { + "name": "setGuardian", + "outputs": [], + "inputs": [{ "type": "address", "name": "guardian" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 39146 + }, + { + "name": "setEmergencyShutdown", + "outputs": [], + "inputs": [{ "type": "bool", "name": "active" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 39217 + }, + { + "name": "setWithdrawalQueue", + "outputs": [], + "inputs": [{ "type": "address[20]", "name": "queue" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 763893 + }, + { + "name": "transfer", + "outputs": [{ "type": "bool", "name": "" }], + "inputs": [ + { "type": "address", "name": "receiver" }, + { "type": "uint256", "name": "amount" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 76733 + }, + { + "name": "transferFrom", + "outputs": [{ "type": "bool", "name": "" }], + "inputs": [ + { "type": "address", "name": "sender" }, + { "type": "address", "name": "receiver" }, + { "type": "uint256", "name": "amount" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 116496 + }, + { + "name": "approve", + "outputs": [{ "type": "bool", "name": "" }], + "inputs": [ + { "type": "address", "name": "spender" }, + { "type": "uint256", "name": "amount" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 38244 + }, + { + "name": "increaseAllowance", + "outputs": [{ "type": "bool", "name": "" }], + "inputs": [ + { "type": "address", "name": "spender" }, + { "type": "uint256", "name": "amount" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 40285 + }, + { + "name": "decreaseAllowance", + "outputs": [{ "type": "bool", "name": "" }], + "inputs": [ + { "type": "address", "name": "spender" }, + { "type": "uint256", "name": "amount" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 40309 + }, + { + "name": "permit", + "outputs": [{ "type": "bool", "name": "" }], + "inputs": [ + { "type": "address", "name": "owner" }, + { "type": "address", "name": "spender" }, + { "type": "uint256", "name": "amount" }, + { "type": "uint256", "name": "expiry" }, + { "type": "bytes", "name": "signature" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 81237 + }, + { + "name": "totalAssets", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 4123 + }, + { + "name": "deposit", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "name": "deposit", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [{ "type": "uint256", "name": "_amount" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "name": "deposit", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [ + { "type": "uint256", "name": "_amount" }, + { "type": "address", "name": "recipient" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "name": "maxAvailableShares", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 364171 + }, + { + "name": "withdraw", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "name": "withdraw", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [{ "type": "uint256", "name": "maxShares" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "name": "withdraw", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [ + { "type": "uint256", "name": "maxShares" }, + { "type": "address", "name": "recipient" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "name": "withdraw", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [ + { "type": "uint256", "name": "maxShares" }, + { "type": "address", "name": "recipient" }, + { "type": "uint256", "name": "maxLoss" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "name": "pricePerShare", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 12412 + }, + { + "name": "addStrategy", + "outputs": [], + "inputs": [ + { "type": "address", "name": "strategy" }, + { "type": "uint256", "name": "debtRatio" }, + { "type": "uint256", "name": "rateLimit" }, + { "type": "uint256", "name": "performanceFee" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 1450351 + }, + { + "name": "updateStrategyDebtRatio", + "outputs": [], + "inputs": [ + { "type": "address", "name": "strategy" }, + { "type": "uint256", "name": "debtRatio" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 115316 + }, + { + "name": "updateStrategyRateLimit", + "outputs": [], + "inputs": [ + { "type": "address", "name": "strategy" }, + { "type": "uint256", "name": "rateLimit" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 41467 + }, + { + "name": "updateStrategyPerformanceFee", + "outputs": [], + "inputs": [ + { "type": "address", "name": "strategy" }, + { "type": "uint256", "name": "performanceFee" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 41344 + }, + { + "name": "migrateStrategy", + "outputs": [], + "inputs": [ + { "type": "address", "name": "oldVersion" }, + { "type": "address", "name": "newVersion" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 1105801 + }, + { + "name": "revokeStrategy", + "outputs": [], + "inputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "name": "revokeStrategy", + "outputs": [], + "inputs": [{ "type": "address", "name": "strategy" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "name": "addStrategyToQueue", + "outputs": [], + "inputs": [{ "type": "address", "name": "strategy" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 1196920 + }, + { + "name": "removeStrategyFromQueue", + "outputs": [], + "inputs": [{ "type": "address", "name": "strategy" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 23091666 + }, + { + "name": "debtOutstanding", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function" + }, + { + "name": "debtOutstanding", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [{ "type": "address", "name": "strategy" }], + "stateMutability": "view", + "type": "function" + }, + { + "name": "creditAvailable", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function" + }, + { + "name": "creditAvailable", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [{ "type": "address", "name": "strategy" }], + "stateMutability": "view", + "type": "function" + }, + { + "name": "availableDepositLimit", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 9808 + }, + { + "name": "expectedReturn", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function" + }, + { + "name": "expectedReturn", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [{ "type": "address", "name": "strategy" }], + "stateMutability": "view", + "type": "function" + }, + { + "name": "report", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [ + { "type": "uint256", "name": "gain" }, + { "type": "uint256", "name": "loss" }, + { "type": "uint256", "name": "_debtPayment" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 937520 + }, + { + "name": "sweep", + "outputs": [], + "inputs": [{ "type": "address", "name": "token" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "name": "sweep", + "outputs": [], + "inputs": [ + { "type": "address", "name": "token" }, + { "type": "uint256", "name": "amount" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "name": "name", + "outputs": [{ "type": "string", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 9053 + }, + { + "name": "symbol", + "outputs": [{ "type": "string", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 8106 + }, + { + "name": "decimals", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 2711 + }, + { + "name": "balanceOf", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [{ "type": "address", "name": "arg0" }], + "stateMutability": "view", + "type": "function", + "gas": 2956 + }, + { + "name": "allowance", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [ + { "type": "address", "name": "arg0" }, + { "type": "address", "name": "arg1" } + ], + "stateMutability": "view", + "type": "function", + "gas": 3201 + }, + { + "name": "totalSupply", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 2801 + }, + { + "name": "token", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 2831 + }, + { + "name": "governance", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 2861 + }, + { + "name": "management", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 2891 + }, + { + "name": "guardian", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 2921 + }, + { + "name": "guestList", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 2951 + }, + { + "name": "strategies", + "outputs": [ + { "type": "uint256", "name": "performanceFee" }, + { "type": "uint256", "name": "activation" }, + { "type": "uint256", "name": "debtRatio" }, + { "type": "uint256", "name": "rateLimit" }, + { "type": "uint256", "name": "lastReport" }, + { "type": "uint256", "name": "totalDebt" }, + { "type": "uint256", "name": "totalGain" }, + { "type": "uint256", "name": "totalLoss" } + ], + "inputs": [{ "type": "address", "name": "arg0" }], + "stateMutability": "view", + "type": "function", + "gas": 10322 + }, + { + "name": "withdrawalQueue", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [{ "type": "uint256", "name": "arg0" }], + "stateMutability": "view", + "type": "function", + "gas": 3120 + }, + { + "name": "emergencyShutdown", + "outputs": [{ "type": "bool", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 3041 + }, + { + "name": "depositLimit", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 3071 + }, + { + "name": "debtRatio", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 3101 + }, + { + "name": "totalDebt", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 3131 + }, + { + "name": "lastReport", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 3161 + }, + { + "name": "activation", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 3191 + }, + { + "name": "rewards", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 3221 + }, + { + "name": "managementFee", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 3251 + }, + { + "name": "performanceFee", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 3281 + }, + { + "name": "nonces", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [{ "type": "address", "name": "arg0" }], + "stateMutability": "view", + "type": "function", + "gas": 3526 + }, + { + "name": "DOMAIN_SEPARATOR", + "outputs": [{ "type": "bytes32", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 3341 + } +] diff --git a/subgraphs/balancer-forks/abis/Prices/1Inch/Oracle.json b/subgraphs/balancer-forks/abis/Prices/InchOracle.json similarity index 100% rename from subgraphs/balancer-forks/abis/Prices/1Inch/Oracle.json rename to subgraphs/balancer-forks/abis/Prices/InchOracle.json diff --git a/subgraphs/balancer-forks/abis/Prices/SushiSwap/Factory.json b/subgraphs/balancer-forks/abis/Prices/SushiSwap/Factory.json deleted file mode 100644 index 3cbf06cb6c..0000000000 --- a/subgraphs/balancer-forks/abis/Prices/SushiSwap/Factory.json +++ /dev/null @@ -1,131 +0,0 @@ -[ - { - "inputs": [ - { "internalType": "address", "name": "_feeToSetter", "type": "address" } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "token0", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "token1", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "pair", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "PairCreated", - "type": "event" - }, - { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "allPairs", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "allPairsLength", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "tokenA", "type": "address" }, - { "internalType": "address", "name": "tokenB", "type": "address" } - ], - "name": "createPair", - "outputs": [ - { "internalType": "address", "name": "pair", "type": "address" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "feeTo", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "feeToSetter", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "address", "name": "", "type": "address" } - ], - "name": "getPair", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "migrator", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pairCodeHash", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_feeTo", "type": "address" } - ], - "name": "setFeeTo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_feeToSetter", "type": "address" } - ], - "name": "setFeeToSetter", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_migrator", "type": "address" } - ], - "name": "setMigrator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -] diff --git a/subgraphs/balancer-forks/abis/Prices/SushiSwap/Pair.json b/subgraphs/balancer-forks/abis/Prices/SushiSwap/Pair.json deleted file mode 100644 index d41d9326d8..0000000000 --- a/subgraphs/balancer-forks/abis/Prices/SushiSwap/Pair.json +++ /dev/null @@ -1,402 +0,0 @@ -[ - { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "Burn", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "name": "Mint", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount0In", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount1In", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount0Out", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount1Out", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "Swap", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint112", - "name": "reserve0", - "type": "uint112" - }, - { - "indexed": false, - "internalType": "uint112", - "name": "reserve1", - "type": "uint112" - } - ], - "name": "Sync", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [], - "name": "DOMAIN_SEPARATOR", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MINIMUM_LIQUIDITY", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PERMIT_TYPEHASH", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "address", "name": "", "type": "address" } - ], - "name": "allowance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "approve", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "burn", - "outputs": [ - { "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "internalType": "uint256", "name": "amount1", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "factory", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getReserves", - "outputs": [ - { "internalType": "uint112", "name": "_reserve0", "type": "uint112" }, - { "internalType": "uint112", "name": "_reserve1", "type": "uint112" }, - { - "internalType": "uint32", - "name": "_blockTimestampLast", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_token0", "type": "address" }, - { "internalType": "address", "name": "_token1", "type": "address" } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "kLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "mint", - "outputs": [ - { "internalType": "uint256", "name": "liquidity", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "nonces", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" }, - { "internalType": "uint8", "name": "v", "type": "uint8" }, - { "internalType": "bytes32", "name": "r", "type": "bytes32" }, - { "internalType": "bytes32", "name": "s", "type": "bytes32" } - ], - "name": "permit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "price0CumulativeLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "price1CumulativeLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "skim", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amount0Out", "type": "uint256" }, - { "internalType": "uint256", "name": "amount1Out", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } - ], - "name": "swap", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "sync", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "token0", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "token1", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "from", "type": "address" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - } -] diff --git a/subgraphs/balancer-forks/abis/Prices/SushiSwap/Router.json b/subgraphs/balancer-forks/abis/Prices/SushiSwap/Router.json deleted file mode 100644 index 37a7642d05..0000000000 --- a/subgraphs/balancer-forks/abis/Prices/SushiSwap/Router.json +++ /dev/null @@ -1,398 +0,0 @@ -[ - { - "inputs": [ - { "internalType": "address", "name": "_factory", "type": "address" }, - { "internalType": "address", "name": "_WETH", "type": "address" } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "WETH", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "tokenA", "type": "address" }, - { "internalType": "address", "name": "tokenB", "type": "address" }, - { - "internalType": "uint256", - "name": "amountADesired", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amountBDesired", - "type": "uint256" - }, - { "internalType": "uint256", "name": "amountAMin", "type": "uint256" }, - { "internalType": "uint256", "name": "amountBMin", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } - ], - "name": "addLiquidity", - "outputs": [ - { "internalType": "uint256", "name": "amountA", "type": "uint256" }, - { "internalType": "uint256", "name": "amountB", "type": "uint256" }, - { "internalType": "uint256", "name": "liquidity", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "token", "type": "address" }, - { - "internalType": "uint256", - "name": "amountTokenDesired", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amountTokenMin", - "type": "uint256" - }, - { "internalType": "uint256", "name": "amountETHMin", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } - ], - "name": "addLiquidityETH", - "outputs": [ - { "internalType": "uint256", "name": "amountToken", "type": "uint256" }, - { "internalType": "uint256", "name": "amountETH", "type": "uint256" }, - { "internalType": "uint256", "name": "liquidity", "type": "uint256" } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "factory", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amountOut", "type": "uint256" }, - { "internalType": "uint256", "name": "reserveIn", "type": "uint256" }, - { "internalType": "uint256", "name": "reserveOut", "type": "uint256" } - ], - "name": "getAmountIn", - "outputs": [ - { "internalType": "uint256", "name": "amountIn", "type": "uint256" } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, - { "internalType": "uint256", "name": "reserveIn", "type": "uint256" }, - { "internalType": "uint256", "name": "reserveOut", "type": "uint256" } - ], - "name": "getAmountOut", - "outputs": [ - { "internalType": "uint256", "name": "amountOut", "type": "uint256" } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amountOut", "type": "uint256" }, - { "internalType": "address[]", "name": "path", "type": "address[]" } - ], - "name": "getAmountsIn", - "outputs": [ - { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, - { "internalType": "address[]", "name": "path", "type": "address[]" } - ], - "name": "getAmountsOut", - "outputs": [ - { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amountA", "type": "uint256" }, - { "internalType": "uint256", "name": "reserveA", "type": "uint256" }, - { "internalType": "uint256", "name": "reserveB", "type": "uint256" } - ], - "name": "quote", - "outputs": [ - { "internalType": "uint256", "name": "amountB", "type": "uint256" } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "tokenA", "type": "address" }, - { "internalType": "address", "name": "tokenB", "type": "address" }, - { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, - { "internalType": "uint256", "name": "amountAMin", "type": "uint256" }, - { "internalType": "uint256", "name": "amountBMin", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } - ], - "name": "removeLiquidity", - "outputs": [ - { "internalType": "uint256", "name": "amountA", "type": "uint256" }, - { "internalType": "uint256", "name": "amountB", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "token", "type": "address" }, - { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, - { - "internalType": "uint256", - "name": "amountTokenMin", - "type": "uint256" - }, - { "internalType": "uint256", "name": "amountETHMin", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } - ], - "name": "removeLiquidityETH", - "outputs": [ - { "internalType": "uint256", "name": "amountToken", "type": "uint256" }, - { "internalType": "uint256", "name": "amountETH", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "token", "type": "address" }, - { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, - { - "internalType": "uint256", - "name": "amountTokenMin", - "type": "uint256" - }, - { "internalType": "uint256", "name": "amountETHMin", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } - ], - "name": "removeLiquidityETHSupportingFeeOnTransferTokens", - "outputs": [ - { "internalType": "uint256", "name": "amountETH", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "token", "type": "address" }, - { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, - { - "internalType": "uint256", - "name": "amountTokenMin", - "type": "uint256" - }, - { "internalType": "uint256", "name": "amountETHMin", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" }, - { "internalType": "bool", "name": "approveMax", "type": "bool" }, - { "internalType": "uint8", "name": "v", "type": "uint8" }, - { "internalType": "bytes32", "name": "r", "type": "bytes32" }, - { "internalType": "bytes32", "name": "s", "type": "bytes32" } - ], - "name": "removeLiquidityETHWithPermit", - "outputs": [ - { "internalType": "uint256", "name": "amountToken", "type": "uint256" }, - { "internalType": "uint256", "name": "amountETH", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "token", "type": "address" }, - { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, - { - "internalType": "uint256", - "name": "amountTokenMin", - "type": "uint256" - }, - { "internalType": "uint256", "name": "amountETHMin", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" }, - { "internalType": "bool", "name": "approveMax", "type": "bool" }, - { "internalType": "uint8", "name": "v", "type": "uint8" }, - { "internalType": "bytes32", "name": "r", "type": "bytes32" }, - { "internalType": "bytes32", "name": "s", "type": "bytes32" } - ], - "name": "removeLiquidityETHWithPermitSupportingFeeOnTransferTokens", - "outputs": [ - { "internalType": "uint256", "name": "amountETH", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "tokenA", "type": "address" }, - { "internalType": "address", "name": "tokenB", "type": "address" }, - { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, - { "internalType": "uint256", "name": "amountAMin", "type": "uint256" }, - { "internalType": "uint256", "name": "amountBMin", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" }, - { "internalType": "bool", "name": "approveMax", "type": "bool" }, - { "internalType": "uint8", "name": "v", "type": "uint8" }, - { "internalType": "bytes32", "name": "r", "type": "bytes32" }, - { "internalType": "bytes32", "name": "s", "type": "bytes32" } - ], - "name": "removeLiquidityWithPermit", - "outputs": [ - { "internalType": "uint256", "name": "amountA", "type": "uint256" }, - { "internalType": "uint256", "name": "amountB", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amountOut", "type": "uint256" }, - { "internalType": "address[]", "name": "path", "type": "address[]" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } - ], - "name": "swapETHForExactTokens", - "outputs": [ - { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, - { "internalType": "address[]", "name": "path", "type": "address[]" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } - ], - "name": "swapExactETHForTokens", - "outputs": [ - { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, - { "internalType": "address[]", "name": "path", "type": "address[]" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } - ], - "name": "swapExactETHForTokensSupportingFeeOnTransferTokens", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, - { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, - { "internalType": "address[]", "name": "path", "type": "address[]" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } - ], - "name": "swapExactTokensForETH", - "outputs": [ - { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, - { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, - { "internalType": "address[]", "name": "path", "type": "address[]" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } - ], - "name": "swapExactTokensForETHSupportingFeeOnTransferTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, - { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, - { "internalType": "address[]", "name": "path", "type": "address[]" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } - ], - "name": "swapExactTokensForTokens", - "outputs": [ - { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, - { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, - { "internalType": "address[]", "name": "path", "type": "address[]" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } - ], - "name": "swapExactTokensForTokensSupportingFeeOnTransferTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amountOut", "type": "uint256" }, - { "internalType": "uint256", "name": "amountInMax", "type": "uint256" }, - { "internalType": "address[]", "name": "path", "type": "address[]" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } - ], - "name": "swapTokensForExactETH", - "outputs": [ - { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amountOut", "type": "uint256" }, - { "internalType": "uint256", "name": "amountInMax", "type": "uint256" }, - { "internalType": "address[]", "name": "path", "type": "address[]" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } - ], - "name": "swapTokensForExactTokens", - "outputs": [ - { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { "stateMutability": "payable", "type": "receive" } -] diff --git a/subgraphs/balancer-forks/abis/Prices/Uniswap/Factory.json b/subgraphs/balancer-forks/abis/Prices/Uniswap/Factory.json index d6012f778a..1b14599d5d 100644 --- a/subgraphs/balancer-forks/abis/Prices/Uniswap/Factory.json +++ b/subgraphs/balancer-forks/abis/Prices/Uniswap/Factory.json @@ -1,125 +1,125 @@ -[ - { - "inputs": [ - { "internalType": "address", "name": "_feeToSetter", "type": "address" } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "token0", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "token1", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "pair", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "PairCreated", - "type": "event" - }, - { - "constant": true, - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "allPairs", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "allPairsLength", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "tokenA", "type": "address" }, - { "internalType": "address", "name": "tokenB", "type": "address" } - ], - "name": "createPair", - "outputs": [ - { "internalType": "address", "name": "pair", "type": "address" } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "feeTo", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "feeToSetter", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "address", "name": "", "type": "address" } - ], - "name": "getPair", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "_feeTo", "type": "address" } - ], - "name": "setFeeTo", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "_feeToSetter", "type": "address" } - ], - "name": "setFeeToSetter", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } -] +[ + { + "inputs": [ + { "internalType": "address", "name": "_feeToSetter", "type": "address" } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token0", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "token1", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "pair", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "PairCreated", + "type": "event" + }, + { + "constant": true, + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "allPairs", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "allPairsLength", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "tokenA", "type": "address" }, + { "internalType": "address", "name": "tokenB", "type": "address" } + ], + "name": "createPair", + "outputs": [ + { "internalType": "address", "name": "pair", "type": "address" } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "feeTo", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "feeToSetter", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "getPair", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "_feeTo", "type": "address" } + ], + "name": "setFeeTo", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "_feeToSetter", "type": "address" } + ], + "name": "setFeeToSetter", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/subgraphs/balancer-forks/abis/Prices/Uniswap/Pair.json b/subgraphs/balancer-forks/abis/Prices/Uniswap/Pair.json index fc96f6fb2f..e5efebf418 100644 --- a/subgraphs/balancer-forks/abis/Prices/Uniswap/Pair.json +++ b/subgraphs/balancer-forks/abis/Prices/Uniswap/Pair.json @@ -1,461 +1,461 @@ -[ - { - "inputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "Burn", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "name": "Mint", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount0In", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount1In", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount0Out", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount1Out", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "Swap", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint112", - "name": "reserve0", - "type": "uint112" - }, - { - "indexed": false, - "internalType": "uint112", - "name": "reserve1", - "type": "uint112" - } - ], - "name": "Sync", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "constant": true, - "inputs": [], - "name": "DOMAIN_SEPARATOR", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "MINIMUM_LIQUIDITY", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "PERMIT_TYPEHASH", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "address", "name": "", "type": "address" } - ], - "name": "allowance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "approve", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "burn", - "outputs": [ - { "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "internalType": "uint256", "name": "amount1", "type": "uint256" } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "factory", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getReserves", - "outputs": [ - { "internalType": "uint112", "name": "_reserve0", "type": "uint112" }, - { "internalType": "uint112", "name": "_reserve1", "type": "uint112" }, - { - "internalType": "uint32", - "name": "_blockTimestampLast", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "_token0", "type": "address" }, - { "internalType": "address", "name": "_token1", "type": "address" } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "kLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "mint", - "outputs": [ - { "internalType": "uint256", "name": "liquidity", "type": "uint256" } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "nonces", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" }, - { "internalType": "uint8", "name": "v", "type": "uint8" }, - { "internalType": "bytes32", "name": "r", "type": "bytes32" }, - { "internalType": "bytes32", "name": "s", "type": "bytes32" } - ], - "name": "permit", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "price0CumulativeLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "price1CumulativeLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "skim", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "uint256", "name": "amount0Out", "type": "uint256" }, - { "internalType": "uint256", "name": "amount1Out", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } - ], - "name": "swap", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "sync", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "token0", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "token1", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "from", "type": "address" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } -] +[ + { + "inputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "Burn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0In", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1In", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0Out", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1Out", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "Swap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint112", + "name": "reserve0", + "type": "uint112" + }, + { + "indexed": false, + "internalType": "uint112", + "name": "reserve1", + "type": "uint112" + } + ], + "name": "Sync", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "MINIMUM_LIQUIDITY", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "PERMIT_TYPEHASH", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], + "name": "burn", + "outputs": [ + { "internalType": "uint256", "name": "amount0", "type": "uint256" }, + { "internalType": "uint256", "name": "amount1", "type": "uint256" } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "factory", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getReserves", + "outputs": [ + { "internalType": "uint112", "name": "_reserve0", "type": "uint112" }, + { "internalType": "uint112", "name": "_reserve1", "type": "uint112" }, + { + "internalType": "uint32", + "name": "_blockTimestampLast", + "type": "uint32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "_token0", "type": "address" }, + { "internalType": "address", "name": "_token1", "type": "address" } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "kLast", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], + "name": "mint", + "outputs": [ + { "internalType": "uint256", "name": "liquidity", "type": "uint256" } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "nonces", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "value", "type": "uint256" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "name": "permit", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "price0CumulativeLast", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "price1CumulativeLast", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], + "name": "skim", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "uint256", "name": "amount0Out", "type": "uint256" }, + { "internalType": "uint256", "name": "amount1Out", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "name": "swap", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "sync", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "token0", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "token1", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "from", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/subgraphs/balancer-forks/abis/Prices/Uniswap/Router.json b/subgraphs/balancer-forks/abis/Prices/Uniswap/Router.json index 37a7642d05..efc7f31728 100644 --- a/subgraphs/balancer-forks/abis/Prices/Uniswap/Router.json +++ b/subgraphs/balancer-forks/abis/Prices/Uniswap/Router.json @@ -1,398 +1,398 @@ -[ - { - "inputs": [ - { "internalType": "address", "name": "_factory", "type": "address" }, - { "internalType": "address", "name": "_WETH", "type": "address" } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "WETH", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "tokenA", "type": "address" }, - { "internalType": "address", "name": "tokenB", "type": "address" }, - { - "internalType": "uint256", - "name": "amountADesired", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amountBDesired", - "type": "uint256" - }, - { "internalType": "uint256", "name": "amountAMin", "type": "uint256" }, - { "internalType": "uint256", "name": "amountBMin", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } - ], - "name": "addLiquidity", - "outputs": [ - { "internalType": "uint256", "name": "amountA", "type": "uint256" }, - { "internalType": "uint256", "name": "amountB", "type": "uint256" }, - { "internalType": "uint256", "name": "liquidity", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "token", "type": "address" }, - { - "internalType": "uint256", - "name": "amountTokenDesired", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amountTokenMin", - "type": "uint256" - }, - { "internalType": "uint256", "name": "amountETHMin", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } - ], - "name": "addLiquidityETH", - "outputs": [ - { "internalType": "uint256", "name": "amountToken", "type": "uint256" }, - { "internalType": "uint256", "name": "amountETH", "type": "uint256" }, - { "internalType": "uint256", "name": "liquidity", "type": "uint256" } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "factory", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amountOut", "type": "uint256" }, - { "internalType": "uint256", "name": "reserveIn", "type": "uint256" }, - { "internalType": "uint256", "name": "reserveOut", "type": "uint256" } - ], - "name": "getAmountIn", - "outputs": [ - { "internalType": "uint256", "name": "amountIn", "type": "uint256" } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, - { "internalType": "uint256", "name": "reserveIn", "type": "uint256" }, - { "internalType": "uint256", "name": "reserveOut", "type": "uint256" } - ], - "name": "getAmountOut", - "outputs": [ - { "internalType": "uint256", "name": "amountOut", "type": "uint256" } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amountOut", "type": "uint256" }, - { "internalType": "address[]", "name": "path", "type": "address[]" } - ], - "name": "getAmountsIn", - "outputs": [ - { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, - { "internalType": "address[]", "name": "path", "type": "address[]" } - ], - "name": "getAmountsOut", - "outputs": [ - { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amountA", "type": "uint256" }, - { "internalType": "uint256", "name": "reserveA", "type": "uint256" }, - { "internalType": "uint256", "name": "reserveB", "type": "uint256" } - ], - "name": "quote", - "outputs": [ - { "internalType": "uint256", "name": "amountB", "type": "uint256" } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "tokenA", "type": "address" }, - { "internalType": "address", "name": "tokenB", "type": "address" }, - { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, - { "internalType": "uint256", "name": "amountAMin", "type": "uint256" }, - { "internalType": "uint256", "name": "amountBMin", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } - ], - "name": "removeLiquidity", - "outputs": [ - { "internalType": "uint256", "name": "amountA", "type": "uint256" }, - { "internalType": "uint256", "name": "amountB", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "token", "type": "address" }, - { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, - { - "internalType": "uint256", - "name": "amountTokenMin", - "type": "uint256" - }, - { "internalType": "uint256", "name": "amountETHMin", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } - ], - "name": "removeLiquidityETH", - "outputs": [ - { "internalType": "uint256", "name": "amountToken", "type": "uint256" }, - { "internalType": "uint256", "name": "amountETH", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "token", "type": "address" }, - { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, - { - "internalType": "uint256", - "name": "amountTokenMin", - "type": "uint256" - }, - { "internalType": "uint256", "name": "amountETHMin", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } - ], - "name": "removeLiquidityETHSupportingFeeOnTransferTokens", - "outputs": [ - { "internalType": "uint256", "name": "amountETH", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "token", "type": "address" }, - { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, - { - "internalType": "uint256", - "name": "amountTokenMin", - "type": "uint256" - }, - { "internalType": "uint256", "name": "amountETHMin", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" }, - { "internalType": "bool", "name": "approveMax", "type": "bool" }, - { "internalType": "uint8", "name": "v", "type": "uint8" }, - { "internalType": "bytes32", "name": "r", "type": "bytes32" }, - { "internalType": "bytes32", "name": "s", "type": "bytes32" } - ], - "name": "removeLiquidityETHWithPermit", - "outputs": [ - { "internalType": "uint256", "name": "amountToken", "type": "uint256" }, - { "internalType": "uint256", "name": "amountETH", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "token", "type": "address" }, - { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, - { - "internalType": "uint256", - "name": "amountTokenMin", - "type": "uint256" - }, - { "internalType": "uint256", "name": "amountETHMin", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" }, - { "internalType": "bool", "name": "approveMax", "type": "bool" }, - { "internalType": "uint8", "name": "v", "type": "uint8" }, - { "internalType": "bytes32", "name": "r", "type": "bytes32" }, - { "internalType": "bytes32", "name": "s", "type": "bytes32" } - ], - "name": "removeLiquidityETHWithPermitSupportingFeeOnTransferTokens", - "outputs": [ - { "internalType": "uint256", "name": "amountETH", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "tokenA", "type": "address" }, - { "internalType": "address", "name": "tokenB", "type": "address" }, - { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, - { "internalType": "uint256", "name": "amountAMin", "type": "uint256" }, - { "internalType": "uint256", "name": "amountBMin", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" }, - { "internalType": "bool", "name": "approveMax", "type": "bool" }, - { "internalType": "uint8", "name": "v", "type": "uint8" }, - { "internalType": "bytes32", "name": "r", "type": "bytes32" }, - { "internalType": "bytes32", "name": "s", "type": "bytes32" } - ], - "name": "removeLiquidityWithPermit", - "outputs": [ - { "internalType": "uint256", "name": "amountA", "type": "uint256" }, - { "internalType": "uint256", "name": "amountB", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amountOut", "type": "uint256" }, - { "internalType": "address[]", "name": "path", "type": "address[]" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } - ], - "name": "swapETHForExactTokens", - "outputs": [ - { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, - { "internalType": "address[]", "name": "path", "type": "address[]" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } - ], - "name": "swapExactETHForTokens", - "outputs": [ - { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, - { "internalType": "address[]", "name": "path", "type": "address[]" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } - ], - "name": "swapExactETHForTokensSupportingFeeOnTransferTokens", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, - { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, - { "internalType": "address[]", "name": "path", "type": "address[]" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } - ], - "name": "swapExactTokensForETH", - "outputs": [ - { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, - { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, - { "internalType": "address[]", "name": "path", "type": "address[]" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } - ], - "name": "swapExactTokensForETHSupportingFeeOnTransferTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, - { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, - { "internalType": "address[]", "name": "path", "type": "address[]" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } - ], - "name": "swapExactTokensForTokens", - "outputs": [ - { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, - { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, - { "internalType": "address[]", "name": "path", "type": "address[]" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } - ], - "name": "swapExactTokensForTokensSupportingFeeOnTransferTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amountOut", "type": "uint256" }, - { "internalType": "uint256", "name": "amountInMax", "type": "uint256" }, - { "internalType": "address[]", "name": "path", "type": "address[]" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } - ], - "name": "swapTokensForExactETH", - "outputs": [ - { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amountOut", "type": "uint256" }, - { "internalType": "uint256", "name": "amountInMax", "type": "uint256" }, - { "internalType": "address[]", "name": "path", "type": "address[]" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } - ], - "name": "swapTokensForExactTokens", - "outputs": [ - { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { "stateMutability": "payable", "type": "receive" } -] +[ + { + "inputs": [ + { "internalType": "address", "name": "_factory", "type": "address" }, + { "internalType": "address", "name": "_WETH", "type": "address" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "WETH", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenA", "type": "address" }, + { "internalType": "address", "name": "tokenB", "type": "address" }, + { + "internalType": "uint256", + "name": "amountADesired", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountBDesired", + "type": "uint256" + }, + { "internalType": "uint256", "name": "amountAMin", "type": "uint256" }, + { "internalType": "uint256", "name": "amountBMin", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "addLiquidity", + "outputs": [ + { "internalType": "uint256", "name": "amountA", "type": "uint256" }, + { "internalType": "uint256", "name": "amountB", "type": "uint256" }, + { "internalType": "uint256", "name": "liquidity", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "token", "type": "address" }, + { + "internalType": "uint256", + "name": "amountTokenDesired", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountTokenMin", + "type": "uint256" + }, + { "internalType": "uint256", "name": "amountETHMin", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "addLiquidityETH", + "outputs": [ + { "internalType": "uint256", "name": "amountToken", "type": "uint256" }, + { "internalType": "uint256", "name": "amountETH", "type": "uint256" }, + { "internalType": "uint256", "name": "liquidity", "type": "uint256" } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "factory", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountOut", "type": "uint256" }, + { "internalType": "uint256", "name": "reserveIn", "type": "uint256" }, + { "internalType": "uint256", "name": "reserveOut", "type": "uint256" } + ], + "name": "getAmountIn", + "outputs": [ + { "internalType": "uint256", "name": "amountIn", "type": "uint256" } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, + { "internalType": "uint256", "name": "reserveIn", "type": "uint256" }, + { "internalType": "uint256", "name": "reserveOut", "type": "uint256" } + ], + "name": "getAmountOut", + "outputs": [ + { "internalType": "uint256", "name": "amountOut", "type": "uint256" } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountOut", "type": "uint256" }, + { "internalType": "address[]", "name": "path", "type": "address[]" } + ], + "name": "getAmountsIn", + "outputs": [ + { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, + { "internalType": "address[]", "name": "path", "type": "address[]" } + ], + "name": "getAmountsOut", + "outputs": [ + { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountA", "type": "uint256" }, + { "internalType": "uint256", "name": "reserveA", "type": "uint256" }, + { "internalType": "uint256", "name": "reserveB", "type": "uint256" } + ], + "name": "quote", + "outputs": [ + { "internalType": "uint256", "name": "amountB", "type": "uint256" } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenA", "type": "address" }, + { "internalType": "address", "name": "tokenB", "type": "address" }, + { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, + { "internalType": "uint256", "name": "amountAMin", "type": "uint256" }, + { "internalType": "uint256", "name": "amountBMin", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "removeLiquidity", + "outputs": [ + { "internalType": "uint256", "name": "amountA", "type": "uint256" }, + { "internalType": "uint256", "name": "amountB", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "token", "type": "address" }, + { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, + { + "internalType": "uint256", + "name": "amountTokenMin", + "type": "uint256" + }, + { "internalType": "uint256", "name": "amountETHMin", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "removeLiquidityETH", + "outputs": [ + { "internalType": "uint256", "name": "amountToken", "type": "uint256" }, + { "internalType": "uint256", "name": "amountETH", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "token", "type": "address" }, + { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, + { + "internalType": "uint256", + "name": "amountTokenMin", + "type": "uint256" + }, + { "internalType": "uint256", "name": "amountETHMin", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "removeLiquidityETHSupportingFeeOnTransferTokens", + "outputs": [ + { "internalType": "uint256", "name": "amountETH", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "token", "type": "address" }, + { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, + { + "internalType": "uint256", + "name": "amountTokenMin", + "type": "uint256" + }, + { "internalType": "uint256", "name": "amountETHMin", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" }, + { "internalType": "bool", "name": "approveMax", "type": "bool" }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "name": "removeLiquidityETHWithPermit", + "outputs": [ + { "internalType": "uint256", "name": "amountToken", "type": "uint256" }, + { "internalType": "uint256", "name": "amountETH", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "token", "type": "address" }, + { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, + { + "internalType": "uint256", + "name": "amountTokenMin", + "type": "uint256" + }, + { "internalType": "uint256", "name": "amountETHMin", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" }, + { "internalType": "bool", "name": "approveMax", "type": "bool" }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "name": "removeLiquidityETHWithPermitSupportingFeeOnTransferTokens", + "outputs": [ + { "internalType": "uint256", "name": "amountETH", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenA", "type": "address" }, + { "internalType": "address", "name": "tokenB", "type": "address" }, + { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, + { "internalType": "uint256", "name": "amountAMin", "type": "uint256" }, + { "internalType": "uint256", "name": "amountBMin", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" }, + { "internalType": "bool", "name": "approveMax", "type": "bool" }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "name": "removeLiquidityWithPermit", + "outputs": [ + { "internalType": "uint256", "name": "amountA", "type": "uint256" }, + { "internalType": "uint256", "name": "amountB", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountOut", "type": "uint256" }, + { "internalType": "address[]", "name": "path", "type": "address[]" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "swapETHForExactTokens", + "outputs": [ + { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, + { "internalType": "address[]", "name": "path", "type": "address[]" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "swapExactETHForTokens", + "outputs": [ + { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, + { "internalType": "address[]", "name": "path", "type": "address[]" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "swapExactETHForTokensSupportingFeeOnTransferTokens", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, + { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, + { "internalType": "address[]", "name": "path", "type": "address[]" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "swapExactTokensForETH", + "outputs": [ + { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, + { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, + { "internalType": "address[]", "name": "path", "type": "address[]" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "swapExactTokensForETHSupportingFeeOnTransferTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, + { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, + { "internalType": "address[]", "name": "path", "type": "address[]" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "swapExactTokensForTokens", + "outputs": [ + { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, + { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, + { "internalType": "address[]", "name": "path", "type": "address[]" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "swapExactTokensForTokensSupportingFeeOnTransferTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountOut", "type": "uint256" }, + { "internalType": "uint256", "name": "amountInMax", "type": "uint256" }, + { "internalType": "address[]", "name": "path", "type": "address[]" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "swapTokensForExactETH", + "outputs": [ + { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountOut", "type": "uint256" }, + { "internalType": "uint256", "name": "amountInMax", "type": "uint256" }, + { "internalType": "address[]", "name": "path", "type": "address[]" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "swapTokensForExactTokens", + "outputs": [ + { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { "stateMutability": "payable", "type": "receive" } +] diff --git a/subgraphs/balancer-forks/abis/Prices/YearnLens.json b/subgraphs/balancer-forks/abis/Prices/YearnLens.json index c08c7319a8..60a45cc87c 100644 --- a/subgraphs/balancer-forks/abis/Prices/YearnLens.json +++ b/subgraphs/balancer-forks/abis/Prices/YearnLens.json @@ -1,174 +1,174 @@ -[ - { - "inputs": [ - { - "internalType": "address", - "name": "_managementListAddress", - "type": "address" - }, - { "internalType": "address", "name": "_usdcAddress", "type": "address" } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "tokenAddress", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "tokenAliasAddress", - "type": "address" - } - ], - "name": "TokenAliasAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "tokenAddress", - "type": "address" - } - ], - "name": "TokenAliasRemoved", - "type": "event" - }, - { "stateMutability": "nonpayable", "type": "fallback" }, - { - "inputs": [ - { "internalType": "address", "name": "tokenAddress", "type": "address" }, - { - "internalType": "address", - "name": "tokenAliasAddress", - "type": "address" - } - ], - "name": "addTokenAlias", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "tokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "tokenAliasAddress", - "type": "address" - } - ], - "internalType": "struct Oracle.TokenAlias[]", - "name": "_tokenAliases", - "type": "tuple[]" - } - ], - "name": "addTokenAliases", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "calculations", - "outputs": [ - { "internalType": "address[]", "name": "", "type": "address[]" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "tokenAddress", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "getNormalizedValueUsdc", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "tokenAddress", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" }, - { "internalType": "uint256", "name": "priceUsdc", "type": "uint256" } - ], - "name": "getNormalizedValueUsdc", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "tokenAddress", "type": "address" } - ], - "name": "getPriceUsdcRecommended", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "managementList", - "outputs": [ - { - "internalType": "contract ManagementList", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "tokenAddress", "type": "address" } - ], - "name": "removeTokenAlias", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "calculationAddresses", - "type": "address[]" - } - ], - "name": "setCalculations", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "tokenAliases", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "usdcAddress", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - } -] +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_managementListAddress", + "type": "address" + }, + { "internalType": "address", "name": "_usdcAddress", "type": "address" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "tokenAliasAddress", + "type": "address" + } + ], + "name": "TokenAliasAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "tokenAddress", + "type": "address" + } + ], + "name": "TokenAliasRemoved", + "type": "event" + }, + { "stateMutability": "nonpayable", "type": "fallback" }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" }, + { + "internalType": "address", + "name": "tokenAliasAddress", + "type": "address" + } + ], + "name": "addTokenAlias", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenAliasAddress", + "type": "address" + } + ], + "internalType": "struct Oracle.TokenAlias[]", + "name": "_tokenAliases", + "type": "tuple[]" + } + ], + "name": "addTokenAliases", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "calculations", + "outputs": [ + { "internalType": "address[]", "name": "", "type": "address[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "getNormalizedValueUsdc", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "uint256", "name": "priceUsdc", "type": "uint256" } + ], + "name": "getNormalizedValueUsdc", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" } + ], + "name": "getPriceUsdcRecommended", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "managementList", + "outputs": [ + { + "internalType": "contract ManagementList", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" } + ], + "name": "removeTokenAlias", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "calculationAddresses", + "type": "address[]" + } + ], + "name": "setCalculations", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "tokenAliases", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "usdcAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/subgraphs/balancer-forks/abis/balancer-v2/AccessControlledOffchainAggregator.json b/subgraphs/balancer-forks/abis/balancer-v2/AccessControlledOffchainAggregator.json new file mode 100644 index 0000000000..67d06db2ac --- /dev/null +++ b/subgraphs/balancer-forks/abis/balancer-v2/AccessControlledOffchainAggregator.json @@ -0,0 +1,1010 @@ +[ + { + "inputs": [ + { + "internalType": "uint32", + "name": "_maximumGasPrice", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "_reasonableGasPrice", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "_microLinkPerEth", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "_linkGweiPerObservation", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "_linkGweiPerTransmission", + "type": "uint32" + }, + { + "internalType": "contract LinkTokenInterface", + "name": "_link", + "type": "address" + }, + { "internalType": "int192", "name": "_minAnswer", "type": "int192" }, + { "internalType": "int192", "name": "_maxAnswer", "type": "int192" }, + { + "internalType": "contract AccessControllerInterface", + "name": "_billingAccessController", + "type": "address" + }, + { + "internalType": "contract AccessControllerInterface", + "name": "_requesterAccessController", + "type": "address" + }, + { "internalType": "uint8", "name": "_decimals", "type": "uint8" }, + { "internalType": "string", "name": "description", "type": "string" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "AddedAccess", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "int256", + "name": "current", + "type": "int256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "roundId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "updatedAt", + "type": "uint256" + } + ], + "name": "AnswerUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract AccessControllerInterface", + "name": "old", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract AccessControllerInterface", + "name": "current", + "type": "address" + } + ], + "name": "BillingAccessControllerSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint32", + "name": "maximumGasPrice", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "reasonableGasPrice", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "microLinkPerEth", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "linkGweiPerObservation", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "linkGweiPerTransmission", + "type": "uint32" + } + ], + "name": "BillingSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "CheckAccessDisabled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "CheckAccessEnabled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint32", + "name": "previousConfigBlockNumber", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "configCount", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "signers", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "transmitters", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "threshold", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "encodedConfigVersion", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "encoded", + "type": "bytes" + } + ], + "name": "ConfigSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract LinkTokenInterface", + "name": "_oldLinkToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract LinkTokenInterface", + "name": "_newLinkToken", + "type": "address" + } + ], + "name": "LinkTokenSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "roundId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "startedBy", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "startedAt", + "type": "uint256" + } + ], + "name": "NewRound", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint32", + "name": "aggregatorRoundId", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "int192", + "name": "answer", + "type": "int192" + }, + { + "indexed": false, + "internalType": "address", + "name": "transmitter", + "type": "address" + }, + { + "indexed": false, + "internalType": "int192[]", + "name": "observations", + "type": "int192[]" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "observers", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "rawReportContext", + "type": "bytes32" + } + ], + "name": "NewTransmission", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "transmitter", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "payee", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "contract LinkTokenInterface", + "name": "linkToken", + "type": "address" + } + ], + "name": "OraclePaid", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "OwnershipTransferRequested", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "transmitter", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "current", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "proposed", + "type": "address" + } + ], + "name": "PayeeshipTransferRequested", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "transmitter", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "previous", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "current", + "type": "address" + } + ], + "name": "PayeeshipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "RemovedAccess", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract AccessControllerInterface", + "name": "old", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract AccessControllerInterface", + "name": "current", + "type": "address" + } + ], + "name": "RequesterAccessControllerSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "requester", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes16", + "name": "configDigest", + "type": "bytes16" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "epoch", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "round", + "type": "uint8" + } + ], + "name": "RoundRequested", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract AggregatorValidatorInterface", + "name": "previousValidator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "previousGasLimit", + "type": "uint32" + }, + { + "indexed": true, + "internalType": "contract AggregatorValidatorInterface", + "name": "currentValidator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "currentGasLimit", + "type": "uint32" + } + ], + "name": "ValidatorConfigSet", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_transmitter", "type": "address" } + ], + "name": "acceptPayeeship", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_user", "type": "address" } + ], + "name": "addAccess", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "billingAccessController", + "outputs": [ + { + "internalType": "contract AccessControllerInterface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "checkEnabled", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "description", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "disableAccessCheck", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "enableAccessCheck", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_roundId", "type": "uint256" } + ], + "name": "getAnswer", + "outputs": [{ "internalType": "int256", "name": "", "type": "int256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getBilling", + "outputs": [ + { "internalType": "uint32", "name": "maximumGasPrice", "type": "uint32" }, + { + "internalType": "uint32", + "name": "reasonableGasPrice", + "type": "uint32" + }, + { "internalType": "uint32", "name": "microLinkPerEth", "type": "uint32" }, + { + "internalType": "uint32", + "name": "linkGweiPerObservation", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "linkGweiPerTransmission", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getLinkToken", + "outputs": [ + { + "internalType": "contract LinkTokenInterface", + "name": "linkToken", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint80", "name": "_roundId", "type": "uint80" } + ], + "name": "getRoundData", + "outputs": [ + { "internalType": "uint80", "name": "roundId", "type": "uint80" }, + { "internalType": "int256", "name": "answer", "type": "int256" }, + { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, + { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, + { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_roundId", "type": "uint256" } + ], + "name": "getTimestamp", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_user", "type": "address" }, + { "internalType": "bytes", "name": "_calldata", "type": "bytes" } + ], + "name": "hasAccess", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "latestAnswer", + "outputs": [{ "internalType": "int256", "name": "", "type": "int256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "latestConfigDetails", + "outputs": [ + { "internalType": "uint32", "name": "configCount", "type": "uint32" }, + { "internalType": "uint32", "name": "blockNumber", "type": "uint32" }, + { "internalType": "bytes16", "name": "configDigest", "type": "bytes16" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "latestRound", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "latestRoundData", + "outputs": [ + { "internalType": "uint80", "name": "roundId", "type": "uint80" }, + { "internalType": "int256", "name": "answer", "type": "int256" }, + { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, + { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, + { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "latestTimestamp", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "latestTransmissionDetails", + "outputs": [ + { "internalType": "bytes16", "name": "configDigest", "type": "bytes16" }, + { "internalType": "uint32", "name": "epoch", "type": "uint32" }, + { "internalType": "uint8", "name": "round", "type": "uint8" }, + { "internalType": "int192", "name": "latestAnswer", "type": "int192" }, + { "internalType": "uint64", "name": "latestTimestamp", "type": "uint64" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "linkAvailableForPayment", + "outputs": [ + { "internalType": "int256", "name": "availableBalance", "type": "int256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxAnswer", + "outputs": [{ "internalType": "int192", "name": "", "type": "int192" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minAnswer", + "outputs": [{ "internalType": "int192", "name": "", "type": "int192" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_signerOrTransmitter", + "type": "address" + } + ], + "name": "oracleObservationCount", + "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_transmitter", "type": "address" } + ], + "name": "owedPayment", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { "internalType": "address payable", "name": "", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_user", "type": "address" } + ], + "name": "removeAccess", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "requestNewRound", + "outputs": [{ "internalType": "uint80", "name": "", "type": "uint80" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "requesterAccessController", + "outputs": [ + { + "internalType": "contract AccessControllerInterface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_maximumGasPrice", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "_reasonableGasPrice", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "_microLinkPerEth", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "_linkGweiPerObservation", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "_linkGweiPerTransmission", + "type": "uint32" + } + ], + "name": "setBilling", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract AccessControllerInterface", + "name": "_billingAccessController", + "type": "address" + } + ], + "name": "setBillingAccessController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address[]", "name": "_signers", "type": "address[]" }, + { + "internalType": "address[]", + "name": "_transmitters", + "type": "address[]" + }, + { "internalType": "uint8", "name": "_threshold", "type": "uint8" }, + { + "internalType": "uint64", + "name": "_encodedConfigVersion", + "type": "uint64" + }, + { "internalType": "bytes", "name": "_encoded", "type": "bytes" } + ], + "name": "setConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract LinkTokenInterface", + "name": "_linkToken", + "type": "address" + }, + { "internalType": "address", "name": "_recipient", "type": "address" } + ], + "name": "setLinkToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_transmitters", + "type": "address[]" + }, + { "internalType": "address[]", "name": "_payees", "type": "address[]" } + ], + "name": "setPayees", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract AccessControllerInterface", + "name": "_requesterAccessController", + "type": "address" + } + ], + "name": "setRequesterAccessController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract AggregatorValidatorInterface", + "name": "_newValidator", + "type": "address" + }, + { "internalType": "uint32", "name": "_newGasLimit", "type": "uint32" } + ], + "name": "setValidatorConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "_to", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_transmitter", "type": "address" }, + { "internalType": "address", "name": "_proposed", "type": "address" } + ], + "name": "transferPayeeship", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes", "name": "_report", "type": "bytes" }, + { "internalType": "bytes32[]", "name": "_rs", "type": "bytes32[]" }, + { "internalType": "bytes32[]", "name": "_ss", "type": "bytes32[]" }, + { "internalType": "bytes32", "name": "_rawVs", "type": "bytes32" } + ], + "name": "transmit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "transmitters", + "outputs": [ + { "internalType": "address[]", "name": "", "type": "address[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "typeAndVersion", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "validatorConfig", + "outputs": [ + { + "internalType": "contract AggregatorValidatorInterface", + "name": "validator", + "type": "address" + }, + { "internalType": "uint32", "name": "gasLimit", "type": "uint32" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "version", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_recipient", "type": "address" }, + { "internalType": "uint256", "name": "_amount", "type": "uint256" } + ], + "name": "withdrawFunds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_transmitter", "type": "address" } + ], + "name": "withdrawPayment", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + \ No newline at end of file diff --git a/subgraphs/balancer-forks/abis/balancer-v2/WeightedPool.json b/subgraphs/balancer-forks/abis/balancer-v2/WeightedPool.json index 1ef2e36177..c16325944e 100644 --- a/subgraphs/balancer-forks/abis/balancer-v2/WeightedPool.json +++ b/subgraphs/balancer-forks/abis/balancer-v2/WeightedPool.json @@ -936,5 +936,12 @@ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" + }, + { + "inputs": [], + "name": "POOL_ID", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" } ] diff --git a/subgraphs/balancer-forks/abis/beethoven-x/WeightedPool.json b/subgraphs/balancer-forks/abis/beethoven-x/WeightedPool.json index 1ef2e36177..c16325944e 100644 --- a/subgraphs/balancer-forks/abis/beethoven-x/WeightedPool.json +++ b/subgraphs/balancer-forks/abis/beethoven-x/WeightedPool.json @@ -936,5 +936,12 @@ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" + }, + { + "inputs": [], + "name": "POOL_ID", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" } ] diff --git a/subgraphs/balancer-forks/protocols/balancer-v2/config/deployments/balancer-v2-arbitrum/configurations.json b/subgraphs/balancer-forks/protocols/balancer-v2/config/deployments/balancer-v2-arbitrum/configurations.json index 7f4f93aed9..f67d309157 100644 --- a/subgraphs/balancer-forks/protocols/balancer-v2/config/deployments/balancer-v2-arbitrum/configurations.json +++ b/subgraphs/balancer-forks/protocols/balancer-v2/config/deployments/balancer-v2-arbitrum/configurations.json @@ -16,6 +16,41 @@ "inflationInterval": "NONE", "usesBalancerTokenAdmin": false, + "useSwapBasedPriceLib": true, + + "stableAssets": [ + { + "address": "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", + "symbol": "USDC" + }, + { + "address": "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", + "symbol": "DAI" + }, + { + "address": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9", + "symbol": "USDT" + } + ], + + "pricingAssets": [ + { + "address": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", + "symbol": "WETH" + }, + { + "address": "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f", + "symbol": "WBTC" + }, + { + "address": "0x040d1EdC9569d4Bab2D15287Dc5A4F10F56a56B8", + "symbol": "BAL" + }, + { + "address": "0xa0b862F60edEf4452F25B4160F177db44DeB6Cf1", + "symbol": "GNO" + } + ], "graftEnabled": false, "subgraphId": "", diff --git a/subgraphs/balancer-forks/protocols/balancer-v2/config/deployments/balancer-v2-ethereum/configurations.json b/subgraphs/balancer-forks/protocols/balancer-v2/config/deployments/balancer-v2-ethereum/configurations.json index ba4245b0e6..1e5944e3a4 100644 --- a/subgraphs/balancer-forks/protocols/balancer-v2/config/deployments/balancer-v2-ethereum/configurations.json +++ b/subgraphs/balancer-forks/protocols/balancer-v2/config/deployments/balancer-v2-ethereum/configurations.json @@ -17,9 +17,132 @@ "balancerTokenAdmin": "0xf302f9f50958c5593770fdf4d4812309ff77414f", "balancerTokenAdminStartBlock": 14456738, + "usesBalancerTokenAdmin": true, + "useSwapBasedPriceLib": false, - "graftEnabled": true, - "subgraphId": "QmRD5cEyRossPmz2AdYjeoa1KPLgS7wu5v5oF9uGDd81HC", - "graftStartBlock": "16637574" + "stableAssets": [ + { + "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + "symbol": "USDC" + }, + { + "address": "0x6B175474E89094C44Da98b954EedeAC495271d0F", + "symbol": "DAI" + }, + { + "address": "0xdAC17F958D2ee523a2206206994597C13D831ec7", + "symbol": "USDT" + } + ], + "pricingAssets": [ + { + "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + "symbol": "WETH" + }, + { + "address": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0", + "symbol": "wstETH" + }, + { + "address": "0x804CdB9116a10bB78768D3252355a1b18067bF8f", + "symbol": "bb-a-DAI-V1" + }, + { + "address": "0x9210F1204b5a24742Eba12f710636D76240dF3d0", + "symbol": "bb-a-USDC-V1" + }, + { + "address": "0x2BBf681cC4eb09218BEe85EA2a5d3D13Fa40fC0C", + "symbol": "bb-a-USDT-V1" + }, + { + "address": "0xae37D54Ae477268B9997d4161B96b8200755935c", + "symbol": "bb-a-DAI-V2" + }, + { + "address": "0x82698aeCc9E28e9Bb27608Bd52cF57f704BD1B83", + "symbol": "bb-a-USDC-V2" + }, + { + "address": "0x2F4eb100552ef93840d5aDC30560E5513DFfFACb", + "symbol": "bb-a-USDT-V2" + }, + { + "address": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "symbol": "WBTC" + }, + { + "address": "0xba100000625a3754423978a60c9317c58a424e3D", + "symbol": "BAL" + }, + { + "address": "0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2", + "symbol": "MKR" + }, + { + "address": "0x6810e776880C02933D47DB1b9fc05908e5386b96", + "symbol": "GNO" + }, + { + "address": "0x5c6ee304399dbdb9c8ef030ab642b10820db8f56", + "symbol": "B-80BAL-20WETH" + }, + { + "address": "0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0", + "symbol": "MATIC" + }, + { + "address": "0xA13a9247ea42D743238089903570127DdA72fE44", + "symbol": "bb-a-USD" + } + ], + "fxAssets": [ + { + "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + "symbol": "USDC" + }, + { + "address": "0x70e8dE73cE538DA2bEEd35d14187F6959a8ecA96", + "symbol": "XSGD" + }, + { + "address": "0x6B175474E89094C44Da98b954EedeAC495271d0F", + "symbol": "DAI" + }, + { + "address": "0xdB25f211AB05b1c97D595516F45794528a807ad8", + "symbol": "EURS" + }, + { + "address": "0xD533a949740bb3306d119CC777fa900bA034cd52", + "symbol": "CRV" + } + ], + "fxAggregators": [ + { + "address": "0x789190466E21a8b78b8027866CBBDc151542A26C", + "symbol": "USDC-USD" + }, + { + "address": "0xc96129C796F03bb21AC947EfC5329CD1F560305B", + "symbol": "XSGD-USD" + }, + { + "address": "0xDEc0a100eaD1fAa37407f0Edc76033426CF90b82", + "symbol": "DAI-USD" + }, + { + "address": "0x02F878A94a1AE1B15705aCD65b5519A46fe3517e", + "symbol": "EURS-USD" + }, + { + "address": "0xb4c4a493AB6356497713A78FFA6c60FB53517c63", + "symbol": "CRV-USD" + } + ], + + "graftEnabled": false, + "subgraphId": "QmZuUXo6EQ6wnHA2L2uZmsppjcnPeWN8GLkj5Jj8ujmThs", + "graftStartBlock": "18162839" } diff --git a/subgraphs/balancer-forks/protocols/balancer-v2/config/deployments/balancer-v2-polygon/configurations.json b/subgraphs/balancer-forks/protocols/balancer-v2/config/deployments/balancer-v2-polygon/configurations.json index 1eff345587..aef5adefc1 100644 --- a/subgraphs/balancer-forks/protocols/balancer-v2/config/deployments/balancer-v2-polygon/configurations.json +++ b/subgraphs/balancer-forks/protocols/balancer-v2/config/deployments/balancer-v2-polygon/configurations.json @@ -15,8 +15,94 @@ "protocolTokenStartingInflationPerIntervalUnit": 0, "inflationInterval": "NONE", + "useSwapBasedPriceLib": true, "usesBalancerTokenAdmin": false, + "stableAssets": [ + { + "address": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", + "symbol": "USDC" + }, + { + "address": "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063", + "symbol": "DAI" + }, + { + "address": "0xc2132d05d31c914a87c6611c10748aeb04b58e8f", + "symbol": "USDT" + } + ], + "pricingAssets": [ + { + "address": "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", + "symbol": "WMATIC" + }, + { + "address": "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619", + "symbol": "WETH" + }, + { + "address": "0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6", + "symbol": "WBTC" + }, + { + "address": "0x9a71012b13ca4d3d0cdc72a177df3ef03b0e76a3", + "symbol": "BAL" + }, + { + "address": "0x3d468ab2329f296e1b9d8476bb54dd77d8c2320f", + "symbol": "B-80BAL-20WETH" + }, + { + "address": "0x48e6b98ef6329f8f0a30ebb8c7c960330d648085", + "symbol": "bb-am-USD" + }, + { + "address": "0x6f7C932e7684666C9fd1d44527765433e01fF61d", + "symbol": "MKR" + }, + { + "address": "0x5FFD62D3C3eE2E81C00A7b9079FB248e7dF024A8", + "symbol": "GNO" + } + ], + "fxAssets": [ + { + "address": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", + "symbol": "USDC" + }, + { + "address": "0xDC3326e71D45186F113a2F448984CA0e8D201995", + "symbol": "XSGD" + }, + { + "address": "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", + "symbol": "DAI" + }, + { + "address": "0xE111178A87A3BFf0c8d18DECBa5798827539Ae99", + "symbol": "EURS" + } + ], + "fxAggregators": [ + { + "address": "0xf9c53A834F60cBbE40E27702276fBc0819B3aFAD", + "symbol": "USDC-USD" + }, + { + "address": "0x45ede0Ea5cBbE380C663C7C3015Cc7c986669FEc", + "symbol": "XSGD-USD" + }, + { + "address": "0x62439095489Eb5dE4572de632248682c09a05Ad4", + "symbol": "DAI-USD" + }, + { + "address": "0x310990E8091b5cF083fA55F500F140CFBb959016", + "symbol": "EURS-USD" + } + ], + "graftEnabled": false, "subgraphId": "", "graftStartBlock": "" diff --git a/subgraphs/balancer-forks/protocols/balancer-v2/config/templates/balancer.v2.template.yaml b/subgraphs/balancer-forks/protocols/balancer-v2/config/templates/balancer.v2.template.yaml index 69796a5c51..71e0849cca 100644 --- a/subgraphs/balancer-forks/protocols/balancer-v2/config/templates/balancer.v2.template.yaml +++ b/subgraphs/balancer-forks/protocols/balancer-v2/config/templates/balancer.v2.template.yaml @@ -44,24 +44,27 @@ dataSources: - name: _ERC20 file: ./abis/Prices/ERC20.json # Curve Contracts + - name: CurvePool + file: ./abis/Prices/Curve/Pool.json - name: CurveRegistry file: ./abis/Prices/Curve/Registry.json - - name: CurvePoolRegistry - file: ./abis/Prices/Curve/PoolRegistry.json - name: CalculationsCurve file: ./abis/Prices/Calculations/Curve.json # YearnLens Contracts - name: YearnLensContract file: ./abis/Prices/YearnLens.json + # Aave Oracle Contract + - name: InchOracleContract + file: ./abis/Prices/InchOracle.json + # Aave Oracle Contract + - name: AaveOracleContract + file: ./abis/Prices/AaveOracle.json + # SushiSwap Contracts + - name: CalculationsSushiSwap + file: ./abis/Prices/Calculations/SushiSwap.json # ChainLink Contracts - name: ChainLinkContract file: ./abis/Prices/ChainLink.json - # 1Inch Contracts - - name: OneInchOracleContract - file: ./abis/Prices/1Inch/Oracle.json - # Aave Contracts - - name: AaveOracleContract - file: ./abis/Prices/Aave/Oracle.json # Uniswap Contracts - name: UniswapRouter file: ./abis/Prices/Uniswap/Router.json @@ -69,15 +72,6 @@ dataSources: file: ./abis/Prices/Uniswap/Factory.json - name: UniswapPair file: ./abis/Prices/Uniswap/Pair.json - # SushiSwap Contracts - - name: SushiSwapRouter - file: ./abis/Prices/SushiSwap/Router.json - - name: SushiSwapFactory - file: ./abis/Prices/SushiSwap/Factory.json - - name: SushiSwapPair - file: ./abis/Prices/SushiSwap/Pair.json - - name: CalculationsSushiSwap - file: ./abis/Prices/Calculations/SushiSwap.json eventHandlers: - event: PoolRegistered(indexed bytes32,indexed address,uint8) handler: handlePoolRegistered @@ -123,24 +117,27 @@ dataSources: - name: _ERC20 file: ./abis/Prices/ERC20.json # Curve Contracts + - name: CurvePool + file: ./abis/Prices/Curve/Pool.json - name: CurveRegistry file: ./abis/Prices/Curve/Registry.json - - name: CurvePoolRegistry - file: ./abis/Prices/Curve/PoolRegistry.json - name: CalculationsCurve file: ./abis/Prices/Calculations/Curve.json # YearnLens Contracts - name: YearnLensContract file: ./abis/Prices/YearnLens.json + # Aave Oracle Contract + - name: InchOracleContract + file: ./abis/Prices/InchOracle.json + # Aave Oracle Contract + - name: AaveOracleContract + file: ./abis/Prices/AaveOracle.json + # SushiSwap Contracts + - name: CalculationsSushiSwap + file: ./abis/Prices/Calculations/SushiSwap.json # ChainLink Contracts - name: ChainLinkContract file: ./abis/Prices/ChainLink.json - # 1Inch Contracts - - name: OneInchOracleContract - file: ./abis/Prices/1Inch/Oracle.json - # Aave Contracts - - name: AaveOracleContract - file: ./abis/Prices/Aave/Oracle.json # Uniswap Contracts - name: UniswapRouter file: ./abis/Prices/Uniswap/Router.json @@ -148,15 +145,6 @@ dataSources: file: ./abis/Prices/Uniswap/Factory.json - name: UniswapPair file: ./abis/Prices/Uniswap/Pair.json - # SushiSwap Contracts - - name: SushiSwapRouter - file: ./abis/Prices/SushiSwap/Router.json - - name: SushiSwapFactory - file: ./abis/Prices/SushiSwap/Factory.json - - name: SushiSwapPair - file: ./abis/Prices/SushiSwap/Pair.json - - name: CalculationsSushiSwap - file: ./abis/Prices/Calculations/SushiSwap.json eventHandlers: - event: NewGauge(address,int128,uint256) handler: handleNewGauge @@ -219,24 +207,27 @@ templates: - name: _ERC20 file: ./abis/Prices/ERC20.json # Curve Contracts + - name: CurvePool + file: ./abis/Prices/Curve/Pool.json - name: CurveRegistry file: ./abis/Prices/Curve/Registry.json - - name: CurvePoolRegistry - file: ./abis/Prices/Curve/PoolRegistry.json - name: CalculationsCurve file: ./abis/Prices/Calculations/Curve.json # YearnLens Contracts - name: YearnLensContract file: ./abis/Prices/YearnLens.json + # Aave Oracle Contract + - name: InchOracleContract + file: ./abis/Prices/InchOracle.json + # Aave Oracle Contract + - name: AaveOracleContract + file: ./abis/Prices/AaveOracle.json + # SushiSwap Contracts + - name: CalculationsSushiSwap + file: ./abis/Prices/Calculations/SushiSwap.json # ChainLink Contracts - name: ChainLinkContract file: ./abis/Prices/ChainLink.json - # 1Inch Contracts - - name: OneInchOracleContract - file: ./abis/Prices/1Inch/Oracle.json - # Aave Contracts - - name: AaveOracleContract - file: ./abis/Prices/Aave/Oracle.json # Uniswap Contracts - name: UniswapRouter file: ./abis/Prices/Uniswap/Router.json @@ -244,15 +235,6 @@ templates: file: ./abis/Prices/Uniswap/Factory.json - name: UniswapPair file: ./abis/Prices/Uniswap/Pair.json - # SushiSwap Contracts - - name: SushiSwapRouter - file: ./abis/Prices/SushiSwap/Router.json - - name: SushiSwapFactory - file: ./abis/Prices/SushiSwap/Factory.json - - name: SushiSwapPair - file: ./abis/Prices/SushiSwap/Pair.json - - name: CalculationsSushiSwap - file: ./abis/Prices/Calculations/SushiSwap.json eventHandlers: - event: SwapFeePercentageChanged(uint256) handler: handleSwapFeePercentageChanged @@ -291,24 +273,27 @@ templates: - name: _ERC20 file: ./abis/Prices/ERC20.json # Curve Contracts + - name: CurvePool + file: ./abis/Prices/Curve/Pool.json - name: CurveRegistry file: ./abis/Prices/Curve/Registry.json - - name: CurvePoolRegistry - file: ./abis/Prices/Curve/PoolRegistry.json - name: CalculationsCurve file: ./abis/Prices/Calculations/Curve.json # YearnLens Contracts - name: YearnLensContract file: ./abis/Prices/YearnLens.json + # Aave Oracle Contract + - name: InchOracleContract + file: ./abis/Prices/InchOracle.json + # Aave Oracle Contract + - name: AaveOracleContract + file: ./abis/Prices/AaveOracle.json + # SushiSwap Contracts + - name: CalculationsSushiSwap + file: ./abis/Prices/Calculations/SushiSwap.json # ChainLink Contracts - name: ChainLinkContract file: ./abis/Prices/ChainLink.json - # 1Inch Contracts - - name: OneInchOracleContract - file: ./abis/Prices/1Inch/Oracle.json - # Aave Contracts - - name: AaveOracleContract - file: ./abis/Prices/Aave/Oracle.json # Uniswap Contracts - name: UniswapRouter file: ./abis/Prices/Uniswap/Router.json @@ -316,15 +301,6 @@ templates: file: ./abis/Prices/Uniswap/Factory.json - name: UniswapPair file: ./abis/Prices/Uniswap/Pair.json - # SushiSwap Contracts - - name: SushiSwapRouter - file: ./abis/Prices/SushiSwap/Router.json - - name: SushiSwapFactory - file: ./abis/Prices/SushiSwap/Factory.json - - name: SushiSwapPair - file: ./abis/Prices/SushiSwap/Pair.json - - name: CalculationsSushiSwap - file: ./abis/Prices/Calculations/SushiSwap.json eventHandlers: - event: Deposit(indexed address,uint256) handler: handleDeposit @@ -333,3 +309,21 @@ templates: - event: UpdateLiquidityLimit(indexed address,uint256,uint256,uint256,uint256) handler: handleUpdateLiquidityLimit file: ./src/mappings/gaugeMappings.ts + - kind: ethereum/contract + name: OffchainAggregator + network: {{network}} + source: + abi: AccessControlledOffchainAggregator + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + file: ./src/modules/pricing.ts + entities: + - Token + abis: + - name: AccessControlledOffchainAggregator + file: ./abis/balancer-v2/AccessControlledOffchainAggregator.json + eventHandlers: + - event: AnswerUpdated(indexed int256,indexed uint256,uint256) + handler: handleAnswerUpdated \ No newline at end of file diff --git a/subgraphs/balancer-forks/protocols/beethoven-x/config/deployments/beethoven-x-fantom/configurations.json b/subgraphs/balancer-forks/protocols/beethoven-x/config/deployments/beethoven-x-fantom/configurations.json index 144a284153..0edbb04f28 100644 --- a/subgraphs/balancer-forks/protocols/beethoven-x/config/deployments/beethoven-x-fantom/configurations.json +++ b/subgraphs/balancer-forks/protocols/beethoven-x/config/deployments/beethoven-x-fantom/configurations.json @@ -15,12 +15,53 @@ "protocolTokenAddress": "0xF24Bcf4d1e507740041C9cFd2DddB29585aDCe1e", "protocolTokenStartingInflationPerIntervalUnit": 0, - "inflationInterval": "TIMESTAMP", - "gaugeControllerAddress": "0x0000000000000000000000000000000000000000", + "useSwapBasedPriceLib": true, + + "stableAssets": [ + { + "address": "0x04068da6c83afcfa0e13ba15a6696662335d5b75", + "symbol": "USDC" + }, + { + "address": "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e", + "symbol": "DAI" + }, + { + "address": "0x049d68029688eabf473097a2fc38ef61633a3c7a", + "symbol": "fUSDT" + } + ], + "pricingAssets": [ + { + "address": "0x74b23882a30290451a17c44f4f05243b6b58c76d", + "symbol": "WETH" + }, + { + "address": "0x1f32b1c2345538c0c6f582fcb022739c4a194ebb", + "symbol": "wstETH" + }, + { + "address": "0x13bc6df7189f7997b4977322f2142aa4bb18efae", + "symbol": "bb-a-USD" + }, + { + "address": "0x58a547ed09684ac2a688610d5caf8e8968b51908", + "symbol": "BAL" + }, + { + "address": "0x38aca5484b8603373acc6961ecd57a6a594510a3", + "symbol": "WBTC" + }, + { + "address": "0x39b3bd37208cbade74d0fcbdbb12d606295b430a", + "symbol": "FTM" + } + ], + "graftEnabled": false, - "subgraphId": "Qme6b5E86jgs3NpiZXj2iL5gnYhAswCgwQdsV8HJx9BW1J", - "graftStartBlock": 27921709 + "subgraphId": "", + "graftStartBlock": "" } diff --git a/subgraphs/balancer-forks/protocols/beethoven-x/config/deployments/beethoven-x-optimism/configurations.json b/subgraphs/balancer-forks/protocols/beethoven-x/config/deployments/beethoven-x-optimism/configurations.json index 927cd2adc4..354cbad32b 100644 --- a/subgraphs/balancer-forks/protocols/beethoven-x/config/deployments/beethoven-x-optimism/configurations.json +++ b/subgraphs/balancer-forks/protocols/beethoven-x/config/deployments/beethoven-x-optimism/configurations.json @@ -5,7 +5,7 @@ "defaultNetwork": "Network.OPTIMISM", "vaultAddress": "0xBA12222222228d8Ba445958a75a0704d566BF2C8", - "vaultStartBlock": 154627, + "vaultStartBlock": 7003431, "gaugeControllerAddress": "0x2E96068b3D5B5BAE3D7515da4A1D2E52d08A2647", "gaugeControllerStartBlock": 9052485, @@ -16,6 +16,49 @@ "protocolTokenStartingInflationPerIntervalUnit": 0, "inflationInterval": "TIMESTAMP", + "useSwapBasedPriceLib": false, + + "stableAssets": [ + { + "address": "0x7f5c764cbc14f9669b88837ca1490cca17c31607", + "symbol": "USDC" + }, + { + "address": "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1", + "symbol": "DAI" + }, + { + "address": "0x94b008aa00579c1307b0ef2c499ad98a8ce58e58", + "symbol": "USDT" + } + ], + "pricingAssets": [ + { + "address": "0x4200000000000000000000000000000000000006", + "symbol": "WETH" + }, + { + "address": "0x1f32b1c2345538c0c6f582fcb022739c4a194ebb", + "symbol": "wstETH" + }, + { + "address": "0x13bc6df7189f7997b4977322f2142aa4bb18efae", + "symbol": "bb-a-USD" + }, + { + "address": "0xfe8b128ba8c78aabc59d4c64cee7ff28e9379921", + "symbol": "BAL" + }, + { + "address": "0x68f180fcce6836688e9084f035309e29bf0a2095", + "symbol": "WBTC" + }, + { + "address": "0x4200000000000000000000000000000000000042", + "symbol": "OP" + } + ], + "graftEnabled": false, "subgraphId": "", "graftStartBlock": "" diff --git a/subgraphs/balancer-forks/protocols/beethoven-x/config/templates/beethoven.x.fantom.template.yaml b/subgraphs/balancer-forks/protocols/beethoven-x/config/templates/beethoven.x.fantom.template.yaml index 1f56152845..b8b3b9638a 100644 --- a/subgraphs/balancer-forks/protocols/beethoven-x/config/templates/beethoven.x.fantom.template.yaml +++ b/subgraphs/balancer-forks/protocols/beethoven-x/config/templates/beethoven.x.fantom.template.yaml @@ -46,24 +46,27 @@ dataSources: - name: _ERC20 file: ./abis/Prices/ERC20.json # Curve Contracts + - name: CurvePool + file: ./abis/Prices/Curve/Pool.json - name: CurveRegistry file: ./abis/Prices/Curve/Registry.json - - name: CurvePoolRegistry - file: ./abis/Prices/Curve/PoolRegistry.json - name: CalculationsCurve file: ./abis/Prices/Calculations/Curve.json # YearnLens Contracts - name: YearnLensContract file: ./abis/Prices/YearnLens.json + # Aave Oracle Contract + - name: InchOracleContract + file: ./abis/Prices/InchOracle.json + # Aave Oracle Contract + - name: AaveOracleContract + file: ./abis/Prices/AaveOracle.json + # SushiSwap Contracts + - name: CalculationsSushiSwap + file: ./abis/Prices/Calculations/SushiSwap.json # ChainLink Contracts - name: ChainLinkContract file: ./abis/Prices/ChainLink.json - # 1Inch Contracts - - name: OneInchOracleContract - file: ./abis/Prices/1Inch/Oracle.json - # Aave Contracts - - name: AaveOracleContract - file: ./abis/Prices/Aave/Oracle.json # Uniswap Contracts - name: UniswapRouter file: ./abis/Prices/Uniswap/Router.json @@ -71,15 +74,6 @@ dataSources: file: ./abis/Prices/Uniswap/Factory.json - name: UniswapPair file: ./abis/Prices/Uniswap/Pair.json - # SushiSwap Contracts - - name: SushiSwapRouter - file: ./abis/Prices/SushiSwap/Router.json - - name: SushiSwapFactory - file: ./abis/Prices/SushiSwap/Factory.json - - name: SushiSwapPair - file: ./abis/Prices/SushiSwap/Pair.json - - name: CalculationsSushiSwap - file: ./abis/Prices/Calculations/SushiSwap.json eventHandlers: - event: PoolRegistered(indexed bytes32,indexed address,uint8) handler: handlePoolRegistered @@ -120,24 +114,27 @@ dataSources: - name: _ERC20 file: ./abis/Prices/ERC20.json # Curve Contracts + - name: CurvePool + file: ./abis/Prices/Curve/Pool.json - name: CurveRegistry file: ./abis/Prices/Curve/Registry.json - - name: CurvePoolRegistry - file: ./abis/Prices/Curve/PoolRegistry.json - name: CalculationsCurve file: ./abis/Prices/Calculations/Curve.json # YearnLens Contracts - name: YearnLensContract file: ./abis/Prices/YearnLens.json + # Aave Oracle Contract + - name: InchOracleContract + file: ./abis/Prices/InchOracle.json + # Aave Oracle Contract + - name: AaveOracleContract + file: ./abis/Prices/AaveOracle.json + # SushiSwap Contracts + - name: CalculationsSushiSwap + file: ./abis/Prices/Calculations/SushiSwap.json # ChainLink Contracts - name: ChainLinkContract file: ./abis/Prices/ChainLink.json - # 1Inch Contracts - - name: OneInchOracleContract - file: ./abis/Prices/1Inch/Oracle.json - # Aave Contracts - - name: AaveOracleContract - file: ./abis/Prices/Aave/Oracle.json # Uniswap Contracts - name: UniswapRouter file: ./abis/Prices/Uniswap/Router.json @@ -145,16 +142,6 @@ dataSources: file: ./abis/Prices/Uniswap/Factory.json - name: UniswapPair file: ./abis/Prices/Uniswap/Pair.json - # SushiSwap Contracts - - name: SushiSwapRouter - file: ./abis/Prices/SushiSwap/Router.json - - name: SushiSwapFactory - file: ./abis/Prices/SushiSwap/Factory.json - - name: SushiSwapPair - file: ./abis/Prices/SushiSwap/Pair.json - - name: CalculationsSushiSwap - file: ./abis/Prices/Calculations/SushiSwap.json - eventHandlers: - event: Deposit(indexed address,indexed uint256,uint256,indexed address) handler: handleDeposit @@ -196,24 +183,27 @@ templates: - name: _ERC20 file: ./abis/Prices/ERC20.json # Curve Contracts + - name: CurvePool + file: ./abis/Prices/Curve/Pool.json - name: CurveRegistry file: ./abis/Prices/Curve/Registry.json - - name: CurvePoolRegistry - file: ./abis/Prices/Curve/PoolRegistry.json - name: CalculationsCurve file: ./abis/Prices/Calculations/Curve.json # YearnLens Contracts - name: YearnLensContract file: ./abis/Prices/YearnLens.json + # Aave Oracle Contract + - name: InchOracleContract + file: ./abis/Prices/InchOracle.json + # Aave Oracle Contract + - name: AaveOracleContract + file: ./abis/Prices/AaveOracle.json + # SushiSwap Contracts + - name: CalculationsSushiSwap + file: ./abis/Prices/Calculations/SushiSwap.json # ChainLink Contracts - name: ChainLinkContract file: ./abis/Prices/ChainLink.json - # 1Inch Contracts - - name: OneInchOracleContract - file: ./abis/Prices/1Inch/Oracle.json - # Aave Contracts - - name: AaveOracleContract - file: ./abis/Prices/Aave/Oracle.json # Uniswap Contracts - name: UniswapRouter file: ./abis/Prices/Uniswap/Router.json @@ -221,16 +211,24 @@ templates: file: ./abis/Prices/Uniswap/Factory.json - name: UniswapPair file: ./abis/Prices/Uniswap/Pair.json - # SushiSwap Contracts - - name: SushiSwapRouter - file: ./abis/Prices/SushiSwap/Router.json - - name: SushiSwapFactory - file: ./abis/Prices/SushiSwap/Factory.json - - name: SushiSwapPair - file: ./abis/Prices/SushiSwap/Pair.json - - name: CalculationsSushiSwap - file: ./abis/Prices/Calculations/SushiSwap.json - eventHandlers: - event: SwapFeePercentageChanged(uint256) handler: handleSwapFeePercentageChange + - kind: ethereum/contract + name: OffchainAggregator + network: {{network}} + source: + abi: AccessControlledOffchainAggregator + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + file: ./src/modules/pricing.ts + entities: + - Token + abis: + - name: AccessControlledOffchainAggregator + file: ./abis/balancer-v2/AccessControlledOffchainAggregator.json + eventHandlers: + - event: AnswerUpdated(indexed int256,indexed uint256,uint256) + handler: handleAnswerUpdated \ No newline at end of file diff --git a/subgraphs/balancer-forks/protocols/beethoven-x/config/templates/beethoven.x.optimism.template.yaml b/subgraphs/balancer-forks/protocols/beethoven-x/config/templates/beethoven.x.optimism.template.yaml index 389e17cbad..d74518d59c 100644 --- a/subgraphs/balancer-forks/protocols/beethoven-x/config/templates/beethoven.x.optimism.template.yaml +++ b/subgraphs/balancer-forks/protocols/beethoven-x/config/templates/beethoven.x.optimism.template.yaml @@ -40,24 +40,27 @@ dataSources: - name: _ERC20 file: ./abis/Prices/ERC20.json # Curve Contracts + - name: CurvePool + file: ./abis/Prices/Curve/Pool.json - name: CurveRegistry file: ./abis/Prices/Curve/Registry.json - - name: CurvePoolRegistry - file: ./abis/Prices/Curve/PoolRegistry.json - name: CalculationsCurve file: ./abis/Prices/Calculations/Curve.json # YearnLens Contracts - name: YearnLensContract file: ./abis/Prices/YearnLens.json + # Aave Oracle Contract + - name: InchOracleContract + file: ./abis/Prices/InchOracle.json + # Aave Oracle Contract + - name: AaveOracleContract + file: ./abis/Prices/AaveOracle.json + # SushiSwap Contracts + - name: CalculationsSushiSwap + file: ./abis/Prices/Calculations/SushiSwap.json # ChainLink Contracts - name: ChainLinkContract file: ./abis/Prices/ChainLink.json - # 1Inch Contracts - - name: OneInchOracleContract - file: ./abis/Prices/1Inch/Oracle.json - # Aave Contracts - - name: AaveOracleContract - file: ./abis/Prices/Aave/Oracle.json # Uniswap Contracts - name: UniswapRouter file: ./abis/Prices/Uniswap/Router.json @@ -65,15 +68,6 @@ dataSources: file: ./abis/Prices/Uniswap/Factory.json - name: UniswapPair file: ./abis/Prices/Uniswap/Pair.json - # SushiSwap Contracts - - name: SushiSwapRouter - file: ./abis/Prices/SushiSwap/Router.json - - name: SushiSwapFactory - file: ./abis/Prices/SushiSwap/Factory.json - - name: SushiSwapPair - file: ./abis/Prices/SushiSwap/Pair.json - - name: CalculationsSushiSwap - file: ./abis/Prices/Calculations/SushiSwap.json eventHandlers: - event: PoolRegistered(indexed bytes32,indexed address,uint8) handler: handlePoolRegistered @@ -160,24 +154,27 @@ templates: - name: _ERC20 file: ./abis/Prices/ERC20.json # Curve Contracts + - name: CurvePool + file: ./abis/Prices/Curve/Pool.json - name: CurveRegistry file: ./abis/Prices/Curve/Registry.json - - name: CurvePoolRegistry - file: ./abis/Prices/Curve/PoolRegistry.json - name: CalculationsCurve file: ./abis/Prices/Calculations/Curve.json # YearnLens Contracts - name: YearnLensContract file: ./abis/Prices/YearnLens.json + # Aave Oracle Contract + - name: InchOracleContract + file: ./abis/Prices/InchOracle.json + # Aave Oracle Contract + - name: AaveOracleContract + file: ./abis/Prices/AaveOracle.json + # SushiSwap Contracts + - name: CalculationsSushiSwap + file: ./abis/Prices/Calculations/SushiSwap.json # ChainLink Contracts - name: ChainLinkContract file: ./abis/Prices/ChainLink.json - # 1Inch Contracts - - name: OneInchOracleContract - file: ./abis/Prices/1Inch/Oracle.json - # Aave Contracts - - name: AaveOracleContract - file: ./abis/Prices/Aave/Oracle.json # Uniswap Contracts - name: UniswapRouter file: ./abis/Prices/Uniswap/Router.json @@ -185,16 +182,6 @@ templates: file: ./abis/Prices/Uniswap/Factory.json - name: UniswapPair file: ./abis/Prices/Uniswap/Pair.json - # SushiSwap Contracts - - name: SushiSwapRouter - file: ./abis/Prices/SushiSwap/Router.json - - name: SushiSwapFactory - file: ./abis/Prices/SushiSwap/Factory.json - - name: SushiSwapPair - file: ./abis/Prices/SushiSwap/Pair.json - - name: CalculationsSushiSwap - file: ./abis/Prices/Calculations/SushiSwap.json - eventHandlers: - event: Deposit(indexed address,uint256) handler: handleDeposit @@ -203,3 +190,21 @@ templates: - event: UpdateLiquidityLimit(indexed address,uint256,uint256,uint256,uint256) handler: handleUpdateLiquidityLimit file: ./src/mappings/gaugeMappings.ts + - kind: ethereum/contract + name: OffchainAggregator + network: {{network}} + source: + abi: AccessControlledOffchainAggregator + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + file: ./src/modules/pricing.ts + entities: + - Token + abis: + - name: AccessControlledOffchainAggregator + file: ./abis/balancer-v2/AccessControlledOffchainAggregator.json + eventHandlers: + - event: AnswerUpdated(indexed int256,indexed uint256,uint256) + handler: handleAnswerUpdated \ No newline at end of file diff --git a/subgraphs/balancer-forks/schema.graphql b/subgraphs/balancer-forks/schema.graphql index 561624f4db..0fc1f09c73 100644 --- a/subgraphs/balancer-forks/schema.graphql +++ b/subgraphs/balancer-forks/schema.graphql @@ -53,6 +53,16 @@ type Token @entity @regularPolling { " Optional field to track the block number of the last token price " lastPriceBlockNumber: BigInt + + " amount of tokens in the protocol " + _totalSupply: BigInt! + + " Total value locked in the protocol " + _totalValueLockedUSD: BigDecimal! + + _largePriceChangeBuffer: Int! + + _largeTVLImpactBuffer: Int! } enum RewardTokenType { diff --git a/subgraphs/balancer-forks/src/common/constants.mustache b/subgraphs/balancer-forks/src/common/constants.mustache index 04cd0e26d2..cd19832324 100644 --- a/subgraphs/balancer-forks/src/common/constants.mustache +++ b/subgraphs/balancer-forks/src/common/constants.mustache @@ -133,6 +133,10 @@ export const FEE_DENOMINATOR = DEFAULT_DECIMALS_DENOMINATOR; export const USDC_DECIMALS = 6; export const USDC_DENOMINATOR = BigDecimal.fromString("1000000"); + +export const MIN_POOL_LIQUIDITY = BigDecimal.fromString('2000'); +export const MIN_SWAP_VALUE_USD = BigDecimal.fromString('1'); + export const PRICE_CACHING_BLOCKS = BigInt.fromI32(7000); ///////////////////////////////////// @@ -163,5 +167,47 @@ export const BLACKLISTED_PHANTOM_POOLS: Address[] = [ Address.fromString("0x82698aecc9e28e9bb27608bd52cf57f704bd1b83"), // Balancer Aave Boosted Pool (USDC) ]; +export const USE_SWAP_BASED_PRICE_LIB = {{useSwapBasedPriceLib}}; + export const INFLATION_INTERVAL = "{{inflationInterval}}"; export const STARTING_INFLATION_RATE = BigDecimal.fromString(({{protocolTokenStartingInflationPerIntervalUnit}}).toString()).times(DEFAULT_DECIMALS_DENOMINATOR); + +class Assets { + public stableAssets: Address[]; + public pricingAssets: Address[]; + public fxAssets: Address[]; + public fxAggregators: Address[]; +} + +export const USDC_ADDRESS = Address.fromString('0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'); +export const DAI_ADDRESS = Address.fromString('0x6b175474e89094c44da98b954eedeac495271d0f'); +export const USDT_ADDRESS = Address.fromString('0xdac17f958d2ee523a2206206994597c13d831ec7'); + +export const assets: Assets = { + stableAssets: [ + {{#stableAssets}} + Address.fromString('{{address}}'), // {{symbol}} + {{/stableAssets}} + ], + pricingAssets: [ + {{#pricingAssets}} + Address.fromString('{{address}}'), // {{symbol}} + {{/pricingAssets}} + ], + fxAssets: [ + {{#fxAssets}} + Address.fromString('{{address}}'), // {{symbol}} + {{/fxAssets}} + ], + fxAggregators: [ + {{#fxAggregators}} + Address.fromString('{{address}}'), // {{symbol}} + {{/fxAggregators}} + ], +}; + +export const FX_AGGREGATOR_ADDRESSES = assets.fxAggregators; +export const FX_TOKEN_ADDRESSES = assets.fxAssets; + +export const USD_STABLE_ASSETS = assets.stableAssets; +export const PRICING_ASSETS = assets.stableAssets.concat(assets.pricingAssets); diff --git a/subgraphs/balancer-forks/src/common/constants.ts b/subgraphs/balancer-forks/src/common/constants.ts new file mode 100644 index 0000000000..a588d6031e --- /dev/null +++ b/subgraphs/balancer-forks/src/common/constants.ts @@ -0,0 +1,229 @@ +import { Address, BigDecimal, BigInt } from "@graphprotocol/graph-ts"; + +//////////////////////// +///// Schema Enums ///// +//////////////////////// + +// The network names corresponding to the Network enum in the schema. +// They also correspond to the ones in `dataSource.network()` after converting to lower case. +// See below for a complete list: +// https://thegraph.com/docs/en/hosted-service/what-is-hosted-service/#supported-networks-on-the-hosted-service +export namespace Network { + export const ARBITRUM_ONE = "ARBITRUM_ONE"; + export const ARWEAVE_MAINNET = "ARWEAVE_MAINNET"; + export const AVALANCHE = "AVALANCHE"; + export const BOBA = "BOBA"; + export const AURORA = "AURORA"; + export const BSC = "BSC"; // aka BNB Chain + export const CELO = "CELO"; + export const COSMOS = "COSMOS"; + export const CRONOS = "CRONOS"; + export const MAINNET = "MAINNET"; // Ethereum mainnet + export const FANTOM = "FANTOM"; + export const FUSE = "FUSE"; + export const HARMONY = "HARMONY"; + export const JUNO = "JUNO"; + export const MOONBEAM = "MOONBEAM"; + export const MOONRIVER = "MOONRIVER"; + export const NEAR_MAINNET = "NEAR_MAINNET"; + export const OPTIMISM = "OPTIMISM"; + export const OSMOSIS = "OSMOSIS"; + export const MATIC = "MATIC"; // aka Polygon + export const XDAI = "XDAI"; // aka Gnosis Chain +} + +export namespace ProtocolType { + export const EXCHANGE = "EXCHANGE"; + export const LENDING = "LENDING"; + export const YIELD = "YIELD"; + export const BRIDGE = "BRIDGE"; + export const GENERIC = "GENERIC"; +} + +export namespace LiquidityPoolFeeType { + export const FIXED_TRADING_FEE = "FIXED_TRADING_FEE"; + export const TIERED_TRADING_FEE = "TIERED_TRADING_FEE"; + export const DYNAMIC_TRADING_FEE = "DYNAMIC_TRADING_FEE"; + export const FIXED_LP_FEE = "FIXED_LP_FEE"; + export const DYNAMIC_LP_FEE = "DYNAMIC_LP_FEE"; + export const FIXED_PROTOCOL_FEE = "FIXED_PROTOCOL_FEE"; + export const DYNAMIC_PROTOCOL_FEE = "DYNAMIC_PROTOCOL_FEE"; +} + +export namespace RewardTokenType { + export const DEPOSIT = "DEPOSIT"; + export const BORROW = "BORROW"; +} + +export namespace LendingType { + export const CDP = "CDP"; + export const POOLED = "POOLED"; +} + +export namespace RiskType { + export const GLOBAL = "GLOBAL"; + export const ISOLATED = "ISOLATED"; +} + +export namespace InterestRateType { + export const STABLE = "STABLE"; + export const VARIABLE = "VARIABLE"; + export const FIXED_TERM = "FIXED_TERM"; +} + +export namespace InterestRateSide { + export const LENDER = "LENDER"; + export const BORROWER = "BORROWER"; +} + +export namespace UsageType { + export const DEPOSIT = "DEPOSIT"; + export const WITHDRAW = "WITHDRAW"; + export const SWAP = "SWAP"; +} + +export namespace RewardIntervalType { + export const BLOCK = "BLOCK"; + export const TIMESTAMP = "TIMESTAMP"; +} + +export namespace NULL { + export const TYPE_STRING = "0x0000000000000000000000000000000000000000"; + export const TYPE_ADDRESS = Address.fromString(TYPE_STRING); +} + +export namespace Protocol { + export const NAME = "Balancer v2"; + export const SLUG = "balancer-v2"; + export const NETWORK = Network.MAINNET; +} + +export namespace MasterChef { + export const MINICHEF = "MINICHEF"; + export const MASTERCHEF = "MASTERCHEF"; + export const MASTERCHEFV2 = "MASTERCHEFV2"; + export const MASTERCHEFV3 = "MASTERCHEFV3"; +} + +export const SECONDS_PER_HOUR = 60 * 60; +export const SECONDS_PER_DAY = 60 * 60 * 24; +export const MAX_BPS = BigInt.fromI32(10000); +export const DEFAULT_DECIMALS = BigInt.fromI32(18); + +export const INT_ZERO = 0 as i32; +export const INT_ONE = 1 as i32; + +export const BIGINT_NEG_ONE = BigInt.fromI32(-1); +export const BIGINT_ZERO = BigInt.fromI32(0); +export const BIGINT_ONE = BigInt.fromI32(1); +export const BIGINT_TEN = BigInt.fromI32(10); +export const BIGINT_HUNDRED = BigInt.fromI32(100); +export const BIGINT_NEGATIVE_ONE = BigInt.fromString("-1"); + +export const BIGDECIMAL_ZERO = new BigDecimal(BIGINT_ZERO); +export const BIGDECIMAL_ONE = new BigDecimal(BIGINT_ONE); +export const BIGDECIMAL_TEN = new BigDecimal(BIGINT_TEN); +export const BIGDECIMAL_HUNDRED = BigDecimal.fromString("100"); +export const BIGDECIMAL_NEGATIVE_ONE = BigDecimal.fromString("-1"); +export const BIGDECIMAL_POINT_FOUR = BigDecimal.fromString("0.4"); + +export const DEFAULT_DECIMALS_DENOMINATOR = BigDecimal.fromString("1000000000000000000"); +export const FEE_DENOMINATOR = DEFAULT_DECIMALS_DENOMINATOR; + +export const USDC_DECIMALS = 6; +export const USDC_DENOMINATOR = BigDecimal.fromString("1000000"); + + +export const MIN_POOL_LIQUIDITY = BigDecimal.fromString('2000'); +export const MIN_SWAP_VALUE_USD = BigDecimal.fromString('1'); + +export const PRICE_CACHING_BLOCKS = BigInt.fromI32(7000); + +///////////////////////////////////// +///// Protocol/Network Specific ///// +///////////////////////////////////// + +export const VAULT_ADDRESS = Address.fromString( + "0xBA12222222228d8Ba445958a75a0704d566BF2C8" +); +export const PROTOCOL_FEES_COLLECTOR_ADDRESS = Address.fromString( + "0xce88686553686DA562CE7Cea497CE749DA109f9F" +); +export const PROTOCOL_TOKEN_ADDRESS = Address.fromString( + "0xba100000625a3754423978a60c9317c58a424e3D" +); +export const GAUGE_CONTROLLER_ADDRESS = Address.fromString( + "0xC128468b7Ce63eA702C1f104D55A2566b13D3ABD" +); +export const AAVE_BOOSTED_POOL_ADDRESS = Address.fromString( + "0x7b50775383d3d6f0215a8f290f2c9e2eebbeceb2" +); +export const BLACKLISTED_PHANTOM_POOLS: Address[] = [ + Address.fromString("0x2bbf681cc4eb09218bee85ea2a5d3d13fa40fc0c"), // Balancer Aave Boosted Pool (USDT) OLD + Address.fromString("0x804cdb9116a10bb78768d3252355a1b18067bf8f"), // Balancer Aave Boosted Pool (DAI) OLD + Address.fromString("0x9210f1204b5a24742eba12f710636d76240df3d0"), // Balancer Aave Boosted Pool (USDC) OLD + Address.fromString("0x2f4eb100552ef93840d5adc30560e5513dfffacb"), // Balancer Aave Boosted Pool (USDT) + Address.fromString("0xae37d54ae477268b9997d4161b96b8200755935c"), // Balancer Aave Boosted Pool (DAI) + Address.fromString("0x82698aecc9e28e9bb27608bd52cf57f704bd1b83"), // Balancer Aave Boosted Pool (USDC) +]; + +export const USE_SWAP_BASED_PRICE_LIB = false; + +export const INFLATION_INTERVAL = "TIMESTAMP"; +export const STARTING_INFLATION_RATE = BigDecimal.fromString((0.23974867724).toString()).times(DEFAULT_DECIMALS_DENOMINATOR); + +class Assets { + public stableAssets: Address[]; + public pricingAssets: Address[]; + public fxAssets: Address[]; + public fxAggregators: Address[]; +} + +export const USDC_ADDRESS = Address.fromString('0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'); +export const DAI_ADDRESS = Address.fromString('0x6b175474e89094c44da98b954eedeac495271d0f'); +export const USDT_ADDRESS = Address.fromString('0xdac17f958d2ee523a2206206994597c13d831ec7'); + +export const assets: Assets = { + stableAssets: [ + Address.fromString('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'), // USDC + Address.fromString('0x6B175474E89094C44Da98b954EedeAC495271d0F'), // DAI + Address.fromString('0xdAC17F958D2ee523a2206206994597C13D831ec7'), // USDT + ], + pricingAssets: [ + Address.fromString('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'), // WETH + Address.fromString('0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0'), // wstETH + Address.fromString('0x804CdB9116a10bB78768D3252355a1b18067bF8f'), // bb-a-DAI-V1 + Address.fromString('0x9210F1204b5a24742Eba12f710636D76240dF3d0'), // bb-a-USDC-V1 + Address.fromString('0x2BBf681cC4eb09218BEe85EA2a5d3D13Fa40fC0C'), // bb-a-USDT-V1 + Address.fromString('0xae37D54Ae477268B9997d4161B96b8200755935c'), // bb-a-DAI-V2 + Address.fromString('0x82698aeCc9E28e9Bb27608Bd52cF57f704BD1B83'), // bb-a-USDC-V2 + Address.fromString('0x2F4eb100552ef93840d5aDC30560E5513DFfFACb'), // bb-a-USDT-V2 + Address.fromString('0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'), // WBTC + Address.fromString('0xba100000625a3754423978a60c9317c58a424e3D'), // BAL + Address.fromString('0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2'), // MKR + Address.fromString('0x6810e776880C02933D47DB1b9fc05908e5386b96'), // GNO + Address.fromString('0x5c6ee304399dbdb9c8ef030ab642b10820db8f56'), // B-80BAL-20WETH + Address.fromString('0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0'), // MATIC + Address.fromString('0xA13a9247ea42D743238089903570127DdA72fE44'), // bb-a-USD + ], + fxAssets: [ + Address.fromString('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'), // USDC + Address.fromString('0x70e8dE73cE538DA2bEEd35d14187F6959a8ecA96'), // XSGD + Address.fromString('0x6B175474E89094C44Da98b954EedeAC495271d0F'), // DAI + Address.fromString('0xdB25f211AB05b1c97D595516F45794528a807ad8'), // EURS + Address.fromString('0xD533a949740bb3306d119CC777fa900bA034cd52'), // CRV + ], + fxAggregators: [ + Address.fromString('0x789190466E21a8b78b8027866CBBDc151542A26C'), // USDC-USD + Address.fromString('0xc96129C796F03bb21AC947EfC5329CD1F560305B'), // XSGD-USD + Address.fromString('0xDEc0a100eaD1fAa37407f0Edc76033426CF90b82'), // DAI-USD + Address.fromString('0x02F878A94a1AE1B15705aCD65b5519A46fe3517e'), // EURS-USD + Address.fromString('0xb4c4a493AB6356497713A78FFA6c60FB53517c63'), // CRV-USD + ], +}; + +export const FX_AGGREGATOR_ADDRESSES = assets.fxAggregators; +export const FX_TOKEN_ADDRESSES = assets.fxAssets; + +export const USD_STABLE_ASSETS = assets.stableAssets; +export const PRICING_ASSETS = assets.stableAssets.concat(assets.pricingAssets); diff --git a/subgraphs/balancer-forks/src/common/initializers.ts b/subgraphs/balancer-forks/src/common/initializers.ts index 327e887004..269ee9d422 100644 --- a/subgraphs/balancer-forks/src/common/initializers.ts +++ b/subgraphs/balancer-forks/src/common/initializers.ts @@ -1,9 +1,9 @@ import { + Bytes, BigInt, Address, ethereum, BigDecimal, - Bytes, } from "@graphprotocol/graph-ts"; import { Token, @@ -23,6 +23,7 @@ import * as constants from "./constants"; import { getRewardsPerDay } from "./rewards"; import { getUsdPricePerToken } from "../prices"; import { ERC20 as ERC20Contract } from "../../generated/Vault/ERC20"; +import { protocolLevelPriceValidation } from "../prices/common/validation"; import { LiquidityPool as LiquidityPoolStore } from "../../generated/schema"; import { WeightedPool as WeightedPoolContract } from "../../generated/templates/WeightedPool/WeightedPool"; @@ -52,7 +53,7 @@ export function getOrCreateRewardToken( if (!rewardToken) { rewardToken = new RewardToken(address.toHexString()); - const token = getOrCreateToken(address, block.number); + const token = getOrCreateToken(address, block); rewardToken.token = token.id; rewardToken.type = RewardTokenType; @@ -126,7 +127,11 @@ export function getOrCreateDexAmmProtocol(): DexAmmProtocol { return protocol; } -export function getOrCreateToken(address: Address, blockNumber: BigInt): Token { +export function getOrCreateToken( + address: Address, + block: ethereum.Block, + fetchlatestPrice: boolean = false +): Token { let token = Token.load(address.toHexString()); if (!token) { @@ -140,23 +145,34 @@ export function getOrCreateToken(address: Address, blockNumber: BigInt): Token { .readValue(contract.try_decimals(), constants.BIGINT_ZERO) .toI32(); - const tokenPrice = getUsdPricePerToken(address); - token.lastPriceUSD = tokenPrice.usdPrice.div(tokenPrice.decimalsBaseTen); - token.lastPriceBlockNumber = blockNumber; + token.lastPriceUSD = constants.BIGDECIMAL_ZERO; + token._totalSupply = constants.BIGINT_ZERO; + token._totalValueLockedUSD = constants.BIGDECIMAL_ZERO; + token._largePriceChangeBuffer = 0; + token._largeTVLImpactBuffer = 0; + + if (constants.assets.stableAssets.includes(address)) + token.lastPriceUSD = constants.BIGDECIMAL_ONE; + + token.lastPriceBlockNumber = block.number; token.save(); } + if (constants.USE_SWAP_BASED_PRICE_LIB) return token; + if ( + fetchlatestPrice || !token.lastPriceUSD || !token.lastPriceBlockNumber || - blockNumber + block.number .minus(token.lastPriceBlockNumber!) .gt(constants.PRICE_CACHING_BLOCKS) ) { - const tokenPrice = getUsdPricePerToken(address); - token.lastPriceUSD = tokenPrice.usdPrice.div(tokenPrice.decimalsBaseTen); - token.lastPriceBlockNumber = blockNumber; + const tokenPrice = getUsdPricePerToken(address, block); + const latestPrice = tokenPrice.usdPrice; + token.lastPriceUSD = protocolLevelPriceValidation(token, latestPrice); + token.lastPriceBlockNumber = block.number; token.save(); } @@ -388,13 +404,10 @@ export function getOrCreateLiquidityPool( pool.symbol = utils.readValue(poolContract.try_symbol(), ""); pool.protocol = constants.VAULT_ADDRESS.toHexString(); - const poolId = utils.readValue( - poolContract.try_getPoolId(), - Bytes.empty() - ); + const poolId = utils.getPoolId(poolAddress); pool._poolId = poolId.toHexString(); - const inputTokensInfo = utils.getPoolTokensInfo(poolId); + const inputTokensInfo = utils.getPoolTokensInfo(poolAddress, poolId); pool.inputTokens = inputTokensInfo.getInputTokens; pool.inputTokenBalances = inputTokensInfo.getBalances; pool.inputTokenWeights = utils.getPoolTokenWeights( @@ -402,7 +415,8 @@ export function getOrCreateLiquidityPool( pool.inputTokens ); - pool.outputToken = getOrCreateToken(poolAddress, block.number).id; + pool.outputToken = getOrCreateToken(poolAddress, block).id; + pool.outputTokenSupply = constants.BIGINT_ZERO; pool.outputTokenPriceUSD = constants.BIGDECIMAL_ZERO; @@ -410,7 +424,7 @@ export function getOrCreateLiquidityPool( pool.rewardTokenEmissionsAmount = []; pool.rewardTokenEmissionsUSD = []; - pool.fees = utils.getPoolFees(poolAddress).stringIds(); + pool.fees = utils.calculatePoolFees(poolAddress).stringIds(); pool.isSingleSided = false; pool.createdBlockNumber = block.number; diff --git a/subgraphs/balancer-forks/src/common/masterchef/helpers.ts b/subgraphs/balancer-forks/src/common/masterchef/helpers.ts index 226ed2b35e..75b9d2910c 100644 --- a/subgraphs/balancer-forks/src/common/masterchef/helpers.ts +++ b/subgraphs/balancer-forks/src/common/masterchef/helpers.ts @@ -26,7 +26,7 @@ export function createMasterChefStakingPool( const pool = LiquidityPool.load(masterChefPool.poolAddress!); if (pool) { pool.rewardTokens = [ - getOrCreateToken(constants.PROTOCOL_TOKEN_ADDRESS, event.block.number).id, + getOrCreateToken(constants.PROTOCOL_TOKEN_ADDRESS, event.block).id, ]; pool.save(); } diff --git a/subgraphs/balancer-forks/src/common/types.ts b/subgraphs/balancer-forks/src/common/types.ts index 6ef73fe404..64c02e9d3a 100644 --- a/subgraphs/balancer-forks/src/common/types.ts +++ b/subgraphs/balancer-forks/src/common/types.ts @@ -66,10 +66,16 @@ export class PoolFeesType { } export class PoolTokensType { + private _poolAddress: Address; private _tokens: Address[]; private _balances: BigInt[]; - constructor(tokens: Address[] = [], balances: BigInt[] = []) { + constructor( + poolAddress: Address = constants.NULL.TYPE_ADDRESS, + tokens: Address[] = [], + balances: BigInt[] = [] + ) { + this._poolAddress = poolAddress; this._tokens = tokens; this._balances = balances; } @@ -84,6 +90,14 @@ export class PoolTokensType { return inputTokens; } get getBalances(): BigInt[] { - return this._balances; + const inputTokenBalances: BigInt[] = []; + + for (let idx = 0; idx < this._tokens.length; idx++) { + if (this._tokens.at(idx).equals(this._poolAddress)) continue; + + inputTokenBalances.push(this._balances.at(idx)); + } + + return inputTokenBalances; } } diff --git a/subgraphs/balancer-forks/src/common/utils.ts b/subgraphs/balancer-forks/src/common/utils.ts index 792252d63e..35d4660c64 100644 --- a/subgraphs/balancer-forks/src/common/utils.ts +++ b/subgraphs/balancer-forks/src/common/utils.ts @@ -1,4 +1,5 @@ import { + log, Bytes, BigInt, Address, @@ -12,8 +13,8 @@ import { getOrCreateLiquidityPoolFee, } from "./initializers"; import * as constants from "../common/constants"; +import { LiquidityPool } from "../../generated/schema"; import { PoolFeesType, PoolTokensType } from "./types"; -import { Token, LiquidityPool } from "../../generated/schema"; import { Vault as VaultContract } from "../../generated/Vault/Vault"; import { ERC20 as ERC20Contract } from "../../generated/Vault/ERC20"; import { WeightedPool as WeightedPoolContract } from "../../generated/templates/WeightedPool/WeightedPool"; @@ -27,6 +28,34 @@ export function prefixID(enumString: string, ID: string): string { return enumToPrefix(enumString) + ID; } +export function calculateAverage(prices: BigDecimal[]): BigDecimal { + let sum = BigDecimal.fromString("0"); + for (let i = 0; i < prices.length; i++) { + sum = sum.plus(prices[i]); + } + + return sum.div( + BigDecimal.fromString(BigInt.fromI32(prices.length).toString()) + ); +} + +export function exponentToBigDecimal(decimals: i32): BigDecimal { + return constants.BIGINT_TEN.pow(decimals as u8).toBigDecimal(); +} + +export function convertTokenToDecimal( + tokenAmount: BigInt, + exchangeDecimals: i32 +): BigDecimal { + if (exchangeDecimals == constants.INT_ZERO) return tokenAmount.toBigDecimal(); + + return tokenAmount.toBigDecimal().div(exponentToBigDecimal(exchangeDecimals)); +} + +export function roundToWholeNumber(n: BigDecimal): BigDecimal { + return n.truncate(0); +} + export function readValue( callResult: ethereum.CallResult, defaultValue: T @@ -34,13 +63,6 @@ export function readValue( return callResult.reverted ? defaultValue : callResult.value; } -export function getOrCreateTokenFromString( - tokenAddress: string, - blockNumber: BigInt -): Token { - return getOrCreateToken(Address.fromString(tokenAddress), blockNumber); -} - export function getTokenDecimals(tokenAddr: Address): BigDecimal { const token = ERC20Contract.bind(tokenAddr); @@ -49,19 +71,7 @@ export function getTokenDecimals(tokenAddr: Address): BigDecimal { constants.DEFAULT_DECIMALS ); - return constants.BIGINT_TEN.pow(decimals.toI32() as u8).toBigDecimal(); -} - -export function getPoolTokensInfo(poolId: Bytes): PoolTokensType { - const vaultContract = VaultContract.bind(constants.VAULT_ADDRESS); - - const poolTokens = vaultContract.try_getPoolTokens(poolId); - if (poolTokens.reverted) return new PoolTokensType(); - - return new PoolTokensType( - poolTokens.value.getTokens(), - poolTokens.value.getBalances() - ); + return exponentToBigDecimal(decimals.toI32()); } export function getOutputTokenPriceUSD( @@ -73,47 +83,49 @@ export function getOutputTokenPriceUSD( if (pool.outputTokenSupply!.equals(constants.BIGINT_ZERO)) return constants.BIGDECIMAL_ZERO; - const outputToken = getOrCreateToken(poolAddress, block.number); + const outputToken = getOrCreateToken(poolAddress, block); const outputTokenSupply = pool.outputTokenSupply!.divDecimal( - constants.BIGINT_TEN.pow(outputToken.decimals as u8).toBigDecimal() + exponentToBigDecimal(outputToken.decimals) ); const outputTokenPriceUSD = pool.totalValueLockedUSD.div(outputTokenSupply); return outputTokenPriceUSD; } -export function calculateAverage(prices: BigDecimal[]): BigDecimal { - let sum = BigDecimal.fromString("0"); - for (let i = 0; i < prices.length; i++) { - sum = sum.plus(prices[i]); - } +export function getPoolId(poolAddress: Address): Bytes { + const poolContract = WeightedPoolContract.bind(poolAddress); - return sum.div( - BigDecimal.fromString(BigInt.fromI32(prices.length).toString()) - ); + let poolId = readValue(poolContract.try_getPoolId(), Bytes.empty()); + if (poolId.notEqual(Bytes.empty())) return poolId; + + poolId = readValue(poolContract.try_POOL_ID(), Bytes.empty()); + + return poolId; } -export function getPoolInputTokenBalances( +export function getPoolTokensInfo( poolAddress: Address, poolId: Bytes -): BigInt[] { - const poolContract = WeightedPoolContract.bind(poolAddress); - const poolTokensInfo = getPoolTokensInfo(poolId); +): PoolTokensType { + const vaultContract = VaultContract.bind(constants.VAULT_ADDRESS); - const poolBalances = poolTokensInfo.getBalances; + const poolTokens = vaultContract.try_getPoolTokens(poolId); + if (poolTokens.reverted) return new PoolTokensType(); - const bptTokenIndex = readValue( - poolContract.try_getBptIndex(), - constants.BIGINT_NEG_ONE + return new PoolTokensType( + poolAddress, + poolTokens.value.getTokens(), + poolTokens.value.getBalances() ); +} - if (bptTokenIndex != constants.BIGINT_NEG_ONE) { - poolBalances.splice( - bptTokenIndex.toI32() as u8, - constants.BIGINT_ONE.toI32() as u8 - ); - } +export function getPoolInputTokenBalances( + poolAddress: Address, + poolId: Bytes +): BigInt[] { + const poolTokensInfo = getPoolTokensInfo(poolAddress, poolId); + const poolBalances = poolTokensInfo.getBalances; return poolBalances; } @@ -155,7 +167,7 @@ export function getPoolScalingFactors( return scales; } -export function getPoolTokenWeightsForDynamicWeightPools( +export function getWeightsForDynamicWeightPools( poolAddress: Address, inputTokens: string[] ): BigDecimal[] { @@ -180,7 +192,7 @@ export function getPoolTokenWeightsForDynamicWeightPools( return inputTokenWeights; } -export function getPoolTokenWeightsForNormalizedPools( +export function getWeightsForNormalizedPools( poolAddress: Address ): BigDecimal[] { const poolContract = WeightedPoolContract.bind(poolAddress); @@ -193,13 +205,8 @@ export function getPoolTokenWeightsForNormalizedPools( const inputTokenWeights: BigDecimal[] = []; for (let idx = 0; idx < weights.length; idx++) { inputTokenWeights.push( - weights - .at(idx) - .divDecimal( - constants.BIGINT_TEN.pow( - constants.DEFAULT_DECIMALS.toI32() as u8 - ).toBigDecimal() - ) + weights[idx] + .divDecimal(exponentToBigDecimal(constants.DEFAULT_DECIMALS.toI32())) .times(constants.BIGDECIMAL_HUNDRED) ); } @@ -211,36 +218,39 @@ export function getPoolTokenWeights( poolAddress: Address, inputTokens: string[] ): BigDecimal[] { - let inputTokenWeights = getPoolTokenWeightsForNormalizedPools(poolAddress); + let inputTokenWeights = getWeightsForNormalizedPools(poolAddress); if (inputTokenWeights.length > 0) return inputTokenWeights; - inputTokenWeights = getPoolTokenWeightsForDynamicWeightPools( - poolAddress, - inputTokens - ); - + inputTokenWeights = getWeightsForDynamicWeightPools(poolAddress, inputTokens); return inputTokenWeights; } export function getPoolTVL( + poolAddress: Address, inputTokens: string[], inputTokenBalances: BigInt[], block: ethereum.Block ): BigDecimal { let totalValueLockedUSD = constants.BIGDECIMAL_ZERO; + if (inputTokens.length > inputTokenBalances.length) { + log.warning("[poolTVL] missing input token balances for pool: {}", [ + poolAddress.toHexString(), + ]); + + return totalValueLockedUSD; + } + for (let idx = 0; idx < inputTokens.length; idx++) { const inputTokenBalance = inputTokenBalances[idx]; - const inputToken = getOrCreateTokenFromString( - inputTokens[idx], - block.number + const inputToken = getOrCreateToken( + Address.fromString(inputTokens[idx]), + block ); const amountUSD = inputTokenBalance - .divDecimal( - constants.BIGINT_TEN.pow(inputToken.decimals as u8).toBigDecimal() - ) + .divDecimal(exponentToBigDecimal(inputToken.decimals)) .times(inputToken.lastPriceUSD!); totalValueLockedUSD = totalValueLockedUSD.plus(amountUSD); } @@ -275,7 +285,7 @@ export function getOutputTokenSupply( return totalSupply; } -export function getPoolFees(poolAddress: Address): PoolFeesType { +export function calculatePoolFees(poolAddress: Address): PoolFeesType { const poolContract = WeightedPoolContract.bind(poolAddress); const swapFee = readValue( @@ -322,6 +332,34 @@ export function getPoolFees(poolAddress: Address): PoolFeesType { return new PoolFeesType(tradingFee, protocolFee, lpFee); } +export function getPoolFees(poolAddress: Address): PoolFeesType { + const tradingFeeId = + enumToPrefix(constants.LiquidityPoolFeeType.FIXED_TRADING_FEE) + + poolAddress.toHexString(); + const tradingFee = getOrCreateLiquidityPoolFee( + tradingFeeId, + constants.LiquidityPoolFeeType.FIXED_TRADING_FEE + ); + + const protocolFeeId = + enumToPrefix(constants.LiquidityPoolFeeType.FIXED_PROTOCOL_FEE) + + poolAddress.toHexString(); + const protocolFee = getOrCreateLiquidityPoolFee( + protocolFeeId, + constants.LiquidityPoolFeeType.FIXED_PROTOCOL_FEE + ); + + const lpFeeId = + enumToPrefix(constants.LiquidityPoolFeeType.FIXED_LP_FEE) + + poolAddress.toHexString(); + const lpFee = getOrCreateLiquidityPoolFee( + lpFeeId, + constants.LiquidityPoolFeeType.FIXED_LP_FEE + ); + + return new PoolFeesType(tradingFee, protocolFee, lpFee); +} + export function updateProtocolTotalValueLockedUSD(): void { const protocol = getOrCreateDexAmmProtocol(); @@ -354,39 +392,9 @@ export function updateProtocolAfterNewLiquidityPool( const poolIds = protocol._poolIds; poolIds.push(poolAddress.toHexString()); - protocol._poolIds = poolIds; + protocol._poolIds = poolIds; protocol.totalPoolCount += 1; protocol.save(); } - -// convert decimals -export function exponentToBigDecimal(decimals: i32): BigDecimal { - let bd = constants.BIGDECIMAL_ONE; - for ( - let i = constants.INT_ZERO; - i < (decimals as i32); - i = i + constants.INT_ONE - ) { - bd = bd.times(constants.BIGDECIMAL_TEN); - } - return bd; -} - -// convert emitted values to tokens count -export function convertTokenToDecimal( - tokenAmount: BigInt, - exchangeDecimals: i32 -): BigDecimal { - if (exchangeDecimals == constants.INT_ZERO) { - return tokenAmount.toBigDecimal(); - } - - return tokenAmount.toBigDecimal().div(exponentToBigDecimal(exchangeDecimals)); -} - -// Round BigDecimal to whole number -export function roundToWholeNumber(n: BigDecimal): BigDecimal { - return n.truncate(0); -} diff --git a/subgraphs/balancer-forks/src/mappings/poolMappings.ts b/subgraphs/balancer-forks/src/mappings/poolMappings.ts index d026043b7b..ff7a33d53e 100644 --- a/subgraphs/balancer-forks/src/mappings/poolMappings.ts +++ b/subgraphs/balancer-forks/src/mappings/poolMappings.ts @@ -1,12 +1,12 @@ import { log } from "@graphprotocol/graph-ts"; -import { getPoolFees } from "../common/utils"; +import { calculatePoolFees } from "../common/utils"; import { SwapFeePercentageChanged } from "../../generated/templates/WeightedPool/WeightedPool"; export function handleSwapFeePercentageChanged( event: SwapFeePercentageChanged ): void { const poolAddress = event.address; - const fees = getPoolFees(poolAddress); + const fees = calculatePoolFees(poolAddress); log.warning( "[Pool:SwapFeeChanged] Pool: {}, TradingFees: {}, ProtocolFees: {}, LpFee: {}, Txn: {}", diff --git a/subgraphs/balancer-forks/src/mappings/vaultMappings.ts b/subgraphs/balancer-forks/src/mappings/vaultMappings.ts index 9d06f738cb..7b9f00abe4 100644 --- a/subgraphs/balancer-forks/src/mappings/vaultMappings.ts +++ b/subgraphs/balancer-forks/src/mappings/vaultMappings.ts @@ -47,7 +47,7 @@ export function handleTokensRegistered(event: TokensRegistered): void { // Exception: StablePoolFactory added poolAddress in event params token if (tokens.at(idx).equals(poolAddress)) continue; - inputTokens.push(getOrCreateToken(tokens.at(idx), event.block.number).id); + inputTokens.push(getOrCreateToken(tokens.at(idx), event.block).id); } pool.inputTokens = inputTokens; @@ -74,7 +74,7 @@ export function handlePoolBalanceChanged(event: PoolBalanceChanged): void { const total: BigInt = deltas.reduce( (sum, amount) => sum.plus(amount), - new BigInt(0) + constants.BIGINT_ZERO ); if (total.gt(constants.BIGINT_ZERO)) { diff --git a/subgraphs/balancer-forks/src/modules/Deposit.ts b/subgraphs/balancer-forks/src/modules/Deposit.ts index 9aa248b602..3242569435 100644 --- a/subgraphs/balancer-forks/src/modules/Deposit.ts +++ b/subgraphs/balancer-forks/src/modules/Deposit.ts @@ -95,23 +95,22 @@ export function Deposit( const inputTokenBalances = pool.inputTokenBalances; let depositAmountUSD = constants.BIGDECIMAL_ZERO; - for (let idx = 0; idx < depositedCoinAmounts.length; idx++) { - if (inputTokens.at(idx).equals(poolAddress)) continue; - - const inputToken = getOrCreateToken(inputTokens.at(idx), block.number); + for (let i = 0; i < pool.inputTokens.length; i++) { + const tokenIdx = inputTokens.indexOf( + Address.fromString(pool.inputTokens[i]) + ); + if (tokenIdx == -1) continue; - const inputTokenIndex = pool.inputTokens.indexOf(inputToken.id); - inputTokenBalances[inputTokenIndex] = inputTokenBalances[ - inputTokenIndex - ].plus(depositedCoinAmounts[idx].minus(fees[idx])); + const inputToken = getOrCreateToken(inputTokens[tokenIdx], block); - inputTokenAmounts.push(depositedCoinAmounts[idx]); + inputTokenBalances[i] = inputTokenBalances[i].plus( + depositedCoinAmounts[tokenIdx].minus(fees[tokenIdx]) + ); + inputTokenAmounts.push(depositedCoinAmounts[tokenIdx]); depositAmountUSD = depositAmountUSD.plus( - depositedCoinAmounts[idx] - .divDecimal( - constants.BIGINT_TEN.pow(inputToken.decimals as u8).toBigDecimal() - ) + depositedCoinAmounts[tokenIdx] + .divDecimal(utils.exponentToBigDecimal(inputToken.decimals)) .times(inputToken.lastPriceUSD!) ); } @@ -124,22 +123,21 @@ export function Deposit( pool.outputTokenSupply! ); - pool.inputTokenBalances = inputTokenBalances; pool.totalValueLockedUSD = utils.getPoolTVL( + poolAddress, pool.inputTokens, - pool.inputTokenBalances, + inputTokenBalances, block ); - const inputTokenWeights = utils.getPoolTokenWeightsForDynamicWeightPools( + + pool.inputTokenWeights = utils.getPoolTokenWeights( poolAddress, pool.inputTokens ); - if (inputTokenWeights.length > 0) { - pool.inputTokenWeights = inputTokenWeights; - } - pool.outputTokenSupply = totalSupplyAfterDeposit; pool.outputTokenPriceUSD = utils.getOutputTokenPriceUSD(poolAddress, block); + pool.outputTokenSupply = totalSupplyAfterDeposit; + pool.inputTokenBalances = inputTokenBalances; pool.save(); createDepositTransaction( diff --git a/subgraphs/balancer-forks/src/modules/Metrics.ts b/subgraphs/balancer-forks/src/modules/Metrics.ts index 3d3545ad88..6dadd2cfc4 100644 --- a/subgraphs/balancer-forks/src/modules/Metrics.ts +++ b/subgraphs/balancer-forks/src/modules/Metrics.ts @@ -1,4 +1,3 @@ -import { BigInt, Address, ethereum, BigDecimal } from "@graphprotocol/graph-ts"; import { ActiveAccount, LiquidityPool as LiquidityPoolStore, @@ -16,6 +15,7 @@ import { import * as utils from "../common/utils"; import * as constants from "../common/constants"; import { updateRevenueSnapshots } from "./Revenue"; +import { BigInt, Address, ethereum, BigDecimal } from "@graphprotocol/graph-ts"; export function updateUsageMetrics(block: ethereum.Block, from: Address): void { getOrCreateAccount(from.toHexString()); diff --git a/subgraphs/balancer-forks/src/modules/Pricing.ts b/subgraphs/balancer-forks/src/modules/Pricing.ts new file mode 100644 index 0000000000..1d4840f8e9 --- /dev/null +++ b/subgraphs/balancer-forks/src/modules/Pricing.ts @@ -0,0 +1,196 @@ +import { + Token, + LiquidityPool as LiquidityPoolStore, +} from "../../generated/schema"; +import * as utils from "../common/utils"; +import * as constants from "../common/constants"; +import { getOrCreateToken } from "../common/initializers"; +import { Address, BigDecimal, BigInt, ethereum } from "@graphprotocol/graph-ts"; +import { AnswerUpdated } from "../../generated/templates/OffchainAggregator/AccessControlledOffchainAggregator"; + +export function handleAnswerUpdated(event: AnswerUpdated): void { + let tokenAddress = constants.NULL.TYPE_ADDRESS; + + for (let i = 0; i < constants.assets.fxAggregators.length; i++) { + if (event.address == constants.assets.fxAggregators[i]) { + tokenAddress = constants.assets.fxAssets[i]; + break; + } + } + if (tokenAddress == constants.NULL.TYPE_ADDRESS) return; + + const token = getOrCreateToken(tokenAddress, event.block); + token.lastPriceUSD = event.params.current.divDecimal( + constants.BIGINT_TEN.pow(8).toBigDecimal() + ); + token.save(); +} + +export function isUSDStable(tokenAddress: Address): bool { + return constants.USD_STABLE_ASSETS.includes(tokenAddress); +} + +export function isPricingAsset(tokenAddress: Address): bool { + return constants.PRICING_ASSETS.includes(tokenAddress); +} + +export function valueInUSD(value: BigDecimal, asset: Token): BigDecimal { + let usdValue = constants.BIGDECIMAL_ZERO; + + if (isUSDStable(Address.fromString(asset.id))) { + usdValue = value; + } else { + if (asset.lastPriceUSD) usdValue = value.times(asset.lastPriceUSD!); + } + + return usdValue; +} + +export function swapValueInUSD( + tokenInAddress: Address, + tokenAmountIn: BigInt, + tokenOutAddress: Address, + tokenAmountOut: BigInt, + block: ethereum.Block +): BigDecimal { + const tokenIn = getOrCreateToken(tokenInAddress, block); + const tokenOut = getOrCreateToken(tokenOutAddress, block); + + const tokenAmountInBD = tokenAmountIn.divDecimal( + utils.exponentToBigDecimal(tokenIn.decimals) + ); + const tokenAmountOutBD = tokenAmountOut.divDecimal( + utils.exponentToBigDecimal(tokenOut.decimals) + ); + + let swapValueUSD = constants.BIGDECIMAL_ZERO; + + if (isUSDStable(tokenOutAddress)) { + swapValueUSD = valueInUSD(tokenAmountOutBD, tokenOut); + } else if (isUSDStable(tokenInAddress)) { + swapValueUSD = valueInUSD(tokenAmountInBD, tokenIn); + } else if ( + isPricingAsset(tokenInAddress) && + !isPricingAsset(tokenOutAddress) + ) { + swapValueUSD = valueInUSD(tokenAmountInBD, tokenIn); + } else if ( + isPricingAsset(tokenOutAddress) && + !isPricingAsset(tokenInAddress) + ) { + swapValueUSD = valueInUSD(tokenAmountOutBD, tokenOut); + } else { + const tokenInSwapValueUSD = valueInUSD(tokenAmountInBD, tokenIn); + const tokenOutSwapValueUSD = valueInUSD(tokenAmountOutBD, tokenOut); + + const denominator = + tokenInSwapValueUSD.gt(constants.BIGDECIMAL_ZERO) && + tokenOutSwapValueUSD.gt(constants.BIGDECIMAL_ZERO) + ? BigDecimal.fromString("2") + : constants.BIGDECIMAL_ONE; + + swapValueUSD = tokenInSwapValueUSD + .plus(tokenOutSwapValueUSD) + .div(denominator); + } + + return swapValueUSD; +} + +export function updateTokenPrices( + pool: LiquidityPoolStore, + tokenInAddress: Address, + tokenInAmount: BigInt, + tokenOutAddress: Address, + tokenOutAmount: BigInt, + volumeUSD: BigDecimal, + block: ethereum.Block +): void { + if (!constants.USE_SWAP_BASED_PRICE_LIB) return; + + const tokenIn = getOrCreateToken(tokenInAddress, block); + const tokenOut = getOrCreateToken(tokenOutAddress, block); + + const tokenInIndex = pool.inputTokens.indexOf(tokenInAddress.toHexString()); + const tokenOutIndex = pool.inputTokens.indexOf(tokenOutAddress.toHexString()); + + if ( + tokenInIndex == -1 || + tokenOutIndex == -1 || + pool.inputTokenWeights.length < tokenInIndex || + pool.inputTokenWeights.length < tokenOutIndex + ) + return; + + const tokenInWeight = pool.inputTokenWeights + .at(tokenInIndex) + .div(constants.BIGDECIMAL_HUNDRED); + const tokenInSupply = pool.inputTokenBalances + .at(tokenInIndex) + .divDecimal(utils.exponentToBigDecimal(tokenIn.decimals)); + + const tokenOutWeight = pool.inputTokenWeights + .at(tokenOutIndex) + .div(constants.BIGDECIMAL_HUNDRED); + const tokenOutSupply = pool.inputTokenBalances + .at(tokenOutIndex) + .divDecimal(utils.exponentToBigDecimal(tokenOut.decimals)); + + if ( + isPricingAsset(tokenInAddress) && + pool.totalValueLockedUSD.gt(constants.MIN_POOL_LIQUIDITY) && + volumeUSD.gt(constants.MIN_SWAP_VALUE_USD) + ) { + let tokenPriceUSD = constants.BIGDECIMAL_ZERO; + + if ( + tokenInWeight.notEqual(constants.BIGDECIMAL_ZERO) && + tokenOutWeight.notEqual(constants.BIGDECIMAL_ZERO) && + tokenOutSupply.notEqual(constants.BIGDECIMAL_ZERO) + ) { + tokenPriceUSD = tokenInSupply + .div(tokenInWeight) + .div(tokenOutSupply.div(tokenOutWeight)); + } else { + tokenPriceUSD = tokenInAmount + .divDecimal(utils.exponentToBigDecimal(tokenIn.decimals)) + .div( + tokenOutAmount.divDecimal( + utils.exponentToBigDecimal(tokenOut.decimals) + ) + ); + } + + tokenOut.lastPriceUSD = valueInUSD(tokenPriceUSD, tokenIn); + tokenOut.lastPriceBlockNumber = block.number; + tokenOut.save(); + } + + if ( + isPricingAsset(tokenOutAddress) && + pool.totalValueLockedUSD.gt(constants.MIN_POOL_LIQUIDITY) && + volumeUSD.gt(constants.MIN_SWAP_VALUE_USD) + ) { + let tokenPriceUSD = constants.BIGDECIMAL_ZERO; + + if ( + tokenInWeight.notEqual(constants.BIGDECIMAL_ZERO) && + tokenOutWeight.notEqual(constants.BIGDECIMAL_ZERO) && + tokenInSupply.notEqual(constants.BIGDECIMAL_ZERO) + ) { + tokenPriceUSD = tokenOutSupply + .div(tokenOutWeight) + .div(tokenInSupply.div(tokenInWeight)); + } else { + tokenPriceUSD = tokenOutAmount + .divDecimal(utils.exponentToBigDecimal(tokenOut.decimals)) + .div( + tokenInAmount.divDecimal(utils.exponentToBigDecimal(tokenIn.decimals)) + ); + } + + tokenIn.lastPriceUSD = valueInUSD(tokenPriceUSD, tokenOut); + tokenIn.lastPriceBlockNumber = block.number; + tokenIn.save(); + } +} diff --git a/subgraphs/balancer-forks/src/modules/Rewards.ts b/subgraphs/balancer-forks/src/modules/Rewards.ts index 6dfdaa67e3..037ff74114 100644 --- a/subgraphs/balancer-forks/src/modules/Rewards.ts +++ b/subgraphs/balancer-forks/src/modules/Rewards.ts @@ -1,10 +1,9 @@ import { + getOrCreateToken, getOrCreateRewardToken, getOrCreateLiquidityPool, - getOrCreateToken, } from "../common/initializers"; import * as utils from "../common/utils"; -import { readValue } from "../common/utils"; import * as constants from "../common/constants"; import { RewardsInfoType } from "../common/types"; import { getRewardsPerDay } from "../common/rewards"; @@ -61,11 +60,7 @@ export function updateControllerRewards( gaugeControllerContract.try_gauge_relative_weight(gaugeAddress), constants.BIGINT_ZERO ) - .divDecimal( - constants.BIGINT_TEN.pow( - constants.DEFAULT_DECIMALS.toI32() as u8 - ).toBigDecimal() - ); + .divDecimal(utils.exponentToBigDecimal(constants.DEFAULT_DECIMALS.toI32())); // This essentially checks if the gauge is a GaugeController gauge instead of a childChainLiquidityGaugeFactory contract. if (gaugeRelativeWeight.equals(constants.BIGDECIMAL_ZERO)) { @@ -179,13 +174,11 @@ export function updateRewardTokenEmissions( } const rewardTokenEmissionsUSD = pool.rewardTokenEmissionsUSD!; - const rewardTokenPrice = getOrCreateToken(rewardTokenAddress, block.number); + const rewardTokenPrice = getOrCreateToken(rewardTokenAddress, block, true); rewardTokenEmissionsAmount[rewardTokenIndex] = rewardTokenPerDay; rewardTokenEmissionsUSD[rewardTokenIndex] = rewardTokenPerDay - .divDecimal( - constants.BIGINT_TEN.pow(rewardTokenPrice.decimals as u8).toBigDecimal() - ) + .divDecimal(utils.exponentToBigDecimal(rewardTokenPrice.decimals)) .times(rewardTokenPrice.lastPriceUSD!); pool.rewardTokenEmissionsAmount = rewardTokenEmissionsAmount; @@ -197,7 +190,7 @@ export function updateRewardTokenEmissions( export function getPoolFromGauge(gaugeAddress: Address): Address | null { const gaugeContract = LiquidityGaugeContract.bind(gaugeAddress); - const poolAddress = readValue
( + const poolAddress = utils.readValue
( gaugeContract.try_lp_token(), constants.NULL.TYPE_ADDRESS ); diff --git a/subgraphs/balancer-forks/src/modules/Swap.ts b/subgraphs/balancer-forks/src/modules/Swap.ts index 855bea3918..700bb1de47 100644 --- a/subgraphs/balancer-forks/src/modules/Swap.ts +++ b/subgraphs/balancer-forks/src/modules/Swap.ts @@ -1,16 +1,16 @@ -import { - Token, - Swap as SwapTransaction, - LiquidityPool as LiquidityPoolStore, -} from "../../generated/schema"; import { log, + Bytes, BigInt, Address, ethereum, BigDecimal, - Bytes, } from "@graphprotocol/graph-ts"; +import { + Token, + Swap as SwapTransaction, + LiquidityPool as LiquidityPoolStore, +} from "../../generated/schema"; import { updateProtocolRevenue, updateSnapshotsVolume, @@ -25,6 +25,7 @@ import { } from "../common/initializers"; import * as utils from "../common/utils"; import * as constants from "../common/constants"; +import { swapValueInUSD, updateTokenPrices } from "./Pricing"; export function createSwapTransaction( liquidityPool: LiquidityPoolStore, @@ -98,37 +99,41 @@ export function Swap( transaction: ethereum.Transaction, block: ethereum.Block ): void { - const pool = getOrCreateLiquidityPool(poolAddress, block); + if (constants.BLACKLISTED_PHANTOM_POOLS.includes(poolAddress)) + return - const tokenInStore = getOrCreateToken(tokenIn, block.number); - const tokenInIndex = pool.inputTokens.indexOf(tokenIn.toHexString()); + const pool = getOrCreateLiquidityPool(poolAddress, block); - let amountInUSD = amountIn - .divDecimal( - constants.BIGINT_TEN.pow(tokenInStore.decimals as u8).toBigDecimal() - ) + const tokenInStore = getOrCreateToken(tokenIn, block); + const amountInUSD = amountIn + .divDecimal(utils.exponentToBigDecimal(tokenInStore.decimals)) .times(tokenInStore.lastPriceUSD!); - if (tokenInIndex == -1) amountInUSD = constants.BIGDECIMAL_ZERO; - - const tokenOutStore = getOrCreateToken(tokenOut, block.number); - const tokenOutIndex = pool.inputTokens.indexOf(tokenOut.toHexString()); - - let amountOutUSD = amountOut - .divDecimal( - constants.BIGINT_TEN.pow(tokenOutStore.decimals as u8).toBigDecimal() - ) + const tokenOutStore = getOrCreateToken(tokenOut, block); + const amountOutUSD = amountOut + .divDecimal(utils.exponentToBigDecimal(tokenOutStore.decimals)) .times(tokenOutStore.lastPriceUSD!); - if (tokenOutIndex == -1) amountOutUSD = constants.BIGDECIMAL_ZERO; + const volumeUSD = constants.USE_SWAP_BASED_PRICE_LIB + ? swapValueInUSD(tokenIn, amountIn, tokenOut, amountOut, block) + : utils.calculateAverage([amountInUSD, amountOutUSD]); - const volumeUSD = utils.calculateAverage([amountInUSD, amountOutUSD]); + updateTokenPrices( + pool, + tokenIn, + amountIn, + tokenOut, + amountOut, + volumeUSD, + block + ); pool.inputTokenBalances = utils.getPoolInputTokenBalances( poolAddress, Bytes.fromHexString(pool._poolId) ); pool.totalValueLockedUSD = utils.getPoolTVL( + poolAddress, pool.inputTokens, pool.inputTokenBalances, block diff --git a/subgraphs/balancer-forks/src/modules/Withdraw.ts b/subgraphs/balancer-forks/src/modules/Withdraw.ts index 8635c85921..5bf76900ad 100644 --- a/subgraphs/balancer-forks/src/modules/Withdraw.ts +++ b/subgraphs/balancer-forks/src/modules/Withdraw.ts @@ -1,7 +1,3 @@ -import { - Withdraw as WithdrawTransaction, - LiquidityPool as LiquidityPoolStore, -} from "../../generated/schema"; import { log, BigInt, @@ -10,11 +6,15 @@ import { BigDecimal, } from "@graphprotocol/graph-ts"; import { - getOrCreateToken, + Withdraw as WithdrawTransaction, + LiquidityPool as LiquidityPoolStore, +} from "../../generated/schema"; +import { getOrCreateLiquidityPool, getOrCreateDexAmmProtocol, getOrCreateUsageMetricsDailySnapshot, getOrCreateUsageMetricsHourlySnapshot, + getOrCreateToken, } from "../common/initializers"; import * as utils from "../common/utils"; import * as constants from "../common/constants"; @@ -100,23 +100,22 @@ export function Withdraw( const inputTokenBalances = pool.inputTokenBalances; let withdrawAmountUSD = constants.BIGDECIMAL_ZERO; - for (let idx = 0; idx < withdrawnTokenAmounts.length; idx++) { - if (inputTokens.at(idx).equals(poolAddress)) continue; - - const inputToken = getOrCreateToken(inputTokens.at(idx), block.number); - const inputTokenIndex = pool.inputTokens.indexOf(inputToken.id); + for (let i = 0; i < pool.inputTokens.length; i++) { + const tokenIdx = inputTokens.indexOf( + Address.fromString(pool.inputTokens[i]) + ); + if (tokenIdx == -1) continue; - inputTokenBalances[inputTokenIndex] = inputTokenBalances[ - inputTokenIndex - ].minus(withdrawnTokenAmounts[idx].minus(fees[idx])); + const inputToken = getOrCreateToken(inputTokens[tokenIdx], block); - inputTokenAmounts.push(withdrawnTokenAmounts[idx]); + inputTokenBalances[i] = inputTokenBalances[i].minus( + withdrawnTokenAmounts[tokenIdx].minus(fees[tokenIdx]) + ); + inputTokenAmounts.push(withdrawnTokenAmounts[tokenIdx]); withdrawAmountUSD = withdrawAmountUSD.plus( - withdrawnTokenAmounts[idx] - .divDecimal( - constants.BIGINT_TEN.pow(inputToken.decimals as u8).toBigDecimal() - ) + withdrawnTokenAmounts[tokenIdx] + .divDecimal(utils.exponentToBigDecimal(inputToken.decimals)) .times(inputToken.lastPriceUSD!) ); } @@ -129,18 +128,21 @@ export function Withdraw( tokenSupplyAfterWithdrawal ); - pool.inputTokenBalances = inputTokenBalances; pool.totalValueLockedUSD = utils.getPoolTVL( + poolAddress, pool.inputTokens, - pool.inputTokenBalances, + inputTokenBalances, block ); + pool.inputTokenWeights = utils.getPoolTokenWeights( poolAddress, pool.inputTokens ); - pool.outputTokenSupply = tokenSupplyAfterWithdrawal; + pool.outputTokenPriceUSD = utils.getOutputTokenPriceUSD(poolAddress, block); + pool.outputTokenSupply = tokenSupplyAfterWithdrawal; + pool.inputTokenBalances = inputTokenBalances; pool.save(); createWithdrawTransaction( diff --git a/subgraphs/balancer-forks/src/modules/masterChefV2Rewards.ts b/subgraphs/balancer-forks/src/modules/masterChefV2Rewards.ts index 7a453b669d..e4210ff3ac 100644 --- a/subgraphs/balancer-forks/src/modules/masterChefV2Rewards.ts +++ b/subgraphs/balancer-forks/src/modules/masterChefV2Rewards.ts @@ -31,7 +31,7 @@ export function updateMasterChef( const rewardToken = getOrCreateToken( constants.PROTOCOL_TOKEN_ADDRESS, - event.block.number + event.block ); pool.rewardTokens = [ getOrCreateRewardToken( diff --git a/subgraphs/balancer-forks/src/prices/calculations/CalculationsCurve.ts b/subgraphs/balancer-forks/src/prices/calculations/CalculationsCurve.ts index d59205857b..b1c289ea68 100644 --- a/subgraphs/balancer-forks/src/prices/calculations/CalculationsCurve.ts +++ b/subgraphs/balancer-forks/src/prices/calculations/CalculationsCurve.ts @@ -1,27 +1,24 @@ 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 { Address, BigDecimal, BigInt, ethereum } from "@graphprotocol/graph-ts"; import { CalculationsCurve as CalculationsCurveContract } from "../../../generated/Vault/CalculationsCurve"; -export function getCalculationsCurveContract( - contractAddress: Address -): CalculationsCurveContract | null { - if (utils.isNullAddress(contractAddress)) return null; - - return CalculationsCurveContract.bind(contractAddress); -} - -export function getTokenPriceUSDC(tokenAddr: Address): CustomPriceType { +export function getTokenPriceUSDC( + tokenAddr: Address, + block: ethereum.Block | null = null +): CustomPriceType { const config = utils.getConfig(); + const contractAddress = utils.getContract(config.curveCalculations(), block); - if (!config || config.curveCalculationsBlacklist().includes(tokenAddr)) + if ( + !contractAddress || + config.curveCalculationsBlacklist().includes(tokenAddr) + ) return new CustomPriceType(); - const calculationCurveContract = getCalculationsCurveContract( - config.curveCalculations() - ); - if (!calculationCurveContract) return new CustomPriceType(); + const calculationCurveContract = + CalculationsCurveContract.bind(contractAddress); const tokenPrice: BigDecimal = utils .readValue( @@ -32,6 +29,7 @@ export function getTokenPriceUSDC(tokenAddr: Address): CustomPriceType { return CustomPriceType.initialize( tokenPrice, - constants.DEFAULT_USDC_DECIMALS + constants.DEFAULT_USDC_DECIMALS, + constants.OracleType.CURVE_CALCULATIONS ); } diff --git a/subgraphs/balancer-forks/src/prices/calculations/CalculationsSushiswap.ts b/subgraphs/balancer-forks/src/prices/calculations/CalculationsSushiswap.ts index 04974090e4..f7d09e3324 100644 --- a/subgraphs/balancer-forks/src/prices/calculations/CalculationsSushiswap.ts +++ b/subgraphs/balancer-forks/src/prices/calculations/CalculationsSushiswap.ts @@ -1,27 +1,23 @@ 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 { Address, BigDecimal, BigInt, ethereum } from "@graphprotocol/graph-ts"; import { CalculationsSushiSwap as CalculationsSushiContract } from "../../../generated/Vault/CalculationsSushiSwap"; -export function getSushiSwapContract( - contractAddress: Address -): CalculationsSushiContract | null { - if (utils.isNullAddress(contractAddress)) return null; - - return CalculationsSushiContract.bind(contractAddress); -} - -export function getTokenPriceUSDC(tokenAddr: Address): CustomPriceType { +export function getTokenPriceUSDC( + tokenAddr: Address, + block: ethereum.Block | null = null +): CustomPriceType { const config = utils.getConfig(); + const contractAddress = utils.getContract(config.sushiCalculations(), block); - if (!config || config.sushiCalculationsBlacklist().includes(tokenAddr)) + if ( + !contractAddress || + config.sushiCalculationsBlacklist().includes(tokenAddr) + ) return new CustomPriceType(); - const curveContract = getSushiSwapContract(config.sushiCalculations()); - if (!curveContract) { - return new CustomPriceType(); - } + const curveContract = CalculationsSushiContract.bind(contractAddress); const tokenPrice: BigDecimal = utils .readValue( @@ -32,6 +28,7 @@ export function getTokenPriceUSDC(tokenAddr: Address): CustomPriceType { return CustomPriceType.initialize( tokenPrice, - constants.DEFAULT_USDC_DECIMALS + constants.DEFAULT_USDC_DECIMALS, + constants.OracleType.SUSHI_CALCULATIONS ); } diff --git a/subgraphs/balancer-forks/src/prices/common/constants.ts b/subgraphs/balancer-forks/src/prices/common/constants.ts index 991500b76d..4b26f07667 100644 --- a/subgraphs/balancer-forks/src/prices/common/constants.ts +++ b/subgraphs/balancer-forks/src/prices/common/constants.ts @@ -4,6 +4,17 @@ import { Address, BigDecimal, BigInt } from "@graphprotocol/graph-ts"; /////////////////////////////////// COMMON //////////////////////////////// /////////////////////////////////////////////////////////////////////////// +export namespace OracleType { + export const AAVE_ORACLE = "AaveOracle"; + export const INCH_ORACLE = "InchOracle"; + export const CURVE_ROUTER = "CurveRouter"; + export const CHAINLINK_FEED = "ChainlinkFeed"; + export const YEARN_LENS_ORACLE = "YearnLensOracle"; + export const CURVE_CALCULATIONS = "CurveCalculations"; + export const UNISWAP_FORKS_ROUTER = "UniswapForksRouter"; + export const SUSHI_CALCULATIONS = "SushiswapCalculations"; +} + export namespace NULL { export const TYPE_STRING = "0x0000000000000000000000000000000000000000"; export const TYPE_ADDRESS = Address.fromString(TYPE_STRING); @@ -12,21 +23,45 @@ export namespace NULL { export const CHAIN_LINK_USD_ADDRESS = Address.fromString( "0x0000000000000000000000000000000000000348" ); +export const ETH_ADDRESS = Address.fromString( + "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" +); export const BIGINT_ZERO = BigInt.fromI32(0); +export const BIGINT_ONE = BigInt.fromI32(1); +export const BIGINT_TWO = BigInt.fromI32(2); export const BIGINT_TEN = BigInt.fromI32(10); +export const BIGINT_NEG_ONE = BigInt.fromI32(-1); export const BIGINT_TEN_THOUSAND = BigInt.fromI32(10000); +export const BIGDECIMAL_TWO = new BigDecimal(BIGINT_TWO); +export const BIGDECIMAL_TEN = new BigDecimal(BIGINT_TEN); export const BIGDECIMAL_ZERO = new BigDecimal(BIGINT_ZERO); +export const BIGDECIMAL_NEG_ONE = new BigDecimal(BIGINT_NEG_ONE); export const BIGDECIMAL_USD_PRICE = BigDecimal.fromString("1000000"); +export const BIGDECIMAL_FIVE_PERCENT = BigDecimal.fromString("0.05"); +export const BIGDECIMAL_TEN_BILLION = new BigDecimal( + BigInt.fromString("10000000000") +); -export const AAVE_ORACLE_DECIMALS = 8; export const DEFAULT_USDC_DECIMALS = 6; +export const DEFAULT_AAVE_ORACLE_DECIMALS = 8; +export const PRICE_CHANGE_BUFFER_LIMIT = 5 as i32; export const DEFAULT_DECIMALS = BigInt.fromI32(18); +export const STABLE_TOKENS: string[] = ["WETH", "DAI", "USDT", "USDC"]; + export const BLACKLISTED_TOKENS: Address[] = [ - NULL.TYPE_ADDRESS, - Address.fromString("0xbc6e06778708177a18210181b073da747c88490a"), // SYNR Token - Address.fromString("0x93eeb426782bd88fcd4b48d7b0368cf061044928"), // The Rug Game Token - Address.fromString("0x1e6fcb0c88add2fef7e2753cfade6db390581cfb"), // Specter Swap + Address.fromString("0x0000000000000000000000000000000000000000"), // Null Address + Address.fromString("0xb755b949c126c04e0348dd881a5cf55d424742b2"), // Curve USD-BTC-ETH + Address.fromString("0xd79138c49c49200a1afc935171d1bdad084fdc95"), // Curve.fi Factory Plain Pool: 3pool + Address.fromString("0x37c9be6c81990398e9b87494484afc6a4608c25d"), // Curve.fi Factory Plain Pool: blizz + Address.fromString("0xf72beacc6fd334e14a7ddac25c3ce1eb8a827e10"), // Curve.fi Factory USD Metapool: Defrost H2O + Address.fromString("0xae6aab43c4f3e0cea4ab83752c278f8debaba689"), // dForce + Address.fromString("0x10010078a54396f62c96df8532dc2b4847d47ed3"), // Hundred Finance + Address.fromString("0x48fb253446873234f2febbf9bdeaa72d9d387f94"), // Bancor Governance Token (vBNT) + Address.fromString("0x2bbf681cc4eb09218bee85ea2a5d3d13fa40fc0c"), // bb-a-USDT deprecated + Address.fromString("0x48f07301e9e29c3c38a80ae8d9ae771f224f1054"), // South African Tether + Address.fromString("0x616e8bfa43f920657b3497dbf40d6b1a02d4608d"), // Aura BAL + Address.fromString("0xdbdb4d16eda451d0503b854cf79d55697f90c8df"), // Alchemix ]; diff --git a/subgraphs/balancer-forks/src/prices/common/types.ts b/subgraphs/balancer-forks/src/prices/common/types.ts index bb8af47730..372ce7b467 100644 --- a/subgraphs/balancer-forks/src/prices/common/types.ts +++ b/subgraphs/balancer-forks/src/prices/common/types.ts @@ -1,5 +1,5 @@ import * as constants from "./constants"; -import { Address, BigDecimal, BigInt } from "@graphprotocol/graph-ts"; +import { Address, BigDecimal, BigInt, TypedMap } from "@graphprotocol/graph-ts"; export class Wrapped { inner: T; @@ -9,23 +9,106 @@ export class Wrapped { } } +export class TokenInfo { + private _name: string; + private _decimals: i32; + private _address: Address; + private _isStable: bool; + + constructor() { + this._name = ""; + this._decimals = constants.DEFAULT_USDC_DECIMALS; + this._address = constants.NULL.TYPE_ADDRESS; + } + + static set( + name: string, + decimals: i32, + address: Address, + isStable: bool = true + ): TokenInfo { + const instance = new TokenInfo(); + instance._name = name; + instance._decimals = decimals; + instance._address = address; + instance._isStable = isStable; + + return instance; + } + + get name(): string { + return this._name; + } + get decimals(): i32 { + return this._decimals; + } + get address(): Address { + return this._address; + } + get isStable(): bool { + return this._isStable; + } +} + +export class ContractInfo { + private _address: Address; + private _startBlock: BigInt; + + constructor() { + this._address = constants.NULL.TYPE_ADDRESS; + this._startBlock = constants.BIGINT_ZERO; + } + + static set(address: Address, startBlock: BigInt): ContractInfo { + const instance = new ContractInfo(); + instance._address = address; + instance._startBlock = startBlock; + + return instance; + } + + get address(): Address { + return this._address; + } + get startBlock(): BigInt { + return this._startBlock; + } +} + export class CustomPriceType { // `null` indicates a reverted call. private _usdPrice: Wrapped; private _decimals: Wrapped; + private _oracleType: string; constructor() { this._usdPrice = new Wrapped(constants.BIGDECIMAL_ZERO); this._decimals = new Wrapped(constants.BIGINT_ZERO.toI32() as u8); + this._oracleType = ""; } static initialize( _usdPrice: BigDecimal, - _decimals: i32 = 0 + _decimals: i32 = 0, + _oracleType: string = "" + ): CustomPriceType { + const instance = new CustomPriceType(); + instance._usdPrice = new Wrapped(_usdPrice); + instance._decimals = new Wrapped(_decimals as u8); + instance._oracleType = _oracleType; + + return instance; + } + + static initializePegged( + _usdPrice: BigDecimal = constants.BIGDECIMAL_USD_PRICE, + _decimals: i32 = constants.DEFAULT_USDC_DECIMALS, + _oracleType: string = "HardcodedStable" ): CustomPriceType { const result = new CustomPriceType(); result._usdPrice = new Wrapped(_usdPrice); result._decimals = new Wrapped(_decimals as u8); + result._oracleType = _oracleType; return result; } @@ -33,42 +116,41 @@ export class CustomPriceType { get reverted(): bool { return this._usdPrice.inner == constants.BIGDECIMAL_ZERO; } - get usdPrice(): BigDecimal { - return changetype>(this._usdPrice).inner; + return changetype>(this._usdPrice).inner.div( + constants.BIGINT_TEN.pow(this.decimals as u8).toBigDecimal() + ); } - get decimals(): i32 { return changetype>(this._decimals).inner; } - - get decimalsBaseTen(): BigDecimal { - return constants.BIGINT_TEN.pow(this.decimals as u8).toBigDecimal(); + get oracleType(): string { + return this._oracleType; } } export interface Configurations { - yearnLens(): Address; - chainLink(): Address; + yearnLens(): ContractInfo | null; yearnLensBlacklist(): Address[]; - aaveOracle(): Address; + inchOracle(): ContractInfo | null; + inchOracleBlacklist(): Address[]; + + chainLink(): ContractInfo | null; + + aaveOracle(): ContractInfo | null; aaveOracleBlacklist(): Address[]; - curveCalculations(): Address; + curveCalculations(): ContractInfo | null; curveCalculationsBlacklist(): Address[]; - sushiCalculations(): Address; + sushiCalculations(): ContractInfo | null; sushiCalculationsBlacklist(): Address[]; - uniswapForks(): Address[]; - curveRegistry(): Address[]; + uniswapForks(): ContractInfo[]; + curveRegistry(): ContractInfo[]; hardcodedStables(): Address[]; - ethAddress(): Address; - wethAddress(): Address; - usdcAddress(): Address; - - usdcTokenDecimals(): BigInt; + whitelistedTokens(): TypedMap; } diff --git a/subgraphs/balancer-forks/src/prices/common/utils.ts b/subgraphs/balancer-forks/src/prices/common/utils.ts index a40dfef9e9..53e1d98f6c 100644 --- a/subgraphs/balancer-forks/src/prices/common/utils.ts +++ b/subgraphs/balancer-forks/src/prices/common/utils.ts @@ -1,3 +1,10 @@ +import { + BigInt, + Address, + ethereum, + BigDecimal, + dataSource, +} from "@graphprotocol/graph-ts"; import * as XDAI from "../config/gnosis"; import * as AURORA from "../config/aurora"; import * as FANTOM from "../config/fantom"; @@ -10,14 +17,31 @@ import * as AVALANCHE from "../config/avalanche"; import * as ARBITRUM_ONE from "../config/arbitrum"; import * as constants from "./constants"; -import { Configurations } from "./types"; +import { Configurations, ContractInfo } from "./types"; import { _ERC20 } from "../../../generated/Vault/_ERC20"; -import { Address, BigInt, dataSource, ethereum } from "@graphprotocol/graph-ts"; export function isNullAddress(tokenAddr: Address): boolean { return tokenAddr.equals(constants.NULL.TYPE_ADDRESS) ? true : false; } +export function absBigDecimal(value: BigDecimal): BigDecimal { + if (value.lt(constants.BIGDECIMAL_ZERO)) + return value.times(constants.BIGDECIMAL_NEG_ONE); + return value; +} + +export function safeDiv(amount0: BigDecimal, amount1: BigDecimal): BigDecimal { + if (amount1.equals(constants.BIGDECIMAL_ZERO)) { + return constants.BIGDECIMAL_ZERO; + } else { + return amount0.div(amount1); + } +} + +export function exponentToBigDecimal(decimals: i32): BigDecimal { + return constants.BIGINT_TEN.pow(decimals as u8).toBigDecimal(); +} + export function readValue( callResult: ethereum.CallResult, defaultValue: T @@ -25,17 +49,45 @@ export function readValue( return callResult.reverted ? defaultValue : callResult.value; } +export function getContract( + contractInfo: ContractInfo | null, + block: ethereum.Block | null = null +): Address | null { + if (!contractInfo || (block && contractInfo.startBlock.gt(block.number))) + return null; + + return contractInfo.address; +} + +export function getTokenName(tokenAddr: Address): string { + const tokenContract = _ERC20.bind(tokenAddr); + const name = readValue(tokenContract.try_name(), ""); + + return name; +} + export function getTokenDecimals(tokenAddr: Address): BigInt { - const token = _ERC20.bind(tokenAddr); + const tokenContract = _ERC20.bind(tokenAddr); const decimals = readValue( - token.try_decimals(), + tokenContract.try_decimals(), constants.DEFAULT_DECIMALS ); return decimals; } +export function getTokenSupply(tokenAddr: Address): BigInt { + const tokenContract = _ERC20.bind(tokenAddr); + + const totalSupply = readValue( + tokenContract.try_totalSupply(), + constants.BIGINT_ONE + ); + + return totalSupply; +} + export function getConfig(): Configurations { const network = dataSource.network(); diff --git a/subgraphs/balancer-forks/src/prices/common/validation.ts b/subgraphs/balancer-forks/src/prices/common/validation.ts new file mode 100644 index 0000000000..e84621453c --- /dev/null +++ b/subgraphs/balancer-forks/src/prices/common/validation.ts @@ -0,0 +1,65 @@ +import * as utils from "./utils"; +import * as constants from "./constants"; +import { Token } from "../../../generated/schema"; +import { Address, BigDecimal } from "@graphprotocol/graph-ts"; +import { getOrCreateDexAmmProtocol } from "../../common/initializers"; + +export function protocolLevelPriceValidation( + token: Token, + latestPrice: BigDecimal +): BigDecimal { + const protocol = getOrCreateDexAmmProtocol(); + + const tokenTVLDelta = utils.absBigDecimal( + latestPrice + .times( + utils + .getTokenSupply(Address.fromString(token.id)) + .toBigDecimal() + .div(utils.exponentToBigDecimal(token.decimals)) + ) + .minus(token._totalValueLockedUSD) + ); + + const protocolTVLPercentageDelta = utils.absBigDecimal( + utils.safeDiv(tokenTVLDelta, protocol.totalValueLockedUSD) + ); + + if (protocolTVLPercentageDelta.gt(constants.BIGDECIMAL_FIVE_PERCENT)) { + if (token._largeTVLImpactBuffer < constants.PRICE_CHANGE_BUFFER_LIMIT) { + token._largeTVLImpactBuffer += 1; + token.save(); + + return token.lastPriceUSD!; + } + } + + if ( + !token.lastPriceUSD || + token.lastPriceUSD!.equals(constants.BIGDECIMAL_ZERO) + ) { + token.save(); + + return latestPrice; + } + + // If priceSoFar 10x greater or less than token.lastPriceUSD, use token.lastPriceUSD + // Increment buffer so that it allows large price jumps if seen repeatedly + if ( + latestPrice.gt(token.lastPriceUSD!.times(constants.BIGDECIMAL_TWO)) || + latestPrice.lt(token.lastPriceUSD!.div(constants.BIGDECIMAL_TWO)) + ) { + if (token._largePriceChangeBuffer < constants.PRICE_CHANGE_BUFFER_LIMIT) { + token._largePriceChangeBuffer += 1; + token.save(); + + return token.lastPriceUSD!; + } + } + + token._largePriceChangeBuffer = 0; + token._largeTVLImpactBuffer = 0; + token.save(); + + return latestPrice; +} diff --git a/subgraphs/balancer-forks/src/prices/config/arbitrum.ts b/subgraphs/balancer-forks/src/prices/config/arbitrum.ts index 7c34daaa52..fedc8a85f9 100644 --- a/subgraphs/balancer-forks/src/prices/config/arbitrum.ts +++ b/subgraphs/balancer-forks/src/prices/config/arbitrum.ts @@ -1,5 +1,5 @@ -import { Configurations } from "../common/types"; -import { Address, BigInt } from "@graphprotocol/graph-ts"; +import { Address, BigInt, TypedMap } from "@graphprotocol/graph-ts"; +import { Configurations, TokenInfo, ContractInfo } from "../common/types"; export const NETWORK_STRING = "arbitrum-one"; @@ -7,107 +7,184 @@ export const NETWORK_STRING = "arbitrum-one"; ///////////////////// CALCULATIONS/ORACLE CONTRACT //////////////////////// /////////////////////////////////////////////////////////////////////////// -export const YEARN_LENS_CONTRACT_ADDRESS = Address.fromString( - "0x043518ab266485dc085a1db095b8d9c2fc78e9b9" +export const YEARN_LENS_CONTRACT_ADDRESS = ContractInfo.set( + Address.fromString("0x043518ab266485dc085a1db095b8d9c2fc78e9b9"), + BigInt.fromI32(2396321) ); -export const CHAIN_LINK_CONTRACT_ADDRESS = Address.fromString( - "0x47Fb2585D2C56Fe188D0E6ec628a38b74fCeeeDf" -); -export const AAVE_ORACLE_CONTRACT_ADDRESS = Address.fromString( - "0xb56c2F0B653B2e0b10C9b928C8580Ac5Df02C7C7" + +export const INCH_ORACLE_CONTRACT_ADDRESS = ContractInfo.set( + Address.fromString("0x735247fb0a604c0adc6cab38ace16d0dba31295f"), + BigInt.fromI32(781467) ); -export const SUSHISWAP_CALCULATIONS_ADDRESS = Address.fromString( - "0x5ea7e501c9a23f4a76dc7d33a11d995b13a1dd25" + +export const AAVE_ORACLE_CONTRACT_ADDRESS = ContractInfo.set( + Address.fromString("0xb56c2f0b653b2e0b10c9b928c8580ac5df02c7c7"), + BigInt.fromI32(7740843) ); /////////////////////////////////////////////////////////////////////////// ///////////////////////////// CURVE CONTRACT ////////////////////////////// /////////////////////////////////////////////////////////////////////////// -export const CURVE_CALCULATIONS_ADDRESS = Address.fromString( - "0x3268c3bda100ef0ff3c2d044f23eab62c80d78d2" +export const CURVE_CALCULATIONS_ADDRESS = ContractInfo.set( + Address.fromString("0x3268c3bda100ef0ff3c2d044f23eab62c80d78d2"), + BigInt.fromI32(11707234) ); -export const CURVE_REGISTRY_ADDRESSES: Address[] = [ - Address.fromString("0x445FE580eF8d70FF569aB36e80c647af338db351"), - Address.fromString("0x0E9fBb167DF83EdE3240D6a5fa5d40c6C6851e15"), +export const CURVE_REGISTRY_ADDRESSES = [ + ContractInfo.set( + Address.fromString("0x445fe580ef8d70ff569ab36e80c647af338db351"), + BigInt.fromI32(1362056) + ), + ContractInfo.set( + Address.fromString("0x0e9fbb167df83ede3240d6a5fa5d40c6c6851e15"), + BigInt.fromI32(4530115) + ), ]; /////////////////////////////////////////////////////////////////////////// /////////////////////////// UNISWAP FORKS CONTRACT //////////////////////// /////////////////////////////////////////////////////////////////////////// -export const UNISWAP_FORKS_ROUTER_ADDRESSES: Address[] = [ - Address.fromString("0x1b02da8cb0d097eb8d57a175b88c7d8b47997506"), // SushiSwap +export const SUSHISWAP_CALCULATIONS_ADDRESS = ContractInfo.set( + Address.fromString("0x5ea7e501c9a23f4a76dc7d33a11d995b13a1dd25"), + BigInt.fromI32(2396120) +); + +export const UNISWAP_FORKS_ROUTER_ADDRESSES = [ + ContractInfo.set( + Address.fromString("0x1b02da8cb0d097eb8d57a175b88c7d8b47997506"), // SushiSwap + BigInt.fromI32(73) + ), ]; /////////////////////////////////////////////////////////////////////////// /////////////////////////// BLACKLISTED TOKENS //////////////////////////// /////////////////////////////////////////////////////////////////////////// -export const YEARN_LENS_BLACKLIST: Address[] = []; +export const YEARN_LENS_BLACKLIST: Address[] = [ + Address.fromString("0x5979d7b546e38e414f7e9822514be443a4800529"), // Wrapped liquid staked Ether 2.0 token + Address.fromString("0x3f56e0c36d275367b8c502090edf38289b3dea0d"), // Mai Stablecoin + Address.fromString("0x64343594ab9b56e99087bfa6f2335db24c2d1f17"), // vesta stable + Address.fromString("0xf0b5ceefc89684889e5f7e0a7775bd100fcd3709"), // digital dollar +]; +export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = [ + Address.fromString("0x5979d7b546e38e414f7e9822514be443a4800529"), // Wrapped liquid staked Ether 2.0 token +]; +export const CURVE_CALCULATIONS_BLACKSLIST: Address[] = [ + Address.fromString("0x5979d7b546e38e414f7e9822514be443a4800529"), // Wrapped liquid staked Ether 2.0 token +]; +export const INCH_ORACLE_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[] = []; +export const HARDCODED_STABLES: Address[] = [ + Address.fromString("0x641441c631e2f909700d2f41fd87f0aa6a6b4edb"), // dForce USD + Address.fromString("0x8616e8ea83f048ab9a5ec513c9412dd2993bce3f"), // handleUSD + Address.fromString("0xeb466342c4d449bc9f53a865d5cb90586f405215"), // Axelar Wrapped USDC + Address.fromString("0x625e7708f30ca75bfd92586e17077590c60eb4cd"), // Aave Arbitrum USDC + Address.fromString("0x6ab707aca953edaefbc4fd23ba73294241490620"), // Aave Arbitrum USDT + Address.fromString("0x82e64f49ed5ec1bc6e43dad4fc8af9bb3a2312ee"), // Aave Arbitrum DAI +]; /////////////////////////////////////////////////////////////////////////// ///////////////////////////////// HELPERS ///////////////////////////////// /////////////////////////////////////////////////////////////////////////// -export const USDC_TOKEN_DECIMALS = BigInt.fromI32(6); +export const WHITELISTED_TOKENS = new TypedMap(); + +WHITELISTED_TOKENS.set( + "USDC", + TokenInfo.set( + "USDC", + 6, + Address.fromString("0xff970a61a04b1ca14834a43f5de4533ebddb5cc8") + ) +); -export const ETH_ADDRESS = Address.fromString( - "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" +WHITELISTED_TOKENS.set( + "USDT", + TokenInfo.set( + "USDT", + 6, + Address.fromString("0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9") + ) ); -export const WETH_ADDRESS = Address.fromString( - "0x82af49447d8a07e3bd95bd0d56f35241523fbab1" + +WHITELISTED_TOKENS.set( + "DAI", + TokenInfo.set( + "DAI", + 18, + Address.fromString("0xda10009cbd5d07dd0cecc66161fc93d7c9000da1") + ) ); -export const USDC_ADDRESS = Address.fromString( - "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8" + +WHITELISTED_TOKENS.set( + "WETH", + TokenInfo.set( + "WETH", + 18, + Address.fromString("0x82af49447d8a07e3bd95bd0d56f35241523fbab1") + ) +); + +WHITELISTED_TOKENS.set( + "NATIVE_TOKEN", + TokenInfo.set( + "ETH", + 18, + Address.fromString("0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee") + ) ); export class config implements Configurations { - yearnLens(): Address { + yearnLens(): ContractInfo | null { return YEARN_LENS_CONTRACT_ADDRESS; } - chainLink(): Address { - return CHAIN_LINK_CONTRACT_ADDRESS; - } yearnLensBlacklist(): Address[] { return YEARN_LENS_BLACKLIST; } - aaveOracle(): Address { + inchOracle(): ContractInfo | null { + return INCH_ORACLE_CONTRACT_ADDRESS; + } + inchOracleBlacklist(): Address[] { + return INCH_ORACLE_BLACKLIST; + } + + chainLink(): ContractInfo | null { + return null; + } + + aaveOracle(): ContractInfo | null { return AAVE_ORACLE_CONTRACT_ADDRESS; } aaveOracleBlacklist(): Address[] { return AAVE_ORACLE_BLACKLIST; } - curveCalculations(): Address { + curveCalculations(): ContractInfo | null { return CURVE_CALCULATIONS_ADDRESS; } curveCalculationsBlacklist(): Address[] { return CURVE_CALCULATIONS_BLACKSLIST; } - sushiCalculations(): Address { + sushiCalculations(): ContractInfo | null { return SUSHISWAP_CALCULATIONS_ADDRESS; } sushiCalculationsBlacklist(): Address[] { return SUSHI_CALCULATIONS_BLACKSLIST; } - uniswapForks(): Address[] { + uniswapForks(): ContractInfo[] { return UNISWAP_FORKS_ROUTER_ADDRESSES; } - curveRegistry(): Address[] { + curveRegistry(): ContractInfo[] { return CURVE_REGISTRY_ADDRESSES; } @@ -115,17 +192,7 @@ export class config implements Configurations { return HARDCODED_STABLES; } - ethAddress(): Address { - return ETH_ADDRESS; - } - wethAddress(): Address { - return WETH_ADDRESS; - } - usdcAddress(): Address { - return USDC_ADDRESS; - } - - usdcTokenDecimals(): BigInt { - return USDC_TOKEN_DECIMALS; + whitelistedTokens(): TypedMap { + return WHITELISTED_TOKENS; } } diff --git a/subgraphs/balancer-forks/src/prices/config/aurora.ts b/subgraphs/balancer-forks/src/prices/config/aurora.ts index fd7d45f2ea..ff74f2308a 100644 --- a/subgraphs/balancer-forks/src/prices/config/aurora.ts +++ b/subgraphs/balancer-forks/src/prices/config/aurora.ts @@ -1,6 +1,5 @@ -import * as constants from "../common/constants" -import { Configurations } from "../common/types"; -import { Address, BigInt } from "@graphprotocol/graph-ts"; +import { Address, BigInt, TypedMap } from "@graphprotocol/graph-ts"; +import { Configurations, ContractInfo, TokenInfo } from "../common/types"; export const NETWORK_STRING = "aurora"; @@ -8,27 +7,31 @@ export const NETWORK_STRING = "aurora"; ///////////////////// CALCULATIONS/ORACLE CONTRACT //////////////////////// /////////////////////////////////////////////////////////////////////////// -export const YEARN_LENS_CONTRACT_ADDRESS = constants.NULL.TYPE_ADDRESS; -export const CHAIN_LINK_CONTRACT_ADDRESS = constants.NULL.TYPE_ADDRESS; -export const AAVE_ORACLE_CONTRACT_ADDRESS = constants.NULL.TYPE_ADDRESS; -export const SUSHISWAP_CALCULATIONS_ADDRESS = constants.NULL.TYPE_ADDRESS; +export const INCH_ORACLE_CONTRACT_ADDRESS = ContractInfo.set( + Address.fromString("0xe4e0552452e5cc1306a2bf5b2fd9b1ea19418795"), + BigInt.fromI32(66366270) +); /////////////////////////////////////////////////////////////////////////// ///////////////////////////// CURVE CONTRACT ////////////////////////////// /////////////////////////////////////////////////////////////////////////// -export const CURVE_CALCULATIONS_ADDRESS = constants.NULL.TYPE_ADDRESS; - -export const CURVE_REGISTRY_ADDRESSES: Address[] = [ - Address.fromString("0x5B5CFE992AdAC0C9D48E05854B2d91C73a003858"), +export const CURVE_REGISTRY_ADDRESSES = [ + ContractInfo.set( + Address.fromString("0x5b5cfe992adac0c9d48e05854b2d91c73a003858"), + BigInt.fromI32(62440526) + ), ]; /////////////////////////////////////////////////////////////////////////// /////////////////////////// UNISWAP FORKS CONTRACT //////////////////////// /////////////////////////////////////////////////////////////////////////// -export const UNISWAP_FORKS_ROUTER_ADDRESSES: Address[] = [ - Address.fromString("0x2CB45Edb4517d5947aFdE3BEAbF95A582506858B"), // TriSolaris +export const UNISWAP_FORKS_ROUTER_ADDRESSES = [ + ContractInfo.set( + Address.fromString("0x2cb45edb4517d5947afde3beabf95a582506858b"), // TriSolaris + BigInt.fromI32(49607893) + ), ]; /////////////////////////////////////////////////////////////////////////// @@ -36,6 +39,7 @@ export const UNISWAP_FORKS_ROUTER_ADDRESSES: Address[] = [ /////////////////////////////////////////////////////////////////////////// export const YEARN_LENS_BLACKLIST: Address[] = []; +export const INCH_ORACLE_BLACKLIST: Address[] = []; export const AAVE_ORACLE_BLACKLIST: Address[] = []; export const CURVE_CALCULATIONS_BLACKSLIST: Address[] = []; export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = []; @@ -50,54 +54,96 @@ export const HARDCODED_STABLES: Address[] = []; ///////////////////////////////// HELPERS ///////////////////////////////// /////////////////////////////////////////////////////////////////////////// -export const USDC_TOKEN_DECIMALS = BigInt.fromI32(6); +export const WHITELISTED_TOKENS = new TypedMap(); -export const ETH_ADDRESS = Address.fromString( - "0x8bec47865ade3b172a928df8f990bc7f2a3b9f79" // Aurora +WHITELISTED_TOKENS.set( + "USDC", + TokenInfo.set( + "USDC", + 6, + Address.fromString("0xb12bfca5a55806aaf64e99521918a4bf0fc40802") + ) ); -export const WETH_ADDRESS = Address.fromString( - "0xc9bdeed33cd01541e1eed10f90519d2c06fe3feb" // WETH +WHITELISTED_TOKENS.set( + "USDT", + TokenInfo.set( + "USDT", + 6, + Address.fromString("0x4988a896b1227218e4a686fde5eabdcabd91571f") + ) ); -export const USDC_ADDRESS = Address.fromString( - "0xb12bfca5a55806aaf64e99521918a4bf0fc40802" + +WHITELISTED_TOKENS.set( + "DAI", + TokenInfo.set( + "DAI", + 18, + Address.fromString("0xe3520349f477a5f6eb06107066048508498a291b") + ) +); + +WHITELISTED_TOKENS.set( + "WETH", + TokenInfo.set( + "WETH", + 18, + Address.fromString("0xc9bdeed33cd01541e1eed10f90519d2c06fe3feb") + ) +); + +WHITELISTED_TOKENS.set( + "NATIVE_TOKEN", + TokenInfo.set( + "Aurora", + 18, + Address.fromString("0x8bec47865ade3b172a928df8f990bc7f2a3b9f79") + ) ); export class config implements Configurations { - yearnLens(): Address { - return YEARN_LENS_CONTRACT_ADDRESS; - } - chainLink(): Address { - return CHAIN_LINK_CONTRACT_ADDRESS; + yearnLens(): ContractInfo | null { + return null; } yearnLensBlacklist(): Address[] { return YEARN_LENS_BLACKLIST; } - aaveOracle(): Address { - return AAVE_ORACLE_CONTRACT_ADDRESS; + inchOracle(): ContractInfo | null { + return INCH_ORACLE_CONTRACT_ADDRESS; + } + inchOracleBlacklist(): Address[] { + return INCH_ORACLE_BLACKLIST; + } + + chainLink(): ContractInfo | null { + return null; + } + + aaveOracle(): ContractInfo | null { + return null; } aaveOracleBlacklist(): Address[] { return AAVE_ORACLE_BLACKLIST; } - curveCalculations(): Address { - return CURVE_CALCULATIONS_ADDRESS; + curveCalculations(): ContractInfo | null { + return null; } curveCalculationsBlacklist(): Address[] { return CURVE_CALCULATIONS_BLACKSLIST; } - sushiCalculations(): Address { - return SUSHISWAP_CALCULATIONS_ADDRESS; + sushiCalculations(): ContractInfo | null { + return null; } sushiCalculationsBlacklist(): Address[] { return SUSHI_CALCULATIONS_BLACKSLIST; } - uniswapForks(): Address[] { + uniswapForks(): ContractInfo[] { return UNISWAP_FORKS_ROUTER_ADDRESSES; } - curveRegistry(): Address[] { + curveRegistry(): ContractInfo[] { return CURVE_REGISTRY_ADDRESSES; } @@ -105,17 +151,7 @@ export class config implements Configurations { return HARDCODED_STABLES; } - ethAddress(): Address { - return ETH_ADDRESS; - } - wethAddress(): Address { - return WETH_ADDRESS; - } - usdcAddress(): Address { - return USDC_ADDRESS; - } - - usdcTokenDecimals(): BigInt { - return USDC_TOKEN_DECIMALS; + whitelistedTokens(): TypedMap { + return WHITELISTED_TOKENS; } } diff --git a/subgraphs/balancer-forks/src/prices/config/avalanche.ts b/subgraphs/balancer-forks/src/prices/config/avalanche.ts index 9bde075398..a6c2cb8704 100644 --- a/subgraphs/balancer-forks/src/prices/config/avalanche.ts +++ b/subgraphs/balancer-forks/src/prices/config/avalanche.ts @@ -1,6 +1,5 @@ -import * as constants from "../common/constants"; -import { Configurations } from "../common/types"; -import { Address, BigInt } from "@graphprotocol/graph-ts"; +import { Address, BigInt, TypedMap } from "@graphprotocol/graph-ts"; +import { Configurations, ContractInfo, TokenInfo } from "../common/types"; export const NETWORK_STRING = "avalanche"; @@ -8,33 +7,48 @@ export const NETWORK_STRING = "avalanche"; ///////////////////// CALCULATIONS/ORACLE CONTRACT //////////////////////// /////////////////////////////////////////////////////////////////////////// -export const YEARN_LENS_CONTRACT_ADDRESS = constants.NULL.TYPE_ADDRESS; -export const CHAIN_LINK_CONTRACT_ADDRESS = constants.NULL.TYPE_ADDRESS; -export const SUSHISWAP_CALCULATIONS_ADDRESS = constants.NULL.TYPE_ADDRESS; +export const INCH_ORACLE_CONTRACT_ADDRESS = ContractInfo.set( + Address.fromString("0xbd0c7aaf0bf082712ebe919a9dd94b2d978f79a9"), + BigInt.fromI32(8608685) +); -export const AAVE_ORACLE_CONTRACT_ADDRESS = Address.fromString( - "0xEBd36016B3eD09D4693Ed4251c67Bd858c3c7C9C" +export const AAVE_ORACLE_CONTRACT_ADDRESS = ContractInfo.set( + Address.fromString("0xebd36016b3ed09d4693ed4251c67bd858c3c7c9c"), + BigInt.fromI32(11970477) ); /////////////////////////////////////////////////////////////////////////// ///////////////////////////// CURVE CONTRACT ////////////////////////////// /////////////////////////////////////////////////////////////////////////// -export const CURVE_CALCULATIONS_ADDRESS = constants.NULL.TYPE_ADDRESS; - -export const CURVE_REGISTRY_ADDRESSES: Address[] = [ - Address.fromString("0x8474DdbE98F5aA3179B3B3F5942D724aFcdec9f6"), - Address.fromString("0x90f421832199e93d01b64DaF378b183809EB0988"), +export const CURVE_REGISTRY_ADDRESSES = [ + ContractInfo.set( + Address.fromString("0x8474ddbe98f5aa3179b3b3f5942d724afcdec9f6"), + BigInt.fromI32(5254206) + ), + ContractInfo.set( + Address.fromString("0x90f421832199e93d01b64daf378b183809eb0988"), + BigInt.fromI32(9384663) + ), ]; /////////////////////////////////////////////////////////////////////////// /////////////////////////// UNISWAP FORKS CONTRACT //////////////////////// /////////////////////////////////////////////////////////////////////////// -export const UNISWAP_FORKS_ROUTER_ADDRESSES: Address[] = [ - Address.fromString("0x60aE616a2155Ee3d9A68541Ba4544862310933d4"), // TraderJOE - Address.fromString("0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106"), // Pangolin - Address.fromString("0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506"), // Sushiswap +export const UNISWAP_FORKS_ROUTER_ADDRESSES = [ + ContractInfo.set( + Address.fromString("0x60ae616a2155ee3d9a68541ba4544862310933d4"), // TraderJOE + BigInt.fromI32(2486393) + ), + ContractInfo.set( + Address.fromString("0xe54ca86531e17ef3616d22ca28b0d458b6c89106"), // Pangolin + BigInt.fromI32(56879) + ), + ContractInfo.set( + Address.fromString("0x1b02da8cb0d097eb8d57a175b88c7d8b47997506"), // SushiSwap + BigInt.fromI32(506236) + ), ]; /////////////////////////////////////////////////////////////////////////// @@ -42,6 +56,7 @@ export const UNISWAP_FORKS_ROUTER_ADDRESSES: Address[] = [ /////////////////////////////////////////////////////////////////////////// export const YEARN_LENS_BLACKLIST: Address[] = []; +export const INCH_ORACLE_BLACKLIST: Address[] = []; export const AAVE_ORACLE_BLACKLIST: Address[] = []; export const CURVE_CALCULATIONS_BLACKSLIST: Address[] = []; export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = []; @@ -50,60 +65,114 @@ export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = []; //////////////////////////// HARDCODED STABLES //////////////////////////// /////////////////////////////////////////////////////////////////////////// -export const HARDCODED_STABLES: Address[] = []; +export const HARDCODED_STABLES: Address[] = [ + Address.fromString("0x82e64f49ed5ec1bc6e43dad4fc8af9bb3a2312ee"), // Aave Avalannche DAI + Address.fromString("0xfab550568c688d5d8a52c7d794cb93edc26ec0ec"), // Axelar Wrapped USDC + Address.fromString("0xc5fa5669e326da8b2c35540257cd48811f40a36b"), // Axelar Wrapped DAI + Address.fromString("0x6ab707aca953edaefbc4fd23ba73294241490620"), // Axelar Wrapped USDT + Address.fromString("0x6807ed4369d9399847f306d7d835538915fa749d"), // Blizz DAI + Address.fromString("0x18cb11c9f2b6f45a7ac0a95efd322ed4cf9eeebf"), // BLizz USDT + Address.fromString("0x943df430f7f9f734ec7625b561dc5e17a173adf8"), // BLizz MIM + Address.fromString("0x025ab35ff6abcca56d57475249baaeae08419039"), // Arable USD + Address.fromString("0x28690ec942671ac8d9bc442b667ec338ede6dfd3"), // deBridge USD Coin + Address.fromString("0x1337bedc9d22ecbe766df105c9623922a27963ec"), // av3CRV +]; /////////////////////////////////////////////////////////////////////////// ///////////////////////////////// HELPERS ///////////////////////////////// /////////////////////////////////////////////////////////////////////////// -export const USDC_TOKEN_DECIMALS = BigInt.fromI32(6); +export const WHITELISTED_TOKENS = new TypedMap(); + +WHITELISTED_TOKENS.set( + "USDC", + TokenInfo.set( + "USDC", + 6, + Address.fromString("0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e") + ) +); + +WHITELISTED_TOKENS.set( + "USDT", + TokenInfo.set( + "USDT", + 6, + Address.fromString("0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7") + ) +); -export const ETH_ADDRESS = Address.fromString( - "0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab" +WHITELISTED_TOKENS.set( + "DAI", + TokenInfo.set( + "DAI", + 18, + Address.fromString("0xd586e7f844cea2f87f50152665bcbc2c279d8d70") + ) ); -export const WETH_ADDRESS = Address.fromString( - "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7" + +WHITELISTED_TOKENS.set( + "WETH", + TokenInfo.set( + "WETH", + 18, + Address.fromString("0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab") + ) ); -export const USDC_ADDRESS = Address.fromString( - "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e" + +WHITELISTED_TOKENS.set( + "NATIVE_TOKEN", + TokenInfo.set( + "WAVAX", + 18, + Address.fromString("0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7") + ) ); export class config implements Configurations { - yearnLens(): Address { - return YEARN_LENS_CONTRACT_ADDRESS; - } - chainLink(): Address { - return CHAIN_LINK_CONTRACT_ADDRESS; + yearnLens(): ContractInfo | null { + return null; } yearnLensBlacklist(): Address[] { return YEARN_LENS_BLACKLIST; } - aaveOracle(): Address { + inchOracle(): ContractInfo | null { + return INCH_ORACLE_CONTRACT_ADDRESS; + } + inchOracleBlacklist(): Address[] { + return INCH_ORACLE_BLACKLIST; + } + + chainLink(): ContractInfo | null { + return null; + } + + aaveOracle(): ContractInfo | null { return AAVE_ORACLE_CONTRACT_ADDRESS; } aaveOracleBlacklist(): Address[] { return AAVE_ORACLE_BLACKLIST; } - curveCalculations(): Address { - return CURVE_CALCULATIONS_ADDRESS; + curveCalculations(): ContractInfo | null { + return null; } curveCalculationsBlacklist(): Address[] { return CURVE_CALCULATIONS_BLACKSLIST; } - sushiCalculations(): Address { - return SUSHISWAP_CALCULATIONS_ADDRESS; + sushiCalculations(): ContractInfo | null { + return null; } sushiCalculationsBlacklist(): Address[] { return SUSHI_CALCULATIONS_BLACKSLIST; } - uniswapForks(): Address[] { + uniswapForks(): ContractInfo[] { return UNISWAP_FORKS_ROUTER_ADDRESSES; } - curveRegistry(): Address[] { + curveRegistry(): ContractInfo[] { return CURVE_REGISTRY_ADDRESSES; } @@ -111,17 +180,7 @@ export class config implements Configurations { return HARDCODED_STABLES; } - ethAddress(): Address { - return ETH_ADDRESS; - } - wethAddress(): Address { - return WETH_ADDRESS; - } - usdcAddress(): Address { - return USDC_ADDRESS; - } - - usdcTokenDecimals(): BigInt { - return USDC_TOKEN_DECIMALS; + whitelistedTokens(): TypedMap { + return WHITELISTED_TOKENS; } } diff --git a/subgraphs/balancer-forks/src/prices/config/fantom.ts b/subgraphs/balancer-forks/src/prices/config/fantom.ts index 1447f6c23b..5ca716f4e9 100644 --- a/subgraphs/balancer-forks/src/prices/config/fantom.ts +++ b/subgraphs/balancer-forks/src/prices/config/fantom.ts @@ -1,6 +1,5 @@ -import * as constants from "../common/constants"; -import { Configurations } from "../common/types"; -import { Address, BigInt } from "@graphprotocol/graph-ts"; +import { Address, BigInt, TypedMap } from "@graphprotocol/graph-ts"; +import { Configurations, ContractInfo, TokenInfo } from "../common/types"; export const NETWORK_STRING = "fantom"; @@ -8,46 +7,90 @@ export const NETWORK_STRING = "fantom"; ///////////////////// CALCULATIONS/ORACLE CONTRACT //////////////////////// /////////////////////////////////////////////////////////////////////////// -export const YEARN_LENS_CONTRACT_ADDRESS = Address.fromString( - "0x57aa88a0810dfe3f9b71a9b179dd8bf5f956c46a" +export const YEARN_LENS_CONTRACT_ADDRESS = ContractInfo.set( + Address.fromString("0x57aa88a0810dfe3f9b71a9b179dd8bf5f956c46a"), + BigInt.fromI32(17091856) ); -export const CHAIN_LINK_CONTRACT_ADDRESS = constants.NULL.TYPE_ADDRESS; -export const AAVE_ORACLE_CONTRACT_ADDRESS = constants.NULL.TYPE_ADDRESS; -export const SUSHISWAP_CALCULATIONS_ADDRESS = Address.fromString( - "0x44536de2220987d098d1d29d3aafc7f7348e9ee4" + +export const INCH_ORACLE_CONTRACT_ADDRESS = ContractInfo.set( + Address.fromString("0xe8e598a1041b6fdb13999d275a202847d9b654ca"), + BigInt.fromI32(34026291) +); + +export const AAVE_ORACLE_CONTRACT_ADDRESS = ContractInfo.set( + Address.fromString("0xfd6f3c1845604c8ae6c6e402ad17fb9885160754"), + BigInt.fromI32(33142059) ); /////////////////////////////////////////////////////////////////////////// ///////////////////////////// CURVE CONTRACT ////////////////////////////// /////////////////////////////////////////////////////////////////////////// -export const CURVE_CALCULATIONS_ADDRESS = Address.fromString( - "0x0b53e9df372e72d8fdcdbedfbb56059957a37128" +export const CURVE_CALCULATIONS_ADDRESS = ContractInfo.set( + Address.fromString("0x0b53e9df372e72d8fdcdbedfbb56059957a37128"), + BigInt.fromI32(27067399) ); -export const CURVE_REGISTRY_ADDRESSES: Address[] = [ - Address.fromString("0x0f854EA9F38ceA4B1c2FC79047E9D0134419D5d6"), - Address.fromString("0x4fb93D7d320E8A263F22f62C2059dFC2A8bCbC4c"), +export const CURVE_REGISTRY_ADDRESSES = [ + ContractInfo.set( + Address.fromString("0x0f854ea9f38cea4b1c2fc79047e9d0134419d5d6"), + BigInt.fromI32(5655918) + ), + ContractInfo.set( + Address.fromString("0x4fb93d7d320e8a263f22f62c2059dfc2a8bcbc4c"), + BigInt.fromI32(27552509) + ), ]; /////////////////////////////////////////////////////////////////////////// /////////////////////////// UNISWAP FORKS CONTRACT //////////////////////// /////////////////////////////////////////////////////////////////////////// -export const UNISWAP_FORKS_ROUTER_ADDRESSES: Address[] = [ - Address.fromString("0xbe4fc72f8293f9d3512d58b969c98c3f676cb957"), // Uniswap - Address.fromString("0x16327E3FbDaCA3bcF7E38F5Af2599D2DDc33aE52"), // Spiritswap - Address.fromString("0x1b02da8cb0d097eb8d57a175b88c7d8b47997506"), // Sushiswap +export const SUSHISWAP_CALCULATIONS_ADDRESS = ContractInfo.set( + Address.fromString("0x44536de2220987d098d1d29d3aafc7f7348e9ee4"), + BigInt.fromI32(3809480) +); + +export const UNISWAP_FORKS_ROUTER_ADDRESSES = [ + ContractInfo.set( + Address.fromString("0xbe4fc72f8293f9d3512d58b969c98c3f676cb957"), // Uniswap + BigInt.fromI32(3796241) + ), + ContractInfo.set( + Address.fromString("0x1b02da8cb0d097eb8d57a175b88c7d8b47997506"), // SushiSwap + BigInt.fromI32(2457904) + ), + ContractInfo.set( + Address.fromString("0x16327e3fbdaca3bcf7e38f5af2599d2ddc33ae52"), // Spiritswap + BigInt.fromI32(4250168) + ), ]; /////////////////////////////////////////////////////////////////////////// /////////////////////////// BLACKLISTED TOKENS //////////////////////////// /////////////////////////////////////////////////////////////////////////// -export const YEARN_LENS_BLACKLIST: Address[] = []; +export const YEARN_LENS_BLACKLIST: Address[] = [ + Address.fromString("0xe578c856933d8e1082740bf7661e379aa2a30b26"), // GeistUSDC + Address.fromString("0xe3a486c1903ea794eed5d5fa0c9473c7d7708f40"), // Creditum USD + Address.fromString("0xc664fc7b8487a3e10824cda768c1d239f2403bbe"), // Geist MIM + Address.fromString("0x940f41f0ec9ba1a34cf001cc03347ac092f5f6b5"), // Geist fUSDT + Address.fromString("0x95dd59343a893637be1c3228060ee6afbf6f0730"), // Luna + Address.fromString("0xdbf31df14b66535af65aac99c32e9ea844e14501"), // renBTC + Address.fromString("0xc931f61b1534eb21d8c11b24f3f5ab2471d4ab50"), // Binance USD + Address.fromString("0xad84341756bf337f5a0164515b1f6f993d194e1f"), // Fantom USD + Address.fromString("0x658b0c7613e890ee50b8c4bc6a3f41ef411208ad"), // fETH + Address.fromString("0x25c130b2624cf12a4ea30143ef50c5d68cefa22f"), // geistETH +]; +export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = [ + Address.fromString("0xdbf31df14b66535af65aac99c32e9ea844e14501"), // renBTC + Address.fromString("0xc931f61b1534eb21d8c11b24f3f5ab2471d4ab50"), // Binance USD + Address.fromString("0xad84341756bf337f5a0164515b1f6f993d194e1f"), // Fantom USD + Address.fromString("0x658b0c7613e890ee50b8c4bc6a3f41ef411208ad"), // fETH +]; +export const INCH_ORACLE_BLACKLIST: Address[] = []; export const AAVE_ORACLE_BLACKLIST: Address[] = []; export const CURVE_CALCULATIONS_BLACKSLIST: Address[] = []; -export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = []; /////////////////////////////////////////////////////////////////////////// //////////////////////////// HARDCODED STABLES //////////////////////////// @@ -59,54 +102,97 @@ export const HARDCODED_STABLES: Address[] = []; ///////////////////////////////// HELPERS ///////////////////////////////// /////////////////////////////////////////////////////////////////////////// -export const USDC_TOKEN_DECIMALS = BigInt.fromI32(6); +export const WHITELISTED_TOKENS = new TypedMap(); + +WHITELISTED_TOKENS.set( + "USDC", + TokenInfo.set( + "USDC", + 6, + Address.fromString("0x04068da6c83afcfa0e13ba15a6696662335d5b75") + ) +); -export const ETH_ADDRESS = Address.fromString( - "0x658b0c7613e890ee50b8c4bc6a3f41ef411208ad" +WHITELISTED_TOKENS.set( + "USDT", + TokenInfo.set( + "USDT", + 6, + Address.fromString("0x049d68029688eabf473097a2fc38ef61633a3c7a") + ) ); -export const WETH_ADDRESS = Address.fromString( - "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83" + +WHITELISTED_TOKENS.set( + "DAI", + TokenInfo.set( + "DAI", + 18, + Address.fromString("0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e") + ) ); -export const USDC_ADDRESS = Address.fromString( - "0x04068da6c83afcfa0e13ba15a6696662335d5b75" + +WHITELISTED_TOKENS.set( + "WETH", + TokenInfo.set( + "WETH", + 18, + Address.fromString("0x25c130b2624cf12a4ea30143ef50c5d68cefa22f") + ) +); + +WHITELISTED_TOKENS.set( + "NATIVE_TOKEN", + TokenInfo.set( + "WFTM", + 18, + Address.fromString("0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83") + ) ); export class config implements Configurations { - yearnLens(): Address { + yearnLens(): ContractInfo | null { return YEARN_LENS_CONTRACT_ADDRESS; } - chainLink(): Address { - return CHAIN_LINK_CONTRACT_ADDRESS; - } yearnLensBlacklist(): Address[] { return YEARN_LENS_BLACKLIST; } - aaveOracle(): Address { + inchOracle(): ContractInfo | null { + return INCH_ORACLE_CONTRACT_ADDRESS; + } + inchOracleBlacklist(): Address[] { + return INCH_ORACLE_BLACKLIST; + } + + chainLink(): ContractInfo | null { + return null; + } + + aaveOracle(): ContractInfo | null { return AAVE_ORACLE_CONTRACT_ADDRESS; } aaveOracleBlacklist(): Address[] { return AAVE_ORACLE_BLACKLIST; } - curveCalculations(): Address { + curveCalculations(): ContractInfo | null { return CURVE_CALCULATIONS_ADDRESS; } curveCalculationsBlacklist(): Address[] { return CURVE_CALCULATIONS_BLACKSLIST; } - sushiCalculations(): Address { + sushiCalculations(): ContractInfo | null { return SUSHISWAP_CALCULATIONS_ADDRESS; } sushiCalculationsBlacklist(): Address[] { return SUSHI_CALCULATIONS_BLACKSLIST; } - uniswapForks(): Address[] { + uniswapForks(): ContractInfo[] { return UNISWAP_FORKS_ROUTER_ADDRESSES; } - curveRegistry(): Address[] { + curveRegistry(): ContractInfo[] { return CURVE_REGISTRY_ADDRESSES; } @@ -114,17 +200,7 @@ export class config implements Configurations { return HARDCODED_STABLES; } - ethAddress(): Address { - return ETH_ADDRESS; - } - wethAddress(): Address { - return WETH_ADDRESS; - } - usdcAddress(): Address { - return USDC_ADDRESS; - } - - usdcTokenDecimals(): BigInt { - return USDC_TOKEN_DECIMALS; + whitelistedTokens(): TypedMap { + return WHITELISTED_TOKENS; } } diff --git a/subgraphs/balancer-forks/src/prices/config/gnosis.ts b/subgraphs/balancer-forks/src/prices/config/gnosis.ts index c87db9353e..3cf747272f 100644 --- a/subgraphs/balancer-forks/src/prices/config/gnosis.ts +++ b/subgraphs/balancer-forks/src/prices/config/gnosis.ts @@ -1,6 +1,5 @@ -import * as constants from "../common/constants"; -import { Configurations } from "../common/types"; -import { Address, BigInt } from "@graphprotocol/graph-ts"; +import { Address, BigInt, TypedMap } from "@graphprotocol/graph-ts"; +import { Configurations, ContractInfo, TokenInfo } from "../common/types"; export const NETWORK_STRING: string = "xdai"; @@ -8,35 +7,41 @@ export const NETWORK_STRING: string = "xdai"; ///////////////////// CALCULATIONS/ORACLE CONTRACT //////////////////////// /////////////////////////////////////////////////////////////////////////// -export const YEARN_LENS_CONTRACT_ADDRESS = constants.NULL.TYPE_ADDRESS; -export const CHAIN_LINK_CONTRACT_ADDRESS = constants.NULL.TYPE_ADDRESS; -export const AAVE_ORACLE_CONTRACT_ADDRESS = constants.NULL.TYPE_ADDRESS; -export const SUSHISWAP_CALCULATIONS_ADDRESS = constants.NULL.TYPE_ADDRESS; - +export const INCH_ORACLE_CONTRACT_ADDRESS = ContractInfo.set( + Address.fromString("0x142db045195cecabe415161e1df1cf0337a4d02e"), + BigInt.fromI32(19731993) +); /////////////////////////////////////////////////////////////////////////// ///////////////////////////// CURVE CONTRACT ////////////////////////////// /////////////////////////////////////////////////////////////////////////// -export const CURVE_CALCULATIONS_ADDRESS = constants.NULL.TYPE_ADDRESS; - -export const CURVE_REGISTRY_ADDRESSES: Address[] = [ - Address.fromString("0x55E91365697EB8032F98290601847296eC847210"), - Address.fromString("0x8A4694401bE8F8FCCbC542a3219aF1591f87CE17"), +export const CURVE_REGISTRY_ADDRESSES = [ + ContractInfo.set( + Address.fromString("0x55e91365697eb8032f98290601847296ec847210"), + BigInt.fromI32(20754886) + ), + ContractInfo.set( + Address.fromString("0x8a4694401be8f8fccbc542a3219af1591f87ce17"), + BigInt.fromI32(23334728) + ), ]; /////////////////////////////////////////////////////////////////////////// /////////////////////////// UNISWAP FORKS CONTRACT //////////////////////// /////////////////////////////////////////////////////////////////////////// -export const UNISWAP_FORKS_ROUTER_ADDRESSES: Address[] = [ - Address.fromString("0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506"), // SushiSwap +export const UNISWAP_FORKS_ROUTER_ADDRESSES = [ + ContractInfo.set( + Address.fromString("0x1b02da8cb0d097eb8d57a175b88c7d8b47997506"), // SushiSwap + BigInt.fromI32(14735910) + ), ]; - /////////////////////////////////////////////////////////////////////////// /////////////////////////// BLACKLISTED TOKENS //////////////////////////// /////////////////////////////////////////////////////////////////////////// export const YEARN_LENS_BLACKLIST: Address[] = []; +export const INCH_ORACLE_BLACKLIST: Address[] = []; export const AAVE_ORACLE_BLACKLIST: Address[] = []; export const CURVE_CALCULATIONS_BLACKSLIST: Address[] = []; export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = []; @@ -51,54 +56,97 @@ export const HARDCODED_STABLES: Address[] = []; ///////////////////////////////// HELPERS ///////////////////////////////// /////////////////////////////////////////////////////////////////////////// -export const USDC_TOKEN_DECIMALS = BigInt.fromI32(6); +export const WHITELISTED_TOKENS = new TypedMap(); + +WHITELISTED_TOKENS.set( + "USDC", + TokenInfo.set( + "USDC", + 6, + Address.fromString("0xddafbb505ad214d7b80b1f830fccc89b60fb7a83") + ) +); -export const ETH_ADDRESS = Address.fromString( - "0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1" +WHITELISTED_TOKENS.set( + "USDT", + TokenInfo.set( + "USDT", + 6, + Address.fromString("0x4ecaba5870353805a9f068101a40e0f32ed605c6") + ) ); -export const WETH_ADDRESS = Address.fromString( - "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d" + +WHITELISTED_TOKENS.set( + "DAI", + TokenInfo.set( + "DAI", + 18, + Address.fromString("0xe91d153e0b41518a2ce8dd3d7944fa863463a97d") + ) ); -export const USDC_ADDRESS = Address.fromString( - "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83" + +WHITELISTED_TOKENS.set( + "WETH", + TokenInfo.set( + "WETH", + 18, + Address.fromString("0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1") + ) +); + +WHITELISTED_TOKENS.set( + "NATIVE_TOKEN", + TokenInfo.set( + "GNOSIS", + 18, + Address.fromString("0x9c58bacc331c9aa871afd802db6379a98e80cedb") + ) ); export class config implements Configurations { - yearnLens(): Address { - return YEARN_LENS_CONTRACT_ADDRESS; - } - chainLink(): Address { - return CHAIN_LINK_CONTRACT_ADDRESS; + yearnLens(): ContractInfo | null { + return null; } yearnLensBlacklist(): Address[] { return YEARN_LENS_BLACKLIST; } - aaveOracle(): Address { - return AAVE_ORACLE_CONTRACT_ADDRESS; + inchOracle(): ContractInfo | null { + return INCH_ORACLE_CONTRACT_ADDRESS; + } + inchOracleBlacklist(): Address[] { + return INCH_ORACLE_BLACKLIST; + } + + chainLink(): ContractInfo | null { + return null; + } + + aaveOracle(): ContractInfo | null { + return null; } aaveOracleBlacklist(): Address[] { return AAVE_ORACLE_BLACKLIST; } - curveCalculations(): Address { - return CURVE_CALCULATIONS_ADDRESS; + curveCalculations(): ContractInfo | null { + return null; } curveCalculationsBlacklist(): Address[] { return CURVE_CALCULATIONS_BLACKSLIST; } - sushiCalculations(): Address { - return SUSHISWAP_CALCULATIONS_ADDRESS; + sushiCalculations(): ContractInfo | null { + return null; } sushiCalculationsBlacklist(): Address[] { return SUSHI_CALCULATIONS_BLACKSLIST; } - uniswapForks(): Address[] { + uniswapForks(): ContractInfo[] { return UNISWAP_FORKS_ROUTER_ADDRESSES; } - curveRegistry(): Address[] { + curveRegistry(): ContractInfo[] { return CURVE_REGISTRY_ADDRESSES; } @@ -106,17 +154,7 @@ export class config implements Configurations { return HARDCODED_STABLES; } - ethAddress(): Address { - return ETH_ADDRESS; - } - wethAddress(): Address { - return WETH_ADDRESS; - } - usdcAddress(): Address { - return USDC_ADDRESS; - } - - usdcTokenDecimals(): BigInt { - return USDC_TOKEN_DECIMALS; + whitelistedTokens(): TypedMap { + return WHITELISTED_TOKENS; } } diff --git a/subgraphs/balancer-forks/src/prices/config/harmony.ts b/subgraphs/balancer-forks/src/prices/config/harmony.ts index ee4a14b412..e97e3f3192 100644 --- a/subgraphs/balancer-forks/src/prices/config/harmony.ts +++ b/subgraphs/balancer-forks/src/prices/config/harmony.ts @@ -1,6 +1,5 @@ -import * as constants from "../common/constants"; -import { Configurations } from "../common/types"; -import { Address, BigInt } from "@graphprotocol/graph-ts"; +import { Address, BigInt, TypedMap } from "@graphprotocol/graph-ts"; +import { Configurations, ContractInfo, TokenInfo } from "../common/types"; export const NETWORK_STRING = "harmony"; @@ -8,29 +7,31 @@ export const NETWORK_STRING = "harmony"; ///////////////////// CALCULATIONS/ORACLE CONTRACT //////////////////////// /////////////////////////////////////////////////////////////////////////// -export const YEARN_LENS_CONTRACT_ADDRESS = constants.NULL.TYPE_ADDRESS; -export const CHAIN_LINK_CONTRACT_ADDRESS = constants.NULL.TYPE_ADDRESS; -export const SUSHISWAP_CALCULATIONS_ADDRESS = constants.NULL.TYPE_ADDRESS; -export const AAVE_ORACLE_CONTRACT_ADDRESS = Address.fromString( - "0x3c90887ede8d65ccb2777a5d577beab2548280ad" +export const AAVE_ORACLE_CONTRACT_ADDRESS = ContractInfo.set( + Address.fromString("0x3c90887ede8d65ccb2777a5d577beab2548280ad"), + BigInt.fromI32(23930344) ); /////////////////////////////////////////////////////////////////////////// ///////////////////////////// CURVE CONTRACT ////////////////////////////// /////////////////////////////////////////////////////////////////////////// -export const CURVE_CALCULATIONS_ADDRESS = constants.NULL.TYPE_ADDRESS; - -export const CURVE_REGISTRY_ADDRESSES: Address[] = [ - Address.fromString("0x0a53FaDa2d943057C47A301D25a4D9b3B8e01e8E"), +export const CURVE_REGISTRY_ADDRESSES = [ + ContractInfo.set( + Address.fromString("0x0a53fada2d943057c47a301d25a4d9b3b8e01e8e"), + BigInt.fromI32(18003250) + ), ]; /////////////////////////////////////////////////////////////////////////// /////////////////////////// UNISWAP FORKS CONTRACT //////////////////////// /////////////////////////////////////////////////////////////////////////// -export const UNISWAP_FORKS_ROUTER_ADDRESSES: Address[] = [ - Address.fromString("0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506"), // SushiSwap +export const UNISWAP_FORKS_ROUTER_ADDRESSES = [ + ContractInfo.set( + Address.fromString("0x1b02da8cb0d097eb8d57a175b88c7d8b47997506"), // SushiSwap + BigInt.fromI32(11256069) + ), ]; /////////////////////////////////////////////////////////////////////////// @@ -38,6 +39,7 @@ export const UNISWAP_FORKS_ROUTER_ADDRESSES: Address[] = [ /////////////////////////////////////////////////////////////////////////// export const YEARN_LENS_BLACKLIST: Address[] = []; +export const INCH_ORACLE_BLACKLIST: Address[] = []; export const AAVE_ORACLE_BLACKLIST: Address[] = []; export const CURVE_CALCULATIONS_BLACKSLIST: Address[] = []; export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = []; @@ -52,54 +54,97 @@ export const HARDCODED_STABLES: Address[] = []; ///////////////////////////////// HELPERS ///////////////////////////////// /////////////////////////////////////////////////////////////////////////// -export const USDC_TOKEN_DECIMALS = BigInt.fromI32(6); +export const WHITELISTED_TOKENS = new TypedMap(); -export const ETH_ADDRESS = Address.fromString( - "0x6983D1E6DEf3690C4d616b13597A09e6193EA013" +WHITELISTED_TOKENS.set( + "USDC", + TokenInfo.set( + "USDC", + 6, + Address.fromString("0x985458e523db3d53125813ed68c274899e9dfab4") + ) ); -export const WETH_ADDRESS = Address.fromString( - "0xcF664087a5bB0237a0BAd6742852ec6c8d69A27a" + +WHITELISTED_TOKENS.set( + "USDT", + TokenInfo.set( + "USDT", + 6, + Address.fromString("0x3c2b8be99c50593081eaa2a724f0b8285f5aba8f") + ) ); -export const USDC_ADDRESS = Address.fromString( - "0x985458E523dB3d53125813eD68c274899e9DfAb4" + +WHITELISTED_TOKENS.set( + "DAI", + TokenInfo.set( + "DAI", + 18, + Address.fromString("0xef977d2f931c1978db5f6747666fa1eacb0d0339") + ) +); + +WHITELISTED_TOKENS.set( + "WETH", + TokenInfo.set( + "WETH", + 18, + Address.fromString("0x6983d1e6def3690c4d616b13597a09e6193ea013") + ) +); + +WHITELISTED_TOKENS.set( + "NATIVE_TOKEN", + TokenInfo.set( + "WONE", + 18, + Address.fromString("0xcf664087a5bb0237a0bad6742852ec6c8d69a27a") + ) ); export class config implements Configurations { - yearnLens(): Address { - return YEARN_LENS_CONTRACT_ADDRESS; - } - chainLink(): Address { - return CHAIN_LINK_CONTRACT_ADDRESS; + yearnLens(): ContractInfo | null { + return null; } yearnLensBlacklist(): Address[] { return YEARN_LENS_BLACKLIST; } - aaveOracle(): Address { + inchOracle(): ContractInfo | null { + return null; + } + inchOracleBlacklist(): Address[] { + return INCH_ORACLE_BLACKLIST; + } + + chainLink(): ContractInfo | null { + return null; + } + + aaveOracle(): ContractInfo | null { return AAVE_ORACLE_CONTRACT_ADDRESS; } aaveOracleBlacklist(): Address[] { return AAVE_ORACLE_BLACKLIST; } - curveCalculations(): Address { - return CURVE_CALCULATIONS_ADDRESS; + curveCalculations(): ContractInfo | null { + return null; } curveCalculationsBlacklist(): Address[] { return CURVE_CALCULATIONS_BLACKSLIST; } - sushiCalculations(): Address { - return SUSHISWAP_CALCULATIONS_ADDRESS; + sushiCalculations(): ContractInfo | null { + return null; } sushiCalculationsBlacklist(): Address[] { return SUSHI_CALCULATIONS_BLACKSLIST; } - uniswapForks(): Address[] { + uniswapForks(): ContractInfo[] { return UNISWAP_FORKS_ROUTER_ADDRESSES; } - curveRegistry(): Address[] { + curveRegistry(): ContractInfo[] { return CURVE_REGISTRY_ADDRESSES; } @@ -107,17 +152,7 @@ export class config implements Configurations { return HARDCODED_STABLES; } - ethAddress(): Address { - return ETH_ADDRESS; - } - wethAddress(): Address { - return WETH_ADDRESS; - } - usdcAddress(): Address { - return USDC_ADDRESS; - } - - usdcTokenDecimals(): BigInt { - return USDC_TOKEN_DECIMALS; + whitelistedTokens(): TypedMap { + return WHITELISTED_TOKENS; } } diff --git a/subgraphs/balancer-forks/src/prices/config/mainnet.ts b/subgraphs/balancer-forks/src/prices/config/mainnet.ts index d16642a0c5..47e750383b 100644 --- a/subgraphs/balancer-forks/src/prices/config/mainnet.ts +++ b/subgraphs/balancer-forks/src/prices/config/mainnet.ts @@ -1,6 +1,5 @@ -import * as constants from "../common/constants"; -import { Configurations } from "../common/types"; -import { Address, BigInt } from "@graphprotocol/graph-ts"; +import { Address, BigInt, TypedMap } from "@graphprotocol/graph-ts"; +import { Configurations, ContractInfo, TokenInfo } from "../common/types"; export const NETWORK_STRING = "mainnet"; @@ -8,46 +7,79 @@ export const NETWORK_STRING = "mainnet"; ///////////////////// CALCULATIONS/ORACLE CONTRACT //////////////////////// /////////////////////////////////////////////////////////////////////////// -export const YEARN_LENS_CONTRACT_ADDRESS = Address.fromString( - "0x83d95e0d5f402511db06817aff3f9ea88224b030" +export const YEARN_LENS_CONTRACT_ADDRESS = ContractInfo.set( + Address.fromString("0x83d95e0d5f402511db06817aff3f9ea88224b030"), + BigInt.fromI32(12242339) ); -export const CHAIN_LINK_CONTRACT_ADDRESS = Address.fromString( - "0x47Fb2585D2C56Fe188D0E6ec628a38b74fCeeeDf" + +export const INCH_ORACLE_CONTRACT_ADDRESS = ContractInfo.set( + Address.fromString("0x07d91f5fb9bf7798734c3f606db065549f6893bb"), + BigInt.fromI32(12522266) ); -export const AAVE_ORACLE_CONTRACT_ADDRESS = constants.NULL.TYPE_ADDRESS; -export const SUSHISWAP_CALCULATIONS_ADDRESS = Address.fromString( - "0x8263e161A855B644f582d9C164C66aABEe53f927" + +export const CHAIN_LINK_CONTRACT_ADDRESS = ContractInfo.set( + Address.fromString("0x47fb2585d2c56fe188d0e6ec628a38b74fceeedf"), + BigInt.fromI32(12864088) ); /////////////////////////////////////////////////////////////////////////// ///////////////////////////// CURVE CONTRACT ////////////////////////////// /////////////////////////////////////////////////////////////////////////// -export const CURVE_CALCULATIONS_ADDRESS = Address.fromString( - "0x25BF7b72815476Dd515044F9650Bf79bAd0Df655" +export const CURVE_CALCULATIONS_ADDRESS = ContractInfo.set( + Address.fromString("0x25bf7b72815476dd515044f9650bf79bad0df655"), + BigInt.fromI32(12370088) ); -export const CURVE_REGISTRY_ADDRESSES: Address[] = [ - Address.fromString("0x7D86446dDb609eD0F5f8684AcF30380a356b2B4c"), - Address.fromString("0x8F942C20D02bEfc377D41445793068908E2250D0"), +export const CURVE_REGISTRY_ADDRESSES = [ + ContractInfo.set( + Address.fromString("0x7d86446ddb609ed0f5f8684acf30380a356b2b4c"), + BigInt.fromI32(11154794) + ), + ContractInfo.set( + Address.fromString("0x8f942c20d02befc377d41445793068908e2250d0"), + BigInt.fromI32(13986752) + ), ]; /////////////////////////////////////////////////////////////////////////// /////////////////////////// UNISWAP FORKS CONTRACT //////////////////////// /////////////////////////////////////////////////////////////////////////// -export const UNISWAP_FORKS_ROUTER_ADDRESSES: Address[] = [ - Address.fromString("0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F"), // SushiSwap - Address.fromString("0x7a250d5630b4cf539739df2c5dacb4c659f2488d"), // Uniswap +export const SUSHISWAP_CALCULATIONS_ADDRESS = ContractInfo.set( + Address.fromString("0x5ea7e501c9a23f4a76dc7d33a11d995b13a1dd25"), + BigInt.fromI32(2396120) +); + +export const UNISWAP_FORKS_ROUTER_ADDRESSES = [ + ContractInfo.set( + Address.fromString("0x7a250d5630b4cf539739df2c5dacb4c659f2488d"), // Uniswap + BigInt.fromI32(10207858) + ), + ContractInfo.set( + Address.fromString("0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f"), // SushiSwap + BigInt.fromI32(10794261) + ), ]; /////////////////////////////////////////////////////////////////////////// /////////////////////////// BLACKLISTED TOKENS //////////////////////////// /////////////////////////////////////////////////////////////////////////// -export const YEARN_LENS_BLACKLIST: Address[] = []; +export const YEARN_LENS_BLACKLIST: Address[] = [ + Address.fromString("0x5f98805a4e8be255a32880fdec7f6728c6568ba0"), // LUSD + Address.fromString("0x8daebade922df735c38c80c7ebd708af50815faa"), // tBTC + Address.fromString("0x0316eb71485b0ab14103307bf65a021042c6d380"), // Huobi BTC + Address.fromString("0xca3d75ac011bf5ad07a98d02f18225f9bd9a6bdf"), // crvTriCrypto + Address.fromString("0xae7ab96520de3a18e5e111b5eaab095312d7fe84"), // stETH + Address.fromString("0xdbdb4d16eda451d0503b854cf79d55697f90c8df"), // Alchemix +]; +export const CURVE_CALCULATIONS_BLACKSLIST: Address[] = [ + Address.fromString("0xca3d75ac011bf5ad07a98d02f18225f9bd9a6bdf"), // crvTriCrypto + Address.fromString("0xc4ad29ba4b3c580e6d59105fff484999997675ff"), // crv3Crypto +]; +export const INCH_ORACLE_BLACKLIST: Address[] = []; export const AAVE_ORACLE_BLACKLIST: Address[] = []; -export const CURVE_CALCULATIONS_BLACKSLIST: Address[] = []; export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = []; /////////////////////////////////////////////////////////////////////////// @@ -64,7 +96,6 @@ export const HARDCODED_STABLES: Address[] = [ Address.fromString("0x4fd63966879300cafafbb35d157dc5229278ed23"), // bb-a-USD Address.fromString("0x9210f1204b5a24742eba12f710636d76240df3d0"), // bb-a-USDC deprecated Address.fromString("0x804cdb9116a10bb78768d3252355a1b18067bf8f"), // bb-a-DAI deprecated - Address.fromString("0x2bbf681cc4eb09218bee85ea2a5d3d13fa40fc0c"), // bb-a-USDT deprecated Address.fromString("0x652d486b80c461c397b0d95612a404da936f3db3"), // bb-a-USDC old Address.fromString("0xa3823e50f20982656557a4a6a9c06ba5467ae908"), // bb-a-DAI old Address.fromString("0xe6bcc79f328eec93d4ec8f7ed35534d9ab549faa"), // bb-a-USDT old @@ -77,54 +108,97 @@ export const HARDCODED_STABLES: Address[] = [ ///////////////////////////////// HELPERS ///////////////////////////////// /////////////////////////////////////////////////////////////////////////// -export const USDC_TOKEN_DECIMALS = BigInt.fromI32(6); +export const WHITELISTED_TOKENS = new TypedMap(); -export const ETH_ADDRESS = Address.fromString( - "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" +WHITELISTED_TOKENS.set( + "USDC", + TokenInfo.set( + "USDC", + 6, + Address.fromString("0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48") + ) ); -export const WETH_ADDRESS = Address.fromString( - "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" + +WHITELISTED_TOKENS.set( + "USDT", + TokenInfo.set( + "USDT", + 6, + Address.fromString("0xdac17f958d2ee523a2206206994597c13d831ec7") + ) +); + +WHITELISTED_TOKENS.set( + "DAI", + TokenInfo.set( + "DAI", + 18, + Address.fromString("0x6b175474e89094c44da98b954eedeac495271d0f") + ) ); -export const USDC_ADDRESS = Address.fromString( - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" + +WHITELISTED_TOKENS.set( + "WETH", + TokenInfo.set( + "WETH", + 18, + Address.fromString("0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2") + ) +); + +WHITELISTED_TOKENS.set( + "NATIVE_TOKEN", + TokenInfo.set( + "ETH", + 18, + Address.fromString("0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee") + ) ); export class config implements Configurations { - yearnLens(): Address { + yearnLens(): ContractInfo | null { return YEARN_LENS_CONTRACT_ADDRESS; } - chainLink(): Address { - return CHAIN_LINK_CONTRACT_ADDRESS; - } yearnLensBlacklist(): Address[] { return YEARN_LENS_BLACKLIST; } - aaveOracle(): Address { - return AAVE_ORACLE_CONTRACT_ADDRESS; + inchOracle(): ContractInfo | null { + return INCH_ORACLE_CONTRACT_ADDRESS; + } + inchOracleBlacklist(): Address[] { + return INCH_ORACLE_BLACKLIST; + } + + chainLink(): ContractInfo | null { + return CHAIN_LINK_CONTRACT_ADDRESS; + } + + aaveOracle(): ContractInfo | null { + return null; } aaveOracleBlacklist(): Address[] { return AAVE_ORACLE_BLACKLIST; } - curveCalculations(): Address { + curveCalculations(): ContractInfo | null { return CURVE_CALCULATIONS_ADDRESS; } curveCalculationsBlacklist(): Address[] { return CURVE_CALCULATIONS_BLACKSLIST; } - sushiCalculations(): Address { + sushiCalculations(): ContractInfo | null { return SUSHISWAP_CALCULATIONS_ADDRESS; } sushiCalculationsBlacklist(): Address[] { return SUSHI_CALCULATIONS_BLACKSLIST; } - uniswapForks(): Address[] { + uniswapForks(): ContractInfo[] { return UNISWAP_FORKS_ROUTER_ADDRESSES; } - curveRegistry(): Address[] { + curveRegistry(): ContractInfo[] { return CURVE_REGISTRY_ADDRESSES; } @@ -132,17 +206,7 @@ export class config implements Configurations { return HARDCODED_STABLES; } - ethAddress(): Address { - return ETH_ADDRESS; - } - wethAddress(): Address { - return WETH_ADDRESS; - } - usdcAddress(): Address { - return USDC_ADDRESS; - } - - usdcTokenDecimals(): BigInt { - return USDC_TOKEN_DECIMALS; + whitelistedTokens(): TypedMap { + return WHITELISTED_TOKENS; } } diff --git a/subgraphs/balancer-forks/src/prices/config/moonbeam.ts b/subgraphs/balancer-forks/src/prices/config/moonbeam.ts index 5b67ec81bc..80cab7ef3f 100644 --- a/subgraphs/balancer-forks/src/prices/config/moonbeam.ts +++ b/subgraphs/balancer-forks/src/prices/config/moonbeam.ts @@ -1,34 +1,31 @@ -import * as constants from "../common/constants"; -import { Configurations } from "../common/types"; -import { Address, BigInt } from "@graphprotocol/graph-ts"; +import { Address, BigInt, TypedMap } from "@graphprotocol/graph-ts"; +import { Configurations, ContractInfo, TokenInfo } from "../common/types"; export const NETWORK_STRING = "moonbeam"; -/////////////////////////////////////////////////////////////////////////// -///////////////////// CALCULATIONS/ORACLE CONTRACT //////////////////////// -/////////////////////////////////////////////////////////////////////////// - -export const YEARN_LENS_CONTRACT_ADDRESS = constants.NULL.TYPE_ADDRESS; -export const CHAIN_LINK_CONTRACT_ADDRESS = constants.NULL.TYPE_ADDRESS; -export const AAVE_ORACLE_CONTRACT_ADDRESS = constants.NULL.TYPE_ADDRESS; -export const SUSHISWAP_CALCULATIONS_ADDRESS = constants.NULL.TYPE_ADDRESS; - /////////////////////////////////////////////////////////////////////////// ///////////////////////////// CURVE CONTRACT ////////////////////////////// /////////////////////////////////////////////////////////////////////////// -export const CURVE_CALCULATIONS_ADDRESS = constants.NULL.TYPE_ADDRESS; - -export const CURVE_REGISTRY_ADDRESSES: Address[] = [ - Address.fromString("0xC2b1DF84112619D190193E48148000e3990Bf627"), +export const CURVE_REGISTRY_ADDRESSES = [ + ContractInfo.set( + Address.fromString("0xc2b1df84112619d190193e48148000e3990bf627"), + BigInt.fromI32(1452049) + ), ]; /////////////////////////////////////////////////////////////////////////// /////////////////////////// UNISWAP FORKS CONTRACT //////////////////////// /////////////////////////////////////////////////////////////////////////// - -export const UNISWAP_FORKS_ROUTER_ADDRESSES: Address[] = [ - Address.fromString("0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506"), // SushiSwap +export const UNISWAP_FORKS_ROUTER_ADDRESSES = [ + ContractInfo.set( + Address.fromString("0x96b244391D98B62D19aE89b1A4dCcf0fc56970C7"), // BeamSwap + BigInt.fromI32(199158) + ), + ContractInfo.set( + Address.fromString("0x1b02da8cb0d097eb8d57a175b88c7d8b47997506"), // SushiSwap + BigInt.fromI32(503734) + ), ]; /////////////////////////////////////////////////////////////////////////// @@ -36,6 +33,7 @@ export const UNISWAP_FORKS_ROUTER_ADDRESSES: Address[] = [ /////////////////////////////////////////////////////////////////////////// export const YEARN_LENS_BLACKLIST: Address[] = []; +export const INCH_ORACLE_BLACKLIST: Address[] = []; export const AAVE_ORACLE_BLACKLIST: Address[] = []; export const CURVE_CALCULATIONS_BLACKSLIST: Address[] = []; export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = []; @@ -44,60 +42,111 @@ export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = []; //////////////////////////// HARDCODED STABLES //////////////////////////// /////////////////////////////////////////////////////////////////////////// -export const HARDCODED_STABLES: Address[] = []; +export const HARDCODED_STABLES: Address[] = [ + Address.fromString("0x14df360966a1c4582d2b18edbdae432ea0a27575"), // Axelar Wrapped DAI + Address.fromString("0xca01a1d0993565291051daff390892518acfad3a"), // Axelar Wrapped USDC + Address.fromString("0xdfd74af792bc6d45d1803f425ce62dd16f8ae038"), // Axelar Wrapped USDT + Address.fromString("0x765277eebeca2e31912c9946eae1021199b39c61"), // DAI + Address.fromString("0x81ecac0d6be0550a00ff064a4f9dd2400585fe9c"), // USDT (Celer) + Address.fromString("0x8e70cd5b4ff3f62659049e74b6649c6603a0e594"), // USDT + Address.fromString("0xc234a67a4f840e61ade794be47de455361b52413"), // DAI +]; /////////////////////////////////////////////////////////////////////////// ///////////////////////////////// HELPERS ///////////////////////////////// /////////////////////////////////////////////////////////////////////////// -export const USDC_TOKEN_DECIMALS = BigInt.fromI32(6); +export const WHITELISTED_TOKENS = new TypedMap(); + +WHITELISTED_TOKENS.set( + "USDC", + TokenInfo.set( + "USDC", + 6, + Address.fromString("0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b") + ) +); -export const ETH_ADDRESS = Address.fromString( - "0xfa9343c3897324496a05fc75abed6bac29f8a40f" +WHITELISTED_TOKENS.set( + "USDT", + TokenInfo.set( + "USDT", + 6, + Address.fromString("0xefaeee334f0fd1712f9a8cc375f427d9cdd40d73") + ) ); -export const WETH_ADDRESS = Address.fromString( - "0xacc15dc74880c9944775448304b263d191c6077f" + +WHITELISTED_TOKENS.set( + "DAI", + TokenInfo.set( + "DAI", + 18, + Address.fromString("0x765277eebeca2e31912c9946eae1021199b39c61") + ) ); -export const USDC_ADDRESS = Address.fromString( - "0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b" + +WHITELISTED_TOKENS.set( + "WETH", + TokenInfo.set( + "WETH", + 18, + Address.fromString("0x30d2a9f5fdf90ace8c17952cbb4ee48a55d916a7") + ) +); + +WHITELISTED_TOKENS.set( + "NATIVE_TOKEN", + TokenInfo.set( + "GLMR", + 18, + Address.fromString("0xacc15dc74880c9944775448304b263d191c6077f") + ) ); export class config implements Configurations { - yearnLens(): Address { - return YEARN_LENS_CONTRACT_ADDRESS; - } - chainLink(): Address { - return CHAIN_LINK_CONTRACT_ADDRESS; + yearnLens(): ContractInfo | null { + return null; } yearnLensBlacklist(): Address[] { return YEARN_LENS_BLACKLIST; } - aaveOracle(): Address { - return AAVE_ORACLE_CONTRACT_ADDRESS; + inchOracle(): ContractInfo | null { + return null; + } + inchOracleBlacklist(): Address[] { + return INCH_ORACLE_BLACKLIST; + } + + chainLink(): ContractInfo | null { + return null; + } + + aaveOracle(): ContractInfo | null { + return null; } aaveOracleBlacklist(): Address[] { return AAVE_ORACLE_BLACKLIST; } - curveCalculations(): Address { - return CURVE_CALCULATIONS_ADDRESS; + curveCalculations(): ContractInfo | null { + return null; } curveCalculationsBlacklist(): Address[] { return CURVE_CALCULATIONS_BLACKSLIST; } - sushiCalculations(): Address { - return SUSHISWAP_CALCULATIONS_ADDRESS; + sushiCalculations(): ContractInfo | null { + return null; } sushiCalculationsBlacklist(): Address[] { return SUSHI_CALCULATIONS_BLACKSLIST; } - uniswapForks(): Address[] { + uniswapForks(): ContractInfo[] { return UNISWAP_FORKS_ROUTER_ADDRESSES; } - curveRegistry(): Address[] { + curveRegistry(): ContractInfo[] { return CURVE_REGISTRY_ADDRESSES; } @@ -105,17 +154,7 @@ export class config implements Configurations { return HARDCODED_STABLES; } - ethAddress(): Address { - return ETH_ADDRESS; - } - wethAddress(): Address { - return WETH_ADDRESS; - } - usdcAddress(): Address { - return USDC_ADDRESS; - } - - usdcTokenDecimals(): BigInt { - return USDC_TOKEN_DECIMALS; + whitelistedTokens(): TypedMap { + return WHITELISTED_TOKENS; } } diff --git a/subgraphs/balancer-forks/src/prices/config/optimism.ts b/subgraphs/balancer-forks/src/prices/config/optimism.ts index 91d04fc950..9932ef0dd6 100644 --- a/subgraphs/balancer-forks/src/prices/config/optimism.ts +++ b/subgraphs/balancer-forks/src/prices/config/optimism.ts @@ -1,6 +1,5 @@ -import * as constants from "../common/constants"; -import { Configurations } from "../common/types"; -import { Address, BigInt } from "@graphprotocol/graph-ts"; +import { Address, BigInt, TypedMap } from "@graphprotocol/graph-ts"; +import { Configurations, ContractInfo, TokenInfo } from "../common/types"; export const NETWORK_STRING = "optimism"; @@ -8,42 +7,63 @@ export const NETWORK_STRING = "optimism"; ///////////////////// CALCULATIONS/ORACLE CONTRACT //////////////////////// /////////////////////////////////////////////////////////////////////////// -export const YEARN_LENS_CONTRACT_ADDRESS = Address.fromString( - "0xb082d9f4734c535d9d80536f7e87a6f4f471bf65" +export const YEARN_LENS_CONTRACT_ADDRESS = ContractInfo.set( + Address.fromString("0xb082d9f4734c535d9d80536f7e87a6f4f471bf65"), + BigInt.fromI32(18109291) ); -export const CHAIN_LINK_CONTRACT_ADDRESS = constants.NULL.TYPE_ADDRESS; -export const AAVE_ORACLE_CONTRACT_ADDRESS = Address.fromString( - "0xD81eb3728a631871a7eBBaD631b5f424909f0c77" + +export const INCH_ORACLE_CONTRACT_ADDRESS = ContractInfo.set( + Address.fromString("0x11dee30e710b8d4a8630392781cc3c0046365d4c"), + BigInt.fromI32(0) ); -export const SUSHISWAP_CALCULATIONS_ADDRESS = Address.fromString( - "0x5fd3815dcb668200a662114fbc9af13ac0a55b4d" + +export const AAVE_ORACLE_CONTRACT_ADDRESS = ContractInfo.set( + Address.fromString("0xd81eb3728a631871a7ebbad631b5f424909f0c77"), + BigInt.fromI32(4365625) ); /////////////////////////////////////////////////////////////////////////// ///////////////////////////// CURVE CONTRACT ////////////////////////////// /////////////////////////////////////////////////////////////////////////// -export const CURVE_CALCULATIONS_ADDRESS = Address.fromString( - "0x0ffe8434eae67c9838b12c3cd11ac4005daa7227" +export const CURVE_CALCULATIONS_ADDRESS = ContractInfo.set( + Address.fromString("0x0ffe8434eae67c9838b12c3cd11ac4005daa7227"), + BigInt.fromI32(18368996) ); -export const CURVE_REGISTRY_ADDRESSES: Address[] = [ - Address.fromString("0xC5cfaDA84E902aD92DD40194f0883ad49639b023"), - Address.fromString("0x7DA64233Fefb352f8F501B357c018158ED8aA455"), +export const CURVE_REGISTRY_ADDRESSES = [ + ContractInfo.set( + Address.fromString("0xc5cfada84e902ad92dd40194f0883ad49639b023"), + BigInt.fromI32(2373837) + ), + ContractInfo.set( + Address.fromString("0x7da64233fefb352f8f501b357c018158ed8aa455"), + BigInt.fromI32(3729171) + ), ]; /////////////////////////////////////////////////////////////////////////// /////////////////////////// UNISWAP FORKS CONTRACT //////////////////////// /////////////////////////////////////////////////////////////////////////// -export const UNISWAP_FORKS_ROUTER_ADDRESSES: Address[] = [ - Address.fromString("0x9c12939390052919aF3155f41Bf4160Fd3666A6f"), // Velodrame +export const SUSHISWAP_CALCULATIONS_ADDRESS = ContractInfo.set( + Address.fromString("0x5fd3815dcb668200a662114fbc9af13ac0a55b4d"), + BigInt.fromI32(18216910) +); + +export const UNISWAP_FORKS_ROUTER_ADDRESSES = [ + ContractInfo.set( + Address.fromString("0x9c12939390052919af3155f41bf4160fd3666a6f"), // Velodrame + BigInt.fromI32(19702709) + ), ]; + /////////////////////////////////////////////////////////////////////////// /////////////////////////// BLACKLISTED TOKENS //////////////////////////// /////////////////////////////////////////////////////////////////////////// export const YEARN_LENS_BLACKLIST: Address[] = []; +export const INCH_ORACLE_BLACKLIST: Address[] = []; export const AAVE_ORACLE_BLACKLIST: Address[] = []; export const CURVE_CALCULATIONS_BLACKSLIST: Address[] = []; export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = []; @@ -58,54 +78,97 @@ export const HARDCODED_STABLES: Address[] = []; ///////////////////////////////// HELPERS ///////////////////////////////// /////////////////////////////////////////////////////////////////////////// -export const USDC_TOKEN_DECIMALS = BigInt.fromI32(6); +export const WHITELISTED_TOKENS = new TypedMap(); -export const ETH_ADDRESS = Address.fromString( - "0x4200000000000000000000000000000000000042" +WHITELISTED_TOKENS.set( + "USDC", + TokenInfo.set( + "USDC", + 6, + Address.fromString("0x7f5c764cbc14f9669b88837ca1490cca17c31607") + ) ); -export const WETH_ADDRESS = Address.fromString( - "0x4200000000000000000000000000000000000006" + +WHITELISTED_TOKENS.set( + "USDT", + TokenInfo.set( + "USDT", + 6, + Address.fromString("0x94b008aa00579c1307b0ef2c499ad98a8ce58e58") + ) ); -export const USDC_ADDRESS = Address.fromString( - "0x7f5c764cbc14f9669b88837ca1490cca17c31607" + +WHITELISTED_TOKENS.set( + "DAI", + TokenInfo.set( + "DAI", + 18, + Address.fromString("0xda10009cbd5d07dd0cecc66161fc93d7c9000da1") + ) +); + +WHITELISTED_TOKENS.set( + "WETH", + TokenInfo.set( + "WETH", + 18, + Address.fromString("0x4200000000000000000000000000000000000006") + ) +); + +WHITELISTED_TOKENS.set( + "NATIVE_TOKEN", + TokenInfo.set( + "Optimism", + 18, + Address.fromString("0x4200000000000000000000000000000000000042") + ) ); export class config implements Configurations { - yearnLens(): Address { + yearnLens(): ContractInfo | null { return YEARN_LENS_CONTRACT_ADDRESS; } - chainLink(): Address { - return CHAIN_LINK_CONTRACT_ADDRESS; - } yearnLensBlacklist(): Address[] { return YEARN_LENS_BLACKLIST; } - aaveOracle(): Address { + inchOracle(): ContractInfo | null { + return INCH_ORACLE_CONTRACT_ADDRESS; + } + inchOracleBlacklist(): Address[] { + return INCH_ORACLE_BLACKLIST; + } + + chainLink(): ContractInfo | null { + return null; + } + + aaveOracle(): ContractInfo | null { return AAVE_ORACLE_CONTRACT_ADDRESS; } aaveOracleBlacklist(): Address[] { return AAVE_ORACLE_BLACKLIST; } - curveCalculations(): Address { + curveCalculations(): ContractInfo | null { return CURVE_CALCULATIONS_ADDRESS; } curveCalculationsBlacklist(): Address[] { return CURVE_CALCULATIONS_BLACKSLIST; } - sushiCalculations(): Address { + sushiCalculations(): ContractInfo | null { return SUSHISWAP_CALCULATIONS_ADDRESS; } sushiCalculationsBlacklist(): Address[] { return SUSHI_CALCULATIONS_BLACKSLIST; } - uniswapForks(): Address[] { + uniswapForks(): ContractInfo[] { return UNISWAP_FORKS_ROUTER_ADDRESSES; } - curveRegistry(): Address[] { + curveRegistry(): ContractInfo[] { return CURVE_REGISTRY_ADDRESSES; } @@ -113,17 +176,7 @@ export class config implements Configurations { return HARDCODED_STABLES; } - ethAddress(): Address { - return ETH_ADDRESS; - } - wethAddress(): Address { - return WETH_ADDRESS; - } - usdcAddress(): Address { - return USDC_ADDRESS; - } - - usdcTokenDecimals(): BigInt { - return USDC_TOKEN_DECIMALS; + whitelistedTokens(): TypedMap { + return WHITELISTED_TOKENS; } } diff --git a/subgraphs/balancer-forks/src/prices/config/polygon.ts b/subgraphs/balancer-forks/src/prices/config/polygon.ts index 703f54dcf3..26a596929d 100644 --- a/subgraphs/balancer-forks/src/prices/config/polygon.ts +++ b/subgraphs/balancer-forks/src/prices/config/polygon.ts @@ -1,6 +1,5 @@ -import * as constants from "../common/constants"; -import { Configurations } from "../common/types"; -import { BigInt, Address } from "@graphprotocol/graph-ts"; +import { BigInt, Address, TypedMap } from "@graphprotocol/graph-ts"; +import { Configurations, ContractInfo, TokenInfo } from "../common/types"; export const NETWORK_STRING = "matic"; @@ -8,32 +7,44 @@ export const NETWORK_STRING = "matic"; ///////////////////// CALCULATIONS/ORACLE CONTRACT //////////////////////// /////////////////////////////////////////////////////////////////////////// -export const YEARN_LENS_CONTRACT_ADDRESS = constants.NULL.TYPE_ADDRESS; -export const CHAIN_LINK_CONTRACT_ADDRESS = constants.NULL.TYPE_ADDRESS; -export const SUSHISWAP_CALCULATIONS_ADDRESS = constants.NULL.TYPE_ADDRESS; +export const INCH_ORACLE_CONTRACT_ADDRESS = ContractInfo.set( + Address.fromString("0x7f069df72b7a39bce9806e3afaf579e54d8cf2b9"), + BigInt.fromI32(15030523) +); -export const AAVE_ORACLE_CONTRACT_ADDRESS = Address.fromString( - "0xb023e699F5a33916Ea823A16485e259257cA8Bd1" +export const AAVE_ORACLE_CONTRACT_ADDRESS = ContractInfo.set( + Address.fromString("0xb023e699f5a33916ea823a16485e259257ca8bd1"), + BigInt.fromI32(25825996) ); /////////////////////////////////////////////////////////////////////////// ///////////////////////////// CURVE CONTRACT ////////////////////////////// /////////////////////////////////////////////////////////////////////////// -export const CURVE_CALCULATIONS_ADDRESS = constants.NULL.TYPE_ADDRESS; - -export const CURVE_REGISTRY_ADDRESSES: Address[] = [ - Address.fromString("0x094d12e5b541784701FD8d65F11fc0598FBC6332"), - Address.fromString("0x47bB542B9dE58b970bA50c9dae444DDB4c16751a"), +export const CURVE_REGISTRY_ADDRESSES = [ + ContractInfo.set( + Address.fromString("0x094d12e5b541784701fd8d65f11fc0598fbc6332"), + BigInt.fromI32(13991825) + ), + ContractInfo.set( + Address.fromString("0x47bb542b9de58b970ba50c9dae444ddb4c16751a"), + BigInt.fromI32(23556360) + ), ]; /////////////////////////////////////////////////////////////////////////// /////////////////////////// UNISWAP FORKS CONTRACT //////////////////////// /////////////////////////////////////////////////////////////////////////// -export const UNISWAP_FORKS_ROUTER_ADDRESSES: Address[] = [ - Address.fromString("0xa5e0829caced8ffdd4de3c43696c57f7d7a678ff"), // QuickSwap - Address.fromString("0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506"), // SushiSwap +export const UNISWAP_FORKS_ROUTER_ADDRESSES = [ + ContractInfo.set( + Address.fromString("0xa5e0829caced8ffdd4de3c43696c57f7d7a678ff"), // QuickSwap + BigInt.fromI32(4931900) + ), + ContractInfo.set( + Address.fromString("0x1b02da8cb0d097eb8d57a175b88c7d8b47997506"), // SushiSwap + BigInt.fromI32(11333235) + ), ]; /////////////////////////////////////////////////////////////////////////// @@ -41,6 +52,10 @@ export const UNISWAP_FORKS_ROUTER_ADDRESSES: Address[] = [ /////////////////////////////////////////////////////////////////////////// export const YEARN_LENS_BLACKLIST: Address[] = []; +export const INCH_ORACLE_BLACKLIST: Address[] = [ + Address.fromString("0xf8a57c1d3b9629b77b6726a042ca48990a84fb49"), // btcCRV + Address.fromString("0xdad97f7713ae9437fa9249920ec8507e5fbb23d3") // Curve USD-BTC-ETH +]; export const AAVE_ORACLE_BLACKLIST: Address[] = []; export const CURVE_CALCULATIONS_BLACKSLIST: Address[] = []; export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = []; @@ -49,60 +64,109 @@ export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = []; //////////////////////////// HARDCODED STABLES //////////////////////////// /////////////////////////////////////////////////////////////////////////// -export const HARDCODED_STABLES: Address[] = []; +export const HARDCODED_STABLES: Address[] = [ + Address.fromString("0x1a13f4ca1d028320a707d99520abfefca3998b7f"), // Aave Matic Market USDC + Address.fromString("0x27f8d03b3a2196956ed754badc28d73be8830a6e"), // Aave Matic Market DAI + Address.fromString("0x60d55f02a771d515e077c9c2403a1ef324885cec"), // Aave Matic Market USDT + Address.fromString("0xe2aa7db6da1dae97c5f5c6914d285fbfcc32a128"), // PAR Stablecoin (PAR) + Address.fromString("0x7bdf330f423ea880ff95fc41a280fd5ecfd3d09f"), // Euro Tether (PoS) +]; /////////////////////////////////////////////////////////////////////////// ///////////////////////////////// HELPERS ///////////////////////////////// /////////////////////////////////////////////////////////////////////////// -export const USDC_TOKEN_DECIMALS = BigInt.fromI32(6); +export const WHITELISTED_TOKENS = new TypedMap(); + +WHITELISTED_TOKENS.set( + "USDC", + TokenInfo.set( + "USDC", + 6, + Address.fromString("0x2791bca1f2de4661ed88a30c99a7a9449aa84174") + ) +); -export const ETH_ADDRESS = Address.fromString( - "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619" +WHITELISTED_TOKENS.set( + "USDT", + TokenInfo.set( + "USDT", + 6, + Address.fromString("0xc2132d05d31c914a87c6611c10748aeb04b58e8f") + ) ); -export const WETH_ADDRESS = Address.fromString( - "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270" + +WHITELISTED_TOKENS.set( + "DAI", + TokenInfo.set( + "DAI", + 18, + Address.fromString("0x8f3cf7ad23cd3cadbd9735aff958023239c6a063") + ) ); -export const USDC_ADDRESS = Address.fromString( - "0x2791bca1f2de4661ed88a30c99a7a9449aa84174" + +WHITELISTED_TOKENS.set( + "WETH", + TokenInfo.set( + "WETH", + 18, + Address.fromString("0x7ceb23fd6bc0add59e62ac25578270cff1b9f619") + ) +); + +WHITELISTED_TOKENS.set( + "NATIVE_TOKEN", + TokenInfo.set( + "MATIC", + 18, + Address.fromString("0x0000000000000000000000000000000000001010") + ) ); export class config implements Configurations { - yearnLens(): Address { - return YEARN_LENS_CONTRACT_ADDRESS; - } - chainLink(): Address { - return CHAIN_LINK_CONTRACT_ADDRESS; + yearnLens(): ContractInfo | null { + return null; } yearnLensBlacklist(): Address[] { return YEARN_LENS_BLACKLIST; } - aaveOracle(): Address { + inchOracle(): ContractInfo | null { + return INCH_ORACLE_CONTRACT_ADDRESS; + } + inchOracleBlacklist(): Address[] { + return INCH_ORACLE_BLACKLIST; + } + + chainLink(): ContractInfo | null { + return null; + } + + aaveOracle(): ContractInfo | null { return AAVE_ORACLE_CONTRACT_ADDRESS; } aaveOracleBlacklist(): Address[] { return AAVE_ORACLE_BLACKLIST; } - curveCalculations(): Address { - return CURVE_CALCULATIONS_ADDRESS; + curveCalculations(): ContractInfo | null { + return null; } curveCalculationsBlacklist(): Address[] { return CURVE_CALCULATIONS_BLACKSLIST; } - sushiCalculations(): Address { - return SUSHISWAP_CALCULATIONS_ADDRESS; + sushiCalculations(): ContractInfo | null { + return null; } sushiCalculationsBlacklist(): Address[] { return SUSHI_CALCULATIONS_BLACKSLIST; } - uniswapForks(): Address[] { + uniswapForks(): ContractInfo[] { return UNISWAP_FORKS_ROUTER_ADDRESSES; } - curveRegistry(): Address[] { + curveRegistry(): ContractInfo[] { return CURVE_REGISTRY_ADDRESSES; } @@ -110,17 +174,7 @@ export class config implements Configurations { return HARDCODED_STABLES; } - ethAddress(): Address { - return ETH_ADDRESS; - } - wethAddress(): Address { - return WETH_ADDRESS; - } - usdcAddress(): Address { - return USDC_ADDRESS; - } - - usdcTokenDecimals(): BigInt { - return USDC_TOKEN_DECIMALS; + whitelistedTokens(): TypedMap { + return WHITELISTED_TOKENS; } } diff --git a/subgraphs/balancer-forks/src/prices/index.ts b/subgraphs/balancer-forks/src/prices/index.ts index 121400e461..c4a6112b84 100644 --- a/subgraphs/balancer-forks/src/prices/index.ts +++ b/subgraphs/balancer-forks/src/prices/index.ts @@ -2,102 +2,64 @@ import * as utils from "./common/utils"; import * as constants from "./common/constants"; import { CustomPriceType } from "./common/types"; import * as AaveOracle from "./oracles/AaveOracle"; +import * as InchOracle from "./oracles/InchOracle"; import * as CurveRouter from "./routers/CurveRouter"; import * as ChainLinkFeed from "./oracles/ChainLinkFeed"; import * as YearnLensOracle from "./oracles/YearnLensOracle"; -import { log, Address, BigDecimal } from "@graphprotocol/graph-ts"; import * as UniswapForksRouter from "./routers/UniswapForksRouter"; import * as CurveCalculations from "./calculations/CalculationsCurve"; import * as SushiCalculations from "./calculations/CalculationsSushiswap"; +import { log, Address, BigDecimal, ethereum } from "@graphprotocol/graph-ts"; -export function getUsdPricePerToken(tokenAddr: Address): CustomPriceType { +export function getUsdPricePerToken( + tokenAddr: Address, + block: ethereum.Block | null = null +): CustomPriceType { const config = utils.getConfig(); - if (constants.BLACKLISTED_TOKENS.includes(tokenAddr) || !config) { + if (!config || constants.BLACKLISTED_TOKENS.includes(tokenAddr)) return new CustomPriceType(); - } - if (config.hardcodedStables().includes(tokenAddr)) { - return CustomPriceType.initialize( - constants.BIGDECIMAL_USD_PRICE, - constants.DEFAULT_USDC_DECIMALS + if (config.hardcodedStables().includes(tokenAddr)) + return CustomPriceType.initializePegged(); + + if (tokenAddr.equals(constants.ETH_ADDRESS)) + return getUsdPricePerToken( + config.whitelistedTokens().mustGet("WETH").address, + block ); - } - - // 1. Yearn Lens Oracle - const yearnLensPrice = YearnLensOracle.getTokenPriceUSDC(tokenAddr); - if (!yearnLensPrice.reverted) { - log.info("[YearnLensOracle] tokenAddress: {}, Price: {}", [ - tokenAddr.toHexString(), - yearnLensPrice.usdPrice.div(yearnLensPrice.decimalsBaseTen).toString(), - ]); - return yearnLensPrice; - } - - // 2. ChainLink Feed Registry - const chainLinkPrice = ChainLinkFeed.getTokenPriceUSDC(tokenAddr); - if (!chainLinkPrice.reverted) { - log.info("[ChainLinkFeed] tokenAddress: {}, Price: {}", [ - tokenAddr.toHexString(), - chainLinkPrice.usdPrice.div(chainLinkPrice.decimalsBaseTen).toString(), - ]); - return chainLinkPrice; - } - - // 3. CalculationsCurve - const calculationsCurvePrice = CurveCalculations.getTokenPriceUSDC(tokenAddr); - if (!calculationsCurvePrice.reverted) { - log.info("[CalculationsCurve] tokenAddress: {}, Price: {}", [ - tokenAddr.toHexString(), - calculationsCurvePrice.usdPrice - .div(calculationsCurvePrice.decimalsBaseTen) - .toString(), - ]); - return calculationsCurvePrice; - } - - // 4. CalculationsSushiSwap - const calculationsSushiSwapPrice = - SushiCalculations.getTokenPriceUSDC(tokenAddr); - if (!calculationsSushiSwapPrice.reverted) { - log.info("[CalculationsSushiSwap] tokenAddress: {}, Price: {}", [ - tokenAddr.toHexString(), - calculationsSushiSwapPrice.usdPrice - .div(calculationsSushiSwapPrice.decimalsBaseTen) - .toString(), - ]); - return calculationsSushiSwapPrice; - } + + // 1. YearnLens Oracle + const yearnLensPrice = YearnLensOracle.getTokenPriceUSDC(tokenAddr, block); + if (!yearnLensPrice.reverted) return yearnLensPrice; + + // 2. InchOracle + const inchOraclePrice = InchOracle.getTokenPriceUSDC(tokenAddr, block); + if (!inchOraclePrice.reverted) return inchOraclePrice; + + // 3. ChainLink Feed Registry + const chainLinkPrice = ChainLinkFeed.getTokenPriceUSDC(tokenAddr, block); + if (!chainLinkPrice.reverted) return chainLinkPrice; + + // 4. CalculationsCurve + const curvePrice = CurveCalculations.getTokenPriceUSDC(tokenAddr, block); + if (!curvePrice.reverted) return curvePrice; + + // 5. CalculationsSushiSwap + const sushiSwapPrice = SushiCalculations.getTokenPriceUSDC(tokenAddr, block); + if (!sushiSwapPrice.reverted) return sushiSwapPrice; // 6. Aave Oracle - const aaveOraclePrice = AaveOracle.getTokenPriceUSDC(tokenAddr); - if (!aaveOraclePrice.reverted) { - log.info("[AaveOracle] tokenAddress: {}, Price: {}", [ - tokenAddr.toHexString(), - aaveOraclePrice.usdPrice.div(aaveOraclePrice.decimalsBaseTen).toString(), - ]); - return aaveOraclePrice; - } + const aaveOraclePrice = AaveOracle.getTokenPriceUSDC(tokenAddr, block); + if (!aaveOraclePrice.reverted) return aaveOraclePrice; // 7. Curve Router - const curvePrice = CurveRouter.getCurvePriceUsdc(tokenAddr); - if (!curvePrice.reverted) { - log.info("[CurveRouter] tokenAddress: {}, Price: {}", [ - tokenAddr.toHexString(), - curvePrice.usdPrice.div(curvePrice.decimalsBaseTen).toString(), - ]); - return curvePrice; - } + const curveRouterPrice = CurveRouter.getPriceUsdc(tokenAddr, block); + if (!curveRouterPrice.reverted) return curveRouterPrice; // 8. Uniswap Router const uniswapPrice = UniswapForksRouter.getTokenPriceUSDC(tokenAddr); - if (!uniswapPrice.reverted) { - log.info("[UniswapRouter] tokenAddress: {}, Price: {}", [ - tokenAddr.toHexString(), - uniswapPrice.usdPrice.div(uniswapPrice.decimalsBaseTen).toString(), - ]); - return uniswapPrice; - } + if (!uniswapPrice.reverted) return uniswapPrice; log.warning("[Oracle] Failed to Fetch Price, tokenAddr: {}", [ tokenAddr.toHexString(), @@ -108,13 +70,11 @@ export function getUsdPricePerToken(tokenAddr: Address): CustomPriceType { export function getUsdPrice( tokenAddr: Address, - amount: BigDecimal + amount: BigDecimal, + block: ethereum.Block ): BigDecimal { - const tokenPrice = getUsdPricePerToken(tokenAddr); - - if (!tokenPrice.reverted) { - return tokenPrice.usdPrice.times(amount).div(tokenPrice.decimalsBaseTen); - } + const tokenPrice = getUsdPricePerToken(tokenAddr, block); + if (!tokenPrice.reverted) return tokenPrice.usdPrice.times(amount); return constants.BIGDECIMAL_ZERO; } diff --git a/subgraphs/balancer-forks/src/prices/oracles/AaveOracle.ts b/subgraphs/balancer-forks/src/prices/oracles/AaveOracle.ts index d7ffadf5c6..a73722d727 100644 --- a/subgraphs/balancer-forks/src/prices/oracles/AaveOracle.ts +++ b/subgraphs/balancer-forks/src/prices/oracles/AaveOracle.ts @@ -1,25 +1,20 @@ 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 { Address, BigDecimal, BigInt, ethereum } from "@graphprotocol/graph-ts"; import { AaveOracleContract } from "../../../generated/Vault/AaveOracleContract"; -export function getAaveOracleContract( - contractAddress: Address -): AaveOracleContract | null { - if (utils.isNullAddress(contractAddress)) return null; - - return AaveOracleContract.bind(contractAddress); -} - -export function getTokenPriceUSDC(tokenAddr: Address): CustomPriceType { +export function getTokenPriceUSDC( + tokenAddr: Address, + block: ethereum.Block | null = null +): CustomPriceType { const config = utils.getConfig(); + const contractAddress = utils.getContract(config.aaveOracle(), block); - if (!config || config.aaveOracleBlacklist().includes(tokenAddr)) + if (!contractAddress || config.aaveOracleBlacklist().includes(tokenAddr)) return new CustomPriceType(); - const aaveOracleContract = getAaveOracleContract(config.aaveOracle()); - if (!aaveOracleContract) return new CustomPriceType(); + const aaveOracleContract = AaveOracleContract.bind(contractAddress); const tokenPrice: BigDecimal = utils .readValue( @@ -28,5 +23,9 @@ export function getTokenPriceUSDC(tokenAddr: Address): CustomPriceType { ) .toBigDecimal(); - return CustomPriceType.initialize(tokenPrice, constants.AAVE_ORACLE_DECIMALS); + return CustomPriceType.initialize( + tokenPrice, + constants.DEFAULT_AAVE_ORACLE_DECIMALS, + constants.OracleType.AAVE_ORACLE + ); } diff --git a/subgraphs/balancer-forks/src/prices/oracles/ChainLinkFeed.ts b/subgraphs/balancer-forks/src/prices/oracles/ChainLinkFeed.ts index 4cf2590199..c5e7781746 100644 --- a/subgraphs/balancer-forks/src/prices/oracles/ChainLinkFeed.ts +++ b/subgraphs/balancer-forks/src/prices/oracles/ChainLinkFeed.ts @@ -1,41 +1,37 @@ import * as utils from "../common/utils"; import * as constants from "../common/constants"; -import { Address } from "@graphprotocol/graph-ts"; import { CustomPriceType } from "../common/types"; +import { Address, ethereum } from "@graphprotocol/graph-ts"; import { ChainLinkContract } from "../../../generated/Vault/ChainLinkContract"; -export function getChainLinkContract(): ChainLinkContract | null { +export function getTokenPriceUSDC( + tokenAddr: Address, + block: ethereum.Block | null = null +): CustomPriceType { const config = utils.getConfig(); - if (!config || utils.isNullAddress(config.chainLink())) return null; + const contractAddress = utils.getContract(config.chainLink(), block); - return ChainLinkContract.bind(config.chainLink()); -} - -export function getTokenPriceUSDC(tokenAddr: Address): CustomPriceType { - const chainLinkContract = getChainLinkContract(); - - if (!chainLinkContract) { - return new CustomPriceType(); - } + if (!contractAddress) return new CustomPriceType(); + const chainLinkContract = ChainLinkContract.bind(contractAddress); const result = chainLinkContract.try_latestRoundData( tokenAddr, constants.CHAIN_LINK_USD_ADDRESS ); if (!result.reverted) { - const decimals = chainLinkContract.try_decimals( - tokenAddr, - constants.CHAIN_LINK_USD_ADDRESS + const decimals = utils.readValue( + chainLinkContract.try_decimals( + tokenAddr, + constants.CHAIN_LINK_USD_ADDRESS + ), + constants.DEFAULT_USDC_DECIMALS ); - if (decimals.reverted) { - new CustomPriceType(); - } - return CustomPriceType.initialize( result.value.value1.toBigDecimal(), - decimals.value + decimals, + constants.OracleType.CHAINLINK_FEED ); } diff --git a/subgraphs/balancer-forks/src/prices/oracles/YearnLensOracle.ts b/subgraphs/balancer-forks/src/prices/oracles/YearnLensOracle.ts index 7e12157116..9cdcbc63e0 100644 --- a/subgraphs/balancer-forks/src/prices/oracles/YearnLensOracle.ts +++ b/subgraphs/balancer-forks/src/prices/oracles/YearnLensOracle.ts @@ -1,26 +1,20 @@ 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 { Address, BigDecimal, BigInt, ethereum } from "@graphprotocol/graph-ts"; import { YearnLensContract } from "../../../generated/Vault/YearnLensContract"; -export function getYearnLensContract( - contractAddress: Address -): YearnLensContract | null { - if (utils.isNullAddress(contractAddress)) return null; - - return YearnLensContract.bind(contractAddress); -} - -export function getTokenPriceUSDC(tokenAddr: Address): CustomPriceType { +export function getTokenPriceUSDC( + tokenAddr: Address, + block: ethereum.Block | null = null +): CustomPriceType { const config = utils.getConfig(); + const contractAddress = utils.getContract(config.yearnLens(), block); - if (!config || config.yearnLensBlacklist().includes(tokenAddr)) + if (!contractAddress || config.yearnLensBlacklist().includes(tokenAddr)) return new CustomPriceType(); - const yearnLensContract = getYearnLensContract(config.yearnLens()); - if (!yearnLensContract) return new CustomPriceType(); - + const yearnLensContract = YearnLensContract.bind(contractAddress); const tokenPrice: BigDecimal = utils .readValue( yearnLensContract.try_getPriceUsdcRecommended(tokenAddr), @@ -30,6 +24,7 @@ export function getTokenPriceUSDC(tokenAddr: Address): CustomPriceType { return CustomPriceType.initialize( tokenPrice, - constants.DEFAULT_USDC_DECIMALS + constants.DEFAULT_USDC_DECIMALS, + constants.OracleType.YEARN_LENS_ORACLE ); } diff --git a/subgraphs/balancer-forks/src/prices/routers/CurveRouter.ts b/subgraphs/balancer-forks/src/prices/routers/CurveRouter.ts index d8937c5a97..0bd90ba997 100644 --- a/subgraphs/balancer-forks/src/prices/routers/CurveRouter.ts +++ b/subgraphs/balancer-forks/src/prices/routers/CurveRouter.ts @@ -1,99 +1,160 @@ -import * as utils from "../common/utils"; import { getUsdPricePerToken } from ".."; +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 { BigInt, Address, BigDecimal, ethereum } from "@graphprotocol/graph-ts"; +import { CurvePool as CurvePoolContract } from "../../../generated/Vault/CurvePool"; import { CurveRegistry as CurveRegistryContract } from "../../../generated/Vault/CurveRegistry"; -export function getCurvePriceUsdc( - curveLpTokenAddress: Address -): CustomPriceType { - const config = utils.getConfig(); - if (!config) return new CustomPriceType(); +export function isCurveLpToken( + lpAddress: Address, + block: ethereum.Block | null +): bool { + const poolAddress = getPoolFromLpToken(lpAddress, block); + if (poolAddress.notEqual(constants.NULL.TYPE_ADDRESS)) return true; + + return false; +} - let price = constants.BIGDECIMAL_ZERO; +export function getPoolFromLpToken( + lpAddress: Address, + block: ethereum.Block | null = null +): Address { + const config = utils.getConfig(); const curveRegistryAdresses = config.curveRegistry(); for (let idx = 0; idx < curveRegistryAdresses.length; idx++) { const curveRegistry = curveRegistryAdresses[idx]; + if (block && curveRegistry.startBlock.gt(block.number)) continue; - const curveRegistryContract = CurveRegistryContract.bind(curveRegistry); + const curveRegistryContract = CurveRegistryContract.bind( + curveRegistry.address + ); - const virtualPrice = getVirtualPrice( - curveLpTokenAddress, - curveRegistryContract + const poolAddress = utils.readValue
( + curveRegistryContract.try_get_pool_from_lp_token(lpAddress), + constants.NULL.TYPE_ADDRESS ); - if (virtualPrice.equals(constants.BIGDECIMAL_ZERO)) continue; + if (poolAddress.notEqual(constants.NULL.TYPE_ADDRESS)) return poolAddress; + } - price = virtualPrice.div( - constants.BIGINT_TEN.pow( - constants.DEFAULT_DECIMALS.toI32() as u8 - ).toBigDecimal() - ); + return constants.NULL.TYPE_ADDRESS; +} - const basePrice = getBasePrice(curveLpTokenAddress, curveRegistryContract); - if (basePrice.reverted) continue; +export function isLpCryptoPool( + lpAddress: Address, + block: ethereum.Block | null = null +): bool { + const poolAddress = getPoolFromLpToken(lpAddress, block); - return CustomPriceType.initialize( - price.times(basePrice.usdPrice), - basePrice.decimals - ); + if (poolAddress != constants.NULL.TYPE_ADDRESS) { + return isPoolCryptoPool(poolAddress); } - return new CustomPriceType(); + return false; } -export function getPoolFromLpToken( +export function isPoolCryptoPool(poolAddress: Address): bool { + const poolContract = CurvePoolContract.bind(poolAddress); + + const priceOracleCall = poolContract.try_price_oracle(); + if (!priceOracleCall.reverted) return true; + + const priceOracle1Call = poolContract.try_price_oracle1( + constants.BIGINT_ZERO + ); + if (!priceOracle1Call.reverted) return true; + + return false; +} + +export function getCurvePriceUsdc( lpAddress: Address, - curveRegistry: CurveRegistryContract -): Address { - const poolAddress = utils.readValue
( - curveRegistry.try_get_pool_from_lp_token(lpAddress), - constants.NULL.TYPE_ADDRESS + block: ethereum.Block | null = null +): CustomPriceType { + if (isLpCryptoPool(lpAddress, block)) + return cryptoPoolLpPriceUsdc(lpAddress, block); + + const basePrice = getBasePrice(lpAddress, block); + const virtualPrice = getVirtualPrice(lpAddress, block).toBigDecimal(); + + const config = utils.getConfig(); + const usdcTokenDecimals = config.whitelistedTokens().mustGet("USDC").decimals; + + const decimalsAdjustment = constants.DEFAULT_DECIMALS.minus( + BigInt.fromI32(usdcTokenDecimals) ); + const priceUsdc = virtualPrice + .times(basePrice.usdPrice) + .times( + constants.BIGINT_TEN.pow(decimalsAdjustment.toI32() as u8).toBigDecimal() + ); - return poolAddress; + return CustomPriceType.initialize( + priceUsdc, + decimalsAdjustment.plus(constants.DEFAULT_DECIMALS).toI32() as u8, + constants.OracleType.CURVE_ROUTER + ); } export function getBasePrice( - curveLpTokenAddress: Address, - curveRegistry: CurveRegistryContract + lpAddress: Address, + block: ethereum.Block | null = null ): CustomPriceType { - const poolAddress = getPoolFromLpToken(curveLpTokenAddress, curveRegistry); + const poolAddress = getPoolFromLpToken(lpAddress, block); - if (poolAddress.equals(constants.NULL.TYPE_ADDRESS)) { + if (poolAddress.equals(constants.NULL.TYPE_ADDRESS)) return new CustomPriceType(); - } - - const underlyingCoinAddress = getUnderlyingCoinFromPool( - poolAddress, - curveRegistry - ); - const basePrice = getPriceUsdcRecommended(underlyingCoinAddress); + const underlyingCoinAddress = getUnderlyingCoinFromPool(poolAddress, block); + const basePrice = getPriceUsdcRecommended(underlyingCoinAddress, block); return basePrice; } export function getUnderlyingCoinFromPool( poolAddress: Address, - curveRegistry: CurveRegistryContract + block: ethereum.Block | null = null ): Address { - const coinsArray = curveRegistry.try_get_underlying_coins(poolAddress); + const config = utils.getConfig(); + const curveRegistryAdresses = config.curveRegistry(); - let coins: Address[]; + for (let idx = 0; idx < curveRegistryAdresses.length; idx++) { + const curveRegistry = curveRegistryAdresses[idx]; + if (block && curveRegistry.startBlock.gt(block.number)) continue; + + const curveRegistryContract = CurveRegistryContract.bind( + curveRegistry.address + ); - if (coinsArray.reverted) { - return constants.NULL.TYPE_ADDRESS; - } else { - coins = coinsArray.value; + const coins = utils.readValue( + curveRegistryContract.try_get_underlying_coins(poolAddress), + [] + ); + + if (coins.length != 0) return getPreferredCoinFromCoins(coins); } - //? Use first coin from pool and if that is empty (due to error) fall back to second coin - let preferredCoinAddress = coins[0]; - if (preferredCoinAddress.equals(constants.NULL.TYPE_ADDRESS)) { - preferredCoinAddress = coins[1]; + return constants.NULL.TYPE_ADDRESS; +} + +export function getPreferredCoinFromCoins(coins: Address[]): Address { + let preferredCoinAddress = constants.NULL.TYPE_ADDRESS; + for (let coinIdx = 0; coinIdx < 8; coinIdx++) { + const coinAddress = coins[coinIdx]; + + if (coinAddress.notEqual(constants.NULL.TYPE_ADDRESS)) { + preferredCoinAddress = coinAddress; + } + // Found preferred coin and we're at the end of the token array + if ( + (preferredCoinAddress.notEqual(constants.NULL.TYPE_ADDRESS) && + coinAddress.equals(constants.NULL.TYPE_ADDRESS)) || + coinIdx == 7 + ) { + break; + } } return preferredCoinAddress; @@ -101,20 +162,166 @@ export function getUnderlyingCoinFromPool( export function getVirtualPrice( curveLpTokenAddress: Address, - curveRegistry: CurveRegistryContract + block: ethereum.Block | null = null +): BigInt { + const config = utils.getConfig(); + const curveRegistryAdresses = config.curveRegistry(); + + for (let idx = 0; idx < curveRegistryAdresses.length; idx++) { + const curveRegistry = curveRegistryAdresses[idx]; + if (block && curveRegistry.startBlock.gt(block.number)) continue; + + const curveRegistryContract = CurveRegistryContract.bind( + curveRegistry.address + ); + + const virtualPriceCall = + curveRegistryContract.try_get_virtual_price_from_lp_token( + curveLpTokenAddress + ); + + if (!virtualPriceCall.reverted) return virtualPriceCall.value; + } + + return constants.BIGINT_ZERO; +} + +export function getPriceUsdcRecommended( + tokenAddress: Address, + block: ethereum.Block | null = null +): CustomPriceType { + return getUsdPricePerToken(tokenAddress, block); +} + +export function cryptoPoolLpPriceUsdc( + lpAddress: Address, + block: ethereum.Block | null = null +): CustomPriceType { + const totalSupply = utils.getTokenSupply(lpAddress); + + const totalValueUsdc = cryptoPoolLpTotalValueUsdc(lpAddress, block); + const priceUsdc = totalValueUsdc + .times( + constants.BIGINT_TEN.pow( + constants.DEFAULT_DECIMALS.toI32() as u8 + ).toBigDecimal() + ) + .div(totalSupply.toBigDecimal()); + + return CustomPriceType.initialize( + priceUsdc, + 0, + constants.OracleType.CURVE_ROUTER + ); +} + +export function cryptoPoolLpTotalValueUsdc( + lpAddress: Address, + block: ethereum.Block | null = null ): BigDecimal { - const virtualPrice = utils + const poolAddress = getPoolFromLpToken(lpAddress, block); + + const underlyingTokensAddresses = + cryptoPoolUnderlyingTokensAddressesByPoolAddress(poolAddress); + + let totalValue = constants.BIGDECIMAL_ZERO; + + for ( + let tokenIdx = 0; + tokenIdx < underlyingTokensAddresses.length; + tokenIdx++ + ) { + const tokenValueUsdc = cryptoPoolTokenAmountUsdc( + poolAddress, + underlyingTokensAddresses[tokenIdx], + BigInt.fromI32(tokenIdx), + block + ); + totalValue = totalValue.plus(tokenValueUsdc); + } + + return totalValue; +} + +export function cryptoPoolTokenAmountUsdc( + poolAddress: Address, + tokenAddress: Address, + tokenIdx: BigInt, + block: ethereum.Block | null = null +): BigDecimal { + const poolContract = CurvePoolContract.bind(poolAddress); + + const tokenBalance = utils .readValue( - curveRegistry.try_get_virtual_price_from_lp_token(curveLpTokenAddress), + poolContract.try_balances(tokenIdx), constants.BIGINT_ZERO ) .toBigDecimal(); - return virtualPrice; + const tokenDecimals = utils.getTokenDecimals(tokenAddress); + const tokenPrice = getPriceUsdcRecommended(tokenAddress, block); + const tokenValueUsdc = tokenBalance + .times(tokenPrice.usdPrice) + .div(constants.BIGINT_TEN.pow(tokenDecimals.toI32() as u8).toBigDecimal()); + + return tokenValueUsdc; } -export function getPriceUsdcRecommended( - tokenAddress: Address +export function cryptoPoolUnderlyingTokensAddressesByPoolAddress( + poolAddress: Address +): Address[] { + const poolContract = CurvePoolContract.bind(poolAddress); + + let idx = 0; + const coins: Address[] = []; + while (idx >= 0) { + const coin = utils.readValue
( + poolContract.try_coins(BigInt.fromI32(idx)), + constants.NULL.TYPE_ADDRESS + ); + + if (coin.equals(constants.NULL.TYPE_ADDRESS)) { + return coins; + } + + coins.push(coin); + idx += 1; + } + + return coins; +} + +export function getPriceUsdc( + tokenAddress: Address, + block: ethereum.Block | null ): CustomPriceType { - return getUsdPricePerToken(tokenAddress); + if (isCurveLpToken(tokenAddress, block)) + return getCurvePriceUsdc(tokenAddress, block); + + const poolContract = CurvePoolContract.bind(tokenAddress); + const virtualPrice = utils + .readValue( + poolContract.try_get_virtual_price(), + constants.BIGINT_ZERO + ) + .toBigDecimal(); + + const coins: Address[] = []; + for (let i = 0; i < 8; i++) { + const coin = utils.readValue
( + poolContract.try_coins(BigInt.fromI32(i)), + constants.NULL.TYPE_ADDRESS + ); + + coins.push(coin); + } + + const preferredCoin = getPreferredCoinFromCoins(coins); + const price = getPriceUsdcRecommended(preferredCoin, block); + + return CustomPriceType.initialize( + price.usdPrice.times(virtualPrice), + constants.DEFAULT_DECIMALS.toI32() as u8, + constants.OracleType.CURVE_ROUTER + ); } diff --git a/subgraphs/balancer-forks/src/prices/routers/UniswapForksRouter.ts b/subgraphs/balancer-forks/src/prices/routers/UniswapForksRouter.ts index ee85fac369..52a5fe2be8 100644 --- a/subgraphs/balancer-forks/src/prices/routers/UniswapForksRouter.ts +++ b/subgraphs/balancer-forks/src/prices/routers/UniswapForksRouter.ts @@ -1,7 +1,7 @@ import * as utils from "../common/utils"; import * as constants from "../common/constants"; import { CustomPriceType } from "../common/types"; -import { Address, BigInt } from "@graphprotocol/graph-ts"; +import { Address, BigInt, ethereum, log } from "@graphprotocol/graph-ts"; import { UniswapPair as UniswapPairContract } from "../../../generated/Vault/UniswapPair"; import { UniswapRouter as UniswapRouterContract } from "../../../generated/Vault/UniswapRouter"; @@ -19,49 +19,52 @@ export function isLpToken(tokenAddress: Address, ethAddress: Address): bool { return true; } -export function getTokenPriceUSDC(tokenAddress: Address): CustomPriceType { +export function getTokenPriceUSDC( + tokenAddress: Address, + block: ethereum.Block | null = null +): CustomPriceType { const config = utils.getConfig(); if (!config) return new CustomPriceType(); - const ethAddress = config.ethAddress(); - const usdcAddress = config.usdcAddress(); + const ethAddress = config.whitelistedTokens().mustGet("WETH").address; + const usdcAddress = config.whitelistedTokens().mustGet("USDC").address; if (isLpToken(tokenAddress, ethAddress)) { - return getLpTokenPriceUsdc(tokenAddress); + return getLpTokenPriceUsdc(tokenAddress, block); } - return getPriceFromRouterUSDC(tokenAddress, usdcAddress); + return getPriceFromRouterUSDC(tokenAddress, usdcAddress, block); } export function getPriceFromRouterUSDC( tokenAddress: Address, - usdcAddress: Address + usdcAddress: Address, + block: ethereum.Block | null = null ): CustomPriceType { - return getPriceFromRouter(tokenAddress, usdcAddress); + return getPriceFromRouter(tokenAddress, usdcAddress, block); } export function getPriceFromRouter( token0Address: Address, - token1Address: Address + token1Address: Address, + block: ethereum.Block | null = null ): CustomPriceType { const config = utils.getConfig(); - const ethAddress = config.ethAddress(); - const wethAddress = config.wethAddress(); + const wethAddress = config.whitelistedTokens().mustGet("WETH").address; + const nativeTokenAddress = config + .whitelistedTokens() + .mustGet("NATIVE_TOKEN").address; // Construct swap path const path: Address[] = []; let numberOfJumps: BigInt; // Convert ETH address to WETH - if (token0Address == ethAddress) { - token0Address = wethAddress; - } - if (token1Address == ethAddress) { - token1Address = wethAddress; - } + if (token0Address == nativeTokenAddress) token0Address = wethAddress; + if (token1Address == nativeTokenAddress) token1Address = wethAddress; const inputTokenIsWeth: bool = - token0Address == wethAddress || token1Address == wethAddress; + token0Address.equals(wethAddress) || token1Address.equals(wethAddress); if (inputTokenIsWeth) { // Path = [token0, weth] or [weth, token1] @@ -79,19 +82,21 @@ export function getPriceFromRouter( } const token0Decimals = utils.getTokenDecimals(token0Address); - const amountIn = BigInt.fromI32(10).pow(token0Decimals.toI32() as u8); + const amountIn = constants.BIGINT_TEN.pow(token0Decimals.toI32() as u8); const routerAddresses = config.uniswapForks(); let amountOut = constants.BIGINT_ZERO; for (let idx = 0; idx < routerAddresses.length; idx++) { - const routerAddress = routerAddresses.at(idx); + const routerAddress = routerAddresses[idx]; + if (block && routerAddress.startBlock.gt(block.number)) continue; - const uniswapForkRouter = UniswapRouterContract.bind(routerAddress); + const uniswapForkRouter = UniswapRouterContract.bind(routerAddress.address); const amountOutArray = uniswapForkRouter.try_getAmountsOut(amountIn, path); if (!amountOutArray.reverted) { amountOut = amountOutArray.value[amountOutArray.value.length - 1]; + break; } } @@ -104,15 +109,21 @@ export function getPriceFromRouter( return CustomPriceType.initialize( amountOutBigDecimal, - constants.DEFAULT_USDC_DECIMALS + config.whitelistedTokens().mustGet("USDC").decimals as u8, + constants.OracleType.UNISWAP_FORKS_ROUTER ); } -export function getLpTokenPriceUsdc(tokenAddress: Address): CustomPriceType { +export function getLpTokenPriceUsdc( + tokenAddress: Address, + block: ethereum.Block | null = null +): CustomPriceType { const uniSwapPair = UniswapPairContract.bind(tokenAddress); - const totalLiquidity: CustomPriceType = - getLpTokenTotalLiquidityUsdc(tokenAddress); + const totalLiquidity: CustomPriceType = getLpTokenTotalLiquidityUsdc( + tokenAddress, + block + ); const totalSupply = utils.readValue( uniSwapPair.try_totalSupply(), constants.BIGINT_ZERO @@ -125,7 +136,12 @@ export function getLpTokenPriceUsdc(tokenAddress: Address): CustomPriceType { const pairDecimalsCall = uniSwapPair.try_decimals(); if (pairDecimalsCall.reverted) { - pairDecimals = constants.DEFAULT_DECIMALS.toI32() as u8; + log.warning( + "[UniswapForksRouter] Failed to fetch pair decimals, tokenAddress: {}", + [tokenAddress.toHexString()] + ); + + return new CustomPriceType(); } else { pairDecimals = pairDecimalsCall.value; } @@ -136,12 +152,14 @@ export function getLpTokenPriceUsdc(tokenAddress: Address): CustomPriceType { return CustomPriceType.initialize( pricePerLpTokenUsdc, - constants.DEFAULT_USDC_DECIMALS + constants.DEFAULT_USDC_DECIMALS, + constants.OracleType.UNISWAP_FORKS_ROUTER ); } export function getLpTokenTotalLiquidityUsdc( - tokenAddress: Address + tokenAddress: Address, + block: ethereum.Block | null = null ): CustomPriceType { const uniSwapPair = UniswapPairContract.bind(tokenAddress); @@ -168,8 +186,8 @@ export function getLpTokenTotalLiquidityUsdc( if (reservesCall.reverted) return new CustomPriceType(); - const token0Price = getTokenPriceUSDC(token0Address); - const token1Price = getTokenPriceUSDC(token1Address); + const token0Price = getTokenPriceUSDC(token0Address, block); + const token1Price = getTokenPriceUSDC(token1Address, block); if (token0Price.reverted || token1Price.reverted) { return new CustomPriceType(); @@ -197,7 +215,8 @@ export function getLpTokenTotalLiquidityUsdc( return CustomPriceType.initialize( totalLiquidity, - constants.DEFAULT_USDC_DECIMALS + constants.DEFAULT_USDC_DECIMALS, + constants.OracleType.UNISWAP_FORKS_ROUTER ); } return new CustomPriceType();