-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CoW AMM Deployer] Integrate advanced mode for price oracles (#671)
* add custom oracle feature * chore: add bleu ui * remove unused context * chore: use bleu ui toaster * refactor: separete price oracle inputs into new files * chore: add npm token on github pnpm setup action * wip: move .npmrc to repo root * chore: remove rainbowkit colors from milkman project * chore: add missing dependencies on balancer tools * add npm_token input on all workflows * add input into setup-pnpm workflow * chore: run formatter * chore: rename @bleu-fi/ui to @bleu/ui due to org name change * remove bleu-ui from tsconfig * chore: use try and catch patern and change tooltip texts * [CoW AMM Deployer] Integrate sushi into application (#672) * add sushi gql * add sushiswap pricechecker component * run lint * refactor apr paths * apr: update viem * apr: fix ts errors * add chainlink-datafeeds-api app * chore(deps-dev): bump @graphql-codegen/client-preset from 4.2.5 to 4.2.6 (#675) Bumps [@graphql-codegen/client-preset](https://github.com/dotansimha/graphql-code-generator/tree/HEAD/packages/presets/client) from 4.2.5 to 4.2.6. - [Release notes](https://github.com/dotansimha/graphql-code-generator/releases) - [Changelog](https://github.com/dotansimha/graphql-code-generator/blob/master/packages/presets/client/CHANGELOG.md) - [Commits](https://github.com/dotansimha/graphql-code-generator/commits/@graphql-codegen/[email protected]/packages/presets/client) --- updated-dependencies: - dependency-name: "@graphql-codegen/client-preset" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * remove unneeded files in chainlink api * add chainlink-datafeeds-api url * add price information of new oracles --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: José Ribeiro <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * merge into main --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: José Ribeiro <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
a9e737b
commit 49d65d9
Showing
130 changed files
with
29,041 additions
and
6,928 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
auto-install-peers=true | ||
strict-peer-dependencies=false | ||
|
||
; Yarn Node Linker | ||
node-linker=node-modules | ||
|
||
; Scoped Registry Configuration for bleu-fi | ||
@bleu:registry=https://npm.pkg.github.com | ||
//npm.pkg.github.com/:_authToken=${NPM_TOKEN} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
apps/cow-amm-deployer/src/app/manager/(components)/BalancerPriceInformation.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { NetworkFromNetworkChainId } from "@bleu-fi/utils"; | ||
import { useSafeAppsSDK } from "@gnosis.pm/safe-apps-react-sdk"; | ||
import { ArrowTopRightIcon } from "@radix-ui/react-icons"; | ||
import Link from "next/link"; | ||
|
||
import { ICowAmm } from "#/lib/types"; | ||
import { ChainId } from "#/utils/chainsPublicClients"; | ||
|
||
export function BalancerPriceInformation({ cowAmm }: { cowAmm: ICowAmm }) { | ||
const { safe } = useSafeAppsSDK(); | ||
|
||
const priceOracleLink = getBalancerPoolUrl( | ||
safe.chainId as ChainId, | ||
cowAmm.priceOracleData?.balancerPoolId, | ||
); | ||
|
||
return ( | ||
<div className="flex flex-row gap-x-1 items-center hover:text-foreground/90"> | ||
<span>Using price information from Balancer V2</span> | ||
{priceOracleLink && ( | ||
<Link href={priceOracleLink} target="_blank"> | ||
<ArrowTopRightIcon /> | ||
</Link> | ||
)} | ||
</div> | ||
); | ||
} | ||
|
||
export function getBalancerPoolUrl(chainId: ChainId, poolId?: string) { | ||
return `https://app.balancer.fi/#/${NetworkFromNetworkChainId[chainId]}-chain/pool/${poolId}`; | ||
} |
27 changes: 27 additions & 0 deletions
27
apps/cow-amm-deployer/src/app/manager/(components)/CustomPriceInformation.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { buildBlockExplorerAddressURL } from "@bleu-fi/utils"; | ||
import { useSafeAppsSDK } from "@gnosis.pm/safe-apps-react-sdk"; | ||
import { ArrowTopRightIcon } from "@radix-ui/react-icons"; | ||
import Link from "next/link"; | ||
|
||
import { ICowAmm } from "#/lib/types"; | ||
import { ChainId } from "#/utils/chainsPublicClients"; | ||
|
||
export function CustomPriceInformation({ cowAmm }: { cowAmm: ICowAmm }) { | ||
const { safe } = useSafeAppsSDK(); | ||
|
||
const priceOracleLink = buildBlockExplorerAddressURL({ | ||
chainId: safe.chainId as ChainId, | ||
address: cowAmm.priceOracleAddress, | ||
}); | ||
|
||
return ( | ||
<div className="flex flex-row gap-x-1 items-center hover:text-foreground/90"> | ||
<span>Using price information from custom contract</span> | ||
{priceOracleLink && ( | ||
<Link href={priceOracleLink.url} target="_blank"> | ||
<ArrowTopRightIcon /> | ||
</Link> | ||
)} | ||
</div> | ||
); | ||
} |
19 changes: 19 additions & 0 deletions
19
apps/cow-amm-deployer/src/app/manager/(components)/PriceInformation.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { ICowAmm, PRICE_ORACLES } from "#/lib/types"; | ||
|
||
import { BalancerPriceInformation } from "./BalancerPriceInformation"; | ||
import { CustomPriceInformation } from "./CustomPriceInformation"; | ||
import { SushiV2PriceInformation } from "./SushiV2PriceInformation"; | ||
import { UniswapV2PriceInformation } from "./UniswapV2PriceInformation"; | ||
|
||
export function PriceInformation({ cowAmm }: { cowAmm: ICowAmm }) { | ||
switch (cowAmm.priceOracle) { | ||
case PRICE_ORACLES.UNI: | ||
return <UniswapV2PriceInformation cowAmm={cowAmm} />; | ||
case PRICE_ORACLES.BALANCER: | ||
return <BalancerPriceInformation cowAmm={cowAmm} />; | ||
case PRICE_ORACLES.SUSHI: | ||
return <SushiV2PriceInformation cowAmm={cowAmm} />; | ||
default: | ||
return <CustomPriceInformation cowAmm={cowAmm} />; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
apps/cow-amm-deployer/src/app/manager/(components)/SushiV2PriceInformation.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { useSafeAppsSDK } from "@gnosis.pm/safe-apps-react-sdk"; | ||
import { ArrowTopRightIcon } from "@radix-ui/react-icons"; | ||
import Link from "next/link"; | ||
|
||
import { ICowAmm } from "#/lib/types"; | ||
import { ChainId } from "#/utils/chainsPublicClients"; | ||
|
||
export function SushiV2PriceInformation({ cowAmm }: { cowAmm: ICowAmm }) { | ||
const { safe } = useSafeAppsSDK(); | ||
|
||
const priceOracleLink = getSushiV2Pair( | ||
safe.chainId as ChainId, | ||
cowAmm.priceOracleData?.sushiSwapPairAddress, | ||
); | ||
|
||
return ( | ||
<div className="flex flex-row gap-x-1 items-center hover:text-foreground/90"> | ||
<span>Using price information from Sushi V2</span> | ||
{priceOracleLink && ( | ||
<Link href={priceOracleLink} target="_blank"> | ||
<ArrowTopRightIcon /> | ||
</Link> | ||
)} | ||
</div> | ||
); | ||
} | ||
|
||
export function getSushiV2Pair(chainId: ChainId, referencePair?: string) { | ||
return `https://www.sushi.com/pool/${[chainId]}%3A${referencePair}`; | ||
} |
35 changes: 35 additions & 0 deletions
35
apps/cow-amm-deployer/src/app/manager/(components)/UniswapV2PriceInformation.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { NetworkFromNetworkChainId } from "@bleu-fi/utils"; | ||
import { useSafeAppsSDK } from "@gnosis.pm/safe-apps-react-sdk"; | ||
import { ArrowTopRightIcon } from "@radix-ui/react-icons"; | ||
import Link from "next/link"; | ||
import { gnosis } from "viem/chains"; | ||
|
||
import { ICowAmm } from "#/lib/types"; | ||
import { ChainId } from "#/utils/chainsPublicClients"; | ||
|
||
export function UniswapV2PriceInformation({ cowAmm }: { cowAmm: ICowAmm }) { | ||
const { safe } = useSafeAppsSDK(); | ||
|
||
const priceOracleLink = getUniV2PairUrl( | ||
safe.chainId as ChainId, | ||
cowAmm.priceOracleData?.uniswapV2PairAddress, | ||
); | ||
|
||
return ( | ||
<div className="flex flex-row gap-x-1 items-center hover:text-foreground/90"> | ||
<span>Using price information from Uniswap V2</span> | ||
{priceOracleLink && ( | ||
<Link href={priceOracleLink} target="_blank"> | ||
<ArrowTopRightIcon /> | ||
</Link> | ||
)} | ||
</div> | ||
); | ||
} | ||
|
||
export function getUniV2PairUrl(chainId: ChainId, referencePair?: string) { | ||
if (chainId === gnosis.id) { | ||
return; | ||
} | ||
return `https://info.uniswap.org/#/${NetworkFromNetworkChainId[chainId]}/pools/${referencePair}`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.