From 01bf2bb43ba7fa79dbebc6c54db534ca8c347273 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Pr=C3=A9vost?= <998369+prevostc@users.noreply.github.com> Date: Sat, 16 Mar 2024 18:34:57 +0100 Subject: [PATCH] Configure --- .github/workflows/CI.yml | 2 +- .prettierignore | 1 + config/arbitrum-one.json | 13 ------------- config/arbitrum.json | 13 +++++++++++++ config/optimism.json | 20 ++++++++++---------- package.json | 9 +++++---- src/mapping/price.ts | 8 ++++---- 7 files changed, 34 insertions(+), 32 deletions(-) create mode 100644 .prettierignore delete mode 100644 config/arbitrum-one.json create mode 100644 config/arbitrum.json diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index bca3afe..7a59a86 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -41,7 +41,7 @@ jobs: - name: Generate any subgraph.yaml file run: yarn prepare:arbitrum-one - + - name: Run GraphQL codegen run: yarn codegen diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..43dae3b --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +subgraph.template.yaml \ No newline at end of file diff --git a/config/arbitrum-one.json b/config/arbitrum-one.json deleted file mode 100644 index e204706..0000000 --- a/config/arbitrum-one.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "network": "arbitrum-one", - - "vaultFactoryAddress": "0xef79A90A93084e1d2a2b4ecD1F783e937C80Ef4C", - "vaultFactoryStartBlock": 190612486, - "clockTickBlocks": 3600, - - "wrappedNativeAddress": "0x82af49447d8a07e3bd95bd0d56f35241523fbab1", - "wrappedNativeDecimals": 18, - "uniswapV3QuoterV2Address": "0x61ffe014ba17989e743c5f6cb21bf9697530b21e", - "chainlinkNativePriceFeedAddress": "0x639Fe6ab55C921f74e7fac1ee960C0B6293ba612", - "chainlinkNativePriceFeedDecimals": 8 -} \ No newline at end of file diff --git a/config/arbitrum.json b/config/arbitrum.json new file mode 100644 index 0000000..1e47d74 --- /dev/null +++ b/config/arbitrum.json @@ -0,0 +1,13 @@ +{ + "network": "arbitrum-one", + + "vaultFactoryAddress": "0xef79A90A93084e1d2a2b4ecD1F783e937C80Ef4C", + "vaultFactoryStartBlock": 190612486, + "clockTickBlocks": 3600, + + "wrappedNativeAddress": "0x82af49447d8a07e3bd95bd0d56f35241523fbab1", + "wrappedNativeDecimals": 18, + "uniswapV3QuoterV2Address": "0x61ffe014ba17989e743c5f6cb21bf9697530b21e", + "chainlinkNativePriceFeedAddress": "0x639Fe6ab55C921f74e7fac1ee960C0B6293ba612", + "chainlinkNativePriceFeedDecimals": 8 +} diff --git a/config/optimism.json b/config/optimism.json index e22e97a..a930eca 100644 --- a/config/optimism.json +++ b/config/optimism.json @@ -1,13 +1,13 @@ { - "network": "optimism", + "network": "optimism", - "vaultFactoryAddress": "0xf0C7eD247e22Bb0BaACA1F7975C8F02D79954198", - "vaultFactoryStartBlock": 117428248, - "clockTickBlocks": 750, + "vaultFactoryAddress": "0xf0C7eD247e22Bb0BaACA1F7975C8F02D79954198", + "vaultFactoryStartBlock": 117428248, + "clockTickBlocks": 750, - "wrappedNativeAddress": "0x4200000000000000000000000000000000000006", - "wrappedNativeDecimals": 18, - "uniswapV3QuoterV2Address": "0x61fFE014bA17989E743c5F6cB21bF9697530B21e", - "chainlinkNativePriceFeedAddress": "0x13e3Ee699D1909E989722E753853AE30b17e08c5", - "chainlinkNativePriceFeedDecimals": 8 -} \ No newline at end of file + "wrappedNativeAddress": "0x4200000000000000000000000000000000000006", + "wrappedNativeDecimals": 18, + "uniswapV3QuoterV2Address": "0x61fFE014bA17989E743c5F6cB21bF9697530B21e", + "chainlinkNativePriceFeedAddress": "0x13e3Ee699D1909E989722E753853AE30b17e08c5", + "chainlinkNativePriceFeedDecimals": 8 +} diff --git a/package.json b/package.json index ac0785d..364674f 100644 --- a/package.json +++ b/package.json @@ -3,19 +3,20 @@ "private": true, "scripts": { "prepare": "husky install", - "postinstall": "yarn run --silent prepare:arbitrum-one && yarn run --silent codegen", + "postinstall": "yarn run --silent prepare:arbitrum && yarn run --silent codegen", "codegen": "rm -Rf generated && graph codegen", "build": "graph build", "format": "prettier . --write", "test": "yarn run --silent test:lint && yarn run --silent test:graph", "test:graph": "graph test", "test:lint": "prettier . --check", - "prepare:arbitrum-one": "mustache config/arbitrum-one.json subgraph.template.yaml > subgraph.yaml", - "prepare:optimism": "mustache config/optimism.json subgraph.template.yaml > subgraph.yaml", "create-local": "graph create beefyfinance/beefy-cl --node http://127.0.0.1:8020", "deploy-local": "graph deploy beefyfinance/beefy-cl --node http://127.0.0.1:8020 --ipfs http://localhost:5001", "remove-local": "graph remove beefyfinance/beefy-cl --node http://127.0.0.1:8020", - "deploy-remote": "0xgraph remove beefyfinance/beefy-cl && sleep 10 && 0xgraph create beefyfinance/beefy-cl && yarn --silent codegen && 0xgraph build && sleep 5 && 0xgraph deploy beefyfinance/beefy-cl --version-label=v0.0.1" + "prepare:arbitrum": "mustache config/arbitrum.json subgraph.template.yaml > subgraph.yaml", + "prepare:optimism": "mustache config/optimism.json subgraph.template.yaml > subgraph.yaml", + "deploy:arbitrum": "0xgraph remove beefyfinance/alm-arbitrum && sleep 10 && 0xgraph create beefyfinance/alm-arbitrum && yarn --silent codegen && 0xgraph build && sleep 5 && 0xgraph deploy beefyfinance/alm-arbitrum --version-label=v0.0.1", + "deploy:optimism": "0xgraph remove beefyfinance/alm-optimism && sleep 10 && 0xgraph create beefyfinance/alm-optimism && yarn --silent codegen && 0xgraph build && sleep 5 && 0xgraph deploy beefyfinance/alm-optimism --version-label=v0.0.1" }, "main": "./bin/index.js", "bin": { diff --git a/src/mapping/price.ts b/src/mapping/price.ts index bae5e3d..6de1cb0 100644 --- a/src/mapping/price.ts +++ b/src/mapping/price.ts @@ -4,13 +4,13 @@ import { StrategyPassiveManagerUniswap as BeefyCLStrategyContract } from "../../ import { ONE_BD, exponentToBigInt, tokenAmountToDecimal } from "../utils/decimal" import { UniswapQuoterV2 } from "../../generated/templates/BeefyCLStrategy/UniswapQuoterV2" import { ChainLinkPriceFeed } from "../../generated/templates/BeefyCLStrategy/ChainLinkPriceFeed" -import { dataSource } from '@graphprotocol/graph-ts' +import { dataSource } from "@graphprotocol/graph-ts" const context = dataSource.context() -const quoter = UniswapQuoterV2.bind(Address.fromBytes(context.getBytes('uniswapV3QuoterV2Address'))) -const WNATIVE_DECIMALS = context.getBigInt('wrappedNativeDecimals') +const quoter = UniswapQuoterV2.bind(Address.fromBytes(context.getBytes("uniswapV3QuoterV2Address"))) +const WNATIVE_DECIMALS = context.getBigInt("wrappedNativeDecimals") const nativePriceFeed = ChainLinkPriceFeed.bind(Address.fromBytes(context.getBytes("chainlinkNativePriceFeedAddress"))) -const PRICE_FEED_DECIMALS = context.getBigInt('chainlinkNativePriceFeedDecimals') +const PRICE_FEED_DECIMALS = context.getBigInt("chainlinkNativePriceFeedDecimals") export function getVaultPrices(vault: BeefyCLVault, token0: Token, token1: Token): VaultPrices { log.debug("updateUserPosition: fetching data for vault {}", [vault.id.toHexString()])