From 66b2a59c0a286bdef078296ae05b3298c30c28b6 Mon Sep 17 00:00:00 2001 From: Chase Manning Date: Mon, 22 Jan 2024 15:12:26 +0000 Subject: [PATCH 1/5] :rocket: add support for shutdown pools --- src/app/hooks/use-pools-preview.ts | 1 + src/components/PausedSnackbar.tsx | 4 +++- src/lib/mero.ts | 4 ++++ src/lib/mock/data.ts | 3 +++ src/lib/types.ts | 1 + src/pages/pool/PoolDeposit.tsx | 1 + src/pages/pools/PoolsPage.tsx | 3 ++- 7 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/app/hooks/use-pools-preview.ts b/src/app/hooks/use-pools-preview.ts index 0acff839..60e777d6 100644 --- a/src/app/hooks/use-pools-preview.ts +++ b/src/app/hooks/use-pools-preview.ts @@ -54,6 +54,7 @@ const usePoolsPreview = (): Optional => { }, strategyInfo: null, isPaused: false, + isShutdown: false, }; return pool_; }); diff --git a/src/components/PausedSnackbar.tsx b/src/components/PausedSnackbar.tsx index d5028034..921fc10b 100644 --- a/src/components/PausedSnackbar.tsx +++ b/src/components/PausedSnackbar.tsx @@ -79,7 +79,9 @@ const PausedSnackbar = ({ pool }: Props): Optional => { const dispatch = useDispatch(); const dismissed = useSelector(selectPausedSnackbarDismissed); - if (!pool || !pool.isPaused || dismissed) return null; + const paused = pool && (pool.isPaused || pool.isShutdown); + + if (!paused || dismissed) return null; return ( diff --git a/src/lib/mero.ts b/src/lib/mero.ts index c8e25888..2ecedfb1 100644 --- a/src/lib/mero.ts +++ b/src/lib/mero.ts @@ -240,6 +240,7 @@ export class Web3Mero implements Mero { feeDecreasePeriod, vaultAddress, isPaused, + isShutdown, ] = await Promise.all([ pool.name(), pool.getLpToken(), @@ -251,6 +252,7 @@ export class Web3Mero implements Mero { pool.withdrawalFeeDecreasePeriod(), pool.vault(), pool.isPaused(), + pool.isShutdown(), ]); const vaultShutdown = vaultAddress === ZERO_ADDRESS; @@ -281,6 +283,7 @@ export class Web3Mero implements Mero { feeDecreasePeriod: new ScaledNumber(feeDecreasePeriod, 0).toPlain(), strategyInfo, isPaused, + isShutdown, }; } @@ -370,6 +373,7 @@ export class Web3Mero implements Mero { feeDecreasePeriod: ScaledNumber.fromUnscaled(0, 0).toPlain(), strategyInfo: null, isPaused, + isShutdown: false, }; } diff --git a/src/lib/mock/data.ts b/src/lib/mock/data.ts index 342d53bb..0a3b7153 100644 --- a/src/lib/mock/data.ts +++ b/src/lib/mock/data.ts @@ -32,6 +32,7 @@ export const pools: GenericPool[] = [ feeDecreasePeriod: scale(10, 18), strategyInfo: null, isPaused: false, + isShutdown: false, }, { name: "bUSDC3CRV", @@ -57,6 +58,7 @@ export const pools: GenericPool[] = [ feeDecreasePeriod: scale(10, 18), strategyInfo: null, isPaused: false, + isShutdown: false, }, { name: "meroethCRV", @@ -82,6 +84,7 @@ export const pools: GenericPool[] = [ feeDecreasePeriod: scale(10, 18), strategyInfo: null, isPaused: false, + isShutdown: false, }, ]; diff --git a/src/lib/types.ts b/src/lib/types.ts index 00bcb39d..7a8bada5 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -32,6 +32,7 @@ export interface GenericPool { underlying: Token; strategyInfo: Optional; isPaused: boolean; + isShutdown: boolean; } export type Pool = GenericPool; diff --git a/src/pages/pool/PoolDeposit.tsx b/src/pages/pool/PoolDeposit.tsx index 85d13775..5ce6603f 100644 --- a/src/pages/pool/PoolDeposit.tsx +++ b/src/pages/pool/PoolDeposit.tsx @@ -56,6 +56,7 @@ const PoolDeposit = ({ pool, compact }: Props): JSX.Element => { const error = () => { if (!pool || !poolUnderlyingBalance || !depositAmount) return ""; if (pool.isPaused) return t("amountInput.validation.poolPaused"); + if (pool.isShutdown) return t("amountInput.validation.poolPaused"); if (Number(depositAmount) <= 0) return t("amountInput.validation.positive"); try { const amount = ScaledNumber.fromUnscaled(depositAmount, pool?.underlying.decimals); diff --git a/src/pages/pools/PoolsPage.tsx b/src/pages/pools/PoolsPage.tsx index 36403824..09c94ecf 100644 --- a/src/pages/pools/PoolsPage.tsx +++ b/src/pages/pools/PoolsPage.tsx @@ -141,7 +141,8 @@ const PoolsPage = (): JSX.Element => { {pools && pools .filter((pool: Pool) => { - if (!pool.isPaused) return true; + const paused = pool.isPaused || pool.isShutdown; + if (!paused) return true; if (!balances || !balances[pool.address]) return false; return !balances[pool.address].isZero(); }) From 488e35477e61f037ed00c23c5c7e80afd4d0ed3b Mon Sep 17 00:00:00 2001 From: Chase Manning Date: Mon, 22 Jan 2024 15:19:50 +0000 Subject: [PATCH 2/5] :wrench: use infura for unit tests --- .github/workflows/ci.yml | 2 +- src/lib/mero.test.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa3abfe9..f797d2d1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,7 @@ jobs: unit_test: runs-on: ubuntu-latest env: - TEST_LLAMA_NODES_ID: ${{ secrets.LLAMA_NODES_PROJECT_ID }} + WEB3_INFURA_PROJECT_ID: ${{ secrets.WEB3_INFURA_PROJECT_ID }} steps: - uses: actions/checkout@v2 - name: Setup Node diff --git a/src/lib/mero.test.ts b/src/lib/mero.test.ts index 31bd528b..23030b7c 100644 --- a/src/lib/mero.test.ts +++ b/src/lib/mero.test.ts @@ -3,9 +3,9 @@ import { DUMMY_ETH_ADDRESS } from "./constants"; import { createMero } from "./factory"; import { Web3Mero } from "./mero"; -const llamaId = process.env.TEST_LLAMA_NODES_ID; -if (!llamaId) throw new Error("TEST_LLAMA_NODES_ID not given"); -const rpc = `https://eth.llamarpc.com/rpc/${llamaId}`; +const infuraId = process.env.WEB3_INFURA_PROJECT_ID; +if (!infuraId) throw new Error("WEB3_INFURA_PROJECT_ID not given"); +const rpc = `https://mainnet.infura.io/v3/${infuraId}`; const provider = new ethers.providers.JsonRpcProvider(rpc); const mero = createMero(provider, { chainId: 1 }) as Web3Mero; From e2c762c15bc214bb01b7f05e8d714701ae15f7cf Mon Sep 17 00:00:00 2001 From: Chase Manning Date: Mon, 22 Jan 2024 15:20:54 +0000 Subject: [PATCH 3/5] :wrench: change deploy node version to 18 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f797d2d1..87329761 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 - name: Installing Dependencies run: yarn - name: Building App From 8a638590560e58e36782567d6a73ab25e693428a Mon Sep 17 00:00:00 2001 From: Chase Manning Date: Mon, 22 Jan 2024 15:25:04 +0000 Subject: [PATCH 4/5] :wrenc: use opensll legacy provider --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 87329761..dddf02cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,6 +36,8 @@ jobs: uses: actions/setup-node@v3 with: node-version: 18 + - name: Use OpenSSL Legacy Provider + run: export NODE_OPTIONS=--openssl-legacy-provider - name: Installing Dependencies run: yarn - name: Building App From 448ff58556395dbb998fbb776d1b269aa0be71e6 Mon Sep 17 00:00:00 2001 From: Chase Manning Date: Mon, 22 Jan 2024 15:27:02 +0000 Subject: [PATCH 5/5] :wrench: fix build step --- .github/workflows/ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dddf02cb..de66b716 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,12 +36,10 @@ jobs: uses: actions/setup-node@v3 with: node-version: 18 - - name: Use OpenSSL Legacy Provider - run: export NODE_OPTIONS=--openssl-legacy-provider - name: Installing Dependencies run: yarn - name: Building App - run: yarn run build + run: export NODE_OPTIONS=--openssl-legacy-provider && yarn run build - name: Deploy to Preview Channel uses: FirebaseExtended/action-hosting-deploy@v0 with: