Skip to content

Commit

Permalink
Configure
Browse files Browse the repository at this point in the history
  • Loading branch information
prevostc committed Mar 16, 2024
1 parent 34436be commit 01bf2bb
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:

- name: Generate any subgraph.yaml file
run: yarn prepare:arbitrum-one

- name: Run GraphQL codegen
run: yarn codegen

Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
subgraph.template.yaml
13 changes: 0 additions & 13 deletions config/arbitrum-one.json

This file was deleted.

13 changes: 13 additions & 0 deletions config/arbitrum.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"network": "arbitrum-one",

"vaultFactoryAddress": "0xef79A90A93084e1d2a2b4ecD1F783e937C80Ef4C",
"vaultFactoryStartBlock": 190612486,
"clockTickBlocks": 3600,

"wrappedNativeAddress": "0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
"wrappedNativeDecimals": 18,
"uniswapV3QuoterV2Address": "0x61ffe014ba17989e743c5f6cb21bf9697530b21e",
"chainlinkNativePriceFeedAddress": "0x639Fe6ab55C921f74e7fac1ee960C0B6293ba612",
"chainlinkNativePriceFeedDecimals": 8
}
20 changes: 10 additions & 10 deletions config/optimism.json
Original file line number Diff line number Diff line change
@@ -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
}
"wrappedNativeAddress": "0x4200000000000000000000000000000000000006",
"wrappedNativeDecimals": 18,
"uniswapV3QuoterV2Address": "0x61fFE014bA17989E743c5F6cB21bF9697530B21e",
"chainlinkNativePriceFeedAddress": "0x13e3Ee699D1909E989722E753853AE30b17e08c5",
"chainlinkNativePriceFeedDecimals": 8
}
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
8 changes: 4 additions & 4 deletions src/mapping/price.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()])
Expand Down

0 comments on commit 01bf2bb

Please sign in to comment.