From a27ce096e4cb0ce1c4e04bdc3c3a39b1020ae532 Mon Sep 17 00:00:00 2001 From: gs8nrv <55771972+GuillaumeNervoXS@users.noreply.github.com> Date: Thu, 18 Apr 2024 16:56:34 +0200 Subject: [PATCH] chore: add more tests on EUR --- scripts/fetch-event-blocknumber.ts | 2 +- .../angle-staked-stable-e2e.test.ts | 74 +++++++++- .../angle-staked-stable-events.test.ts | 26 +++- .../angle-staked-stable-integration.test.ts | 136 ++++++++++++------ .../angle-staked-stable-pool.ts | 30 ++-- .../angle-staked-stable.ts | 104 +++++++------- src/dex/angle-staked-stable/config.ts | 28 +++- src/dex/angle-staked-stable/types.ts | 2 +- tests/constants-e2e.ts | 89 +++++++++++- 9 files changed, 366 insertions(+), 125 deletions(-) diff --git a/scripts/fetch-event-blocknumber.ts b/scripts/fetch-event-blocknumber.ts index 6cec9e4f0..51c870c4a 100644 --- a/scripts/fetch-event-blocknumber.ts +++ b/scripts/fetch-event-blocknumber.ts @@ -54,4 +54,4 @@ const provider = new StaticJsonRpcProvider( network, ); -getBlockNumbersForEvents(address, ABI, eventNames, 0, 200000000, provider); +getBlockNumbersForEvents(address, ABI, eventNames, 0, 20000000, provider); diff --git a/src/dex/angle-staked-stable/angle-staked-stable-e2e.test.ts b/src/dex/angle-staked-stable/angle-staked-stable-e2e.test.ts index 99cd65ba8..d36fb3b4a 100644 --- a/src/dex/angle-staked-stable/angle-staked-stable-e2e.test.ts +++ b/src/dex/angle-staked-stable/angle-staked-stable-e2e.test.ts @@ -37,6 +37,7 @@ function testForNetwork( describe(`${network}`, () => { sideToContractMethods.forEach((contractMethods, side) => describe(`${side}`, () => { + // biome-ignore lint/complexity/noForEach: contractMethods.forEach((contractMethod: ContractMethod) => { describe(`${contractMethod}`, () => { it(`${tokenASymbol} -> ${tokenBSymbol}`, async () => { @@ -50,6 +51,10 @@ function testForNetwork( contractMethod, network, provider, + undefined, + undefined, + undefined, + 1, ); }); it(`${tokenBSymbol} -> ${tokenASymbol}`, async () => { @@ -63,6 +68,10 @@ function testForNetwork( contractMethod, network, provider, + undefined, + undefined, + undefined, + 1, ); }); }); @@ -78,7 +87,70 @@ describe('AngleStakedStable E2E', () => { describe('Mainnet', () => { const network = Network.MAINNET; - const tokenASymbol: string = 'agEUR'; + const tokenASymbol: string = 'EURA'; + const tokenBSymbol: string = 'stEUR'; + + const tokenAAmount: string = '1000000000000000000'; + const tokenBAmount: string = '1000000000000000000'; + const nativeTokenAmount = '1000000000000000000'; + + testForNetwork( + network, + dexKey, + tokenASymbol, + tokenBSymbol, + tokenAAmount, + tokenBAmount, + nativeTokenAmount, + ); + }); + + describe('Arbitrum', () => { + const network = Network.ARBITRUM; + + const tokenASymbol: string = 'EURA'; + const tokenBSymbol: string = 'stEUR'; + + const tokenAAmount: string = '1000000000000000000'; + const tokenBAmount: string = '1000000000000000000'; + const nativeTokenAmount = '1000000000000000000'; + + testForNetwork( + network, + dexKey, + tokenASymbol, + tokenBSymbol, + tokenAAmount, + tokenBAmount, + nativeTokenAmount, + ); + }); + + describe('Polygon', () => { + const network = Network.POLYGON; + + const tokenASymbol: string = 'EURA'; + const tokenBSymbol: string = 'stEUR'; + + const tokenAAmount: string = '1000000000000000000'; + const tokenBAmount: string = '1000000000000000000'; + const nativeTokenAmount = '1000000000000000000'; + + testForNetwork( + network, + dexKey, + tokenASymbol, + tokenBSymbol, + tokenAAmount, + tokenBAmount, + nativeTokenAmount, + ); + }); + + describe('Optimism', () => { + const network = Network.OPTIMISM; + + const tokenASymbol: string = 'EURA'; const tokenBSymbol: string = 'stEUR'; const tokenAAmount: string = '1000000000000000000'; diff --git a/src/dex/angle-staked-stable/angle-staked-stable-events.test.ts b/src/dex/angle-staked-stable/angle-staked-stable-events.test.ts index 00c58a310..30381effe 100644 --- a/src/dex/angle-staked-stable/angle-staked-stable-events.test.ts +++ b/src/dex/angle-staked-stable/angle-staked-stable-events.test.ts @@ -56,7 +56,7 @@ async function fetchPoolState( // eventName -> blockNumbers type EventMappings = Record; -describe('AngleStakedStable EventPool Mainnet', function () { +describe('AngleStakedStable EventPool Mainnet', () => { const dexKey = 'AngleStakedStable'; const network = Network.MAINNET; const dexHelper = new DummyDexHelper(network); @@ -66,11 +66,22 @@ describe('AngleStakedStable EventPool Mainnet', function () { // poolAddress -> EventMappings const eventsToTest: Record = { '0x004626a008b1acdc4c74ab51644093b155e59a23': { - Accrued: [], - Deposit: [18134921, 18135441], - Withdraw: [18135030], + Accrued: [ + 19368181, 19387091, 19387136, 19390671, 19395050, 19395068, 19404404, + 19404492, 19407830, 19410813, 19482839, 19575712, 19622932, 19622960, + 19632489, 19650535, 19668024, 19668335, 19669259, 19672358, 19675559, + 19679409, + ], + Deposit: [ + 19387091, 19387136, 19395050, 19404404, 19410813, 19622932, 19622960, + 19632489, 19668335, 19669259, 19672358, 19675559, + ], + Withdraw: [ + 19368181, 19390671, 19395068, 19404492, 19407830, 19482839, 19575712, + 19650535, 19679409, + ], ToggledPause: [], - RateUpdated: [18176668], + RateUpdated: [19668024], }, }; @@ -84,14 +95,17 @@ describe('AngleStakedStable EventPool Mainnet', function () { ); }); + // biome-ignore lint/complexity/noForEach: Object.entries(eventsToTest).forEach( ([poolAddress, events]: [string, EventMappings]) => { describe(`Events for ${poolAddress}`, () => { + // biome-ignore lint/complexity/noForEach: Object.entries(events).forEach( ([eventName, blockNumbers]: [string, number[]]) => { describe(`${eventName}`, () => { + // biome-ignore lint/complexity/noForEach: blockNumbers.forEach((blockNumber: number) => { - it(`State after ${blockNumber}`, async function () { + it(`State after ${blockNumber}`, async () => { await testEventSubscriber( angleStakedStablePool, angleStakedStablePool.addressesSubscribed, diff --git a/src/dex/angle-staked-stable/angle-staked-stable-integration.test.ts b/src/dex/angle-staked-stable/angle-staked-stable-integration.test.ts index 6a226c108..b8b170f14 100644 --- a/src/dex/angle-staked-stable/angle-staked-stable-integration.test.ts +++ b/src/dex/angle-staked-stable/angle-staked-stable-integration.test.ts @@ -147,7 +147,7 @@ async function testPricingOnNetwork( ); } -describe('AngleStakedStable', function () { +describe('AngleStakedStable', () => { const dexKey = 'AngleStakedStable'; let blockNumber: number; let angleStakedStable: AngleStakedStable; @@ -159,42 +159,42 @@ describe('AngleStakedStable', function () { const tokens = Tokens[network]; // Don't forget to update relevant tokens in constant-e2e.ts - const srcTokenSymbol = 'agEUR'; - const destTokenSymbol = 'stEUR'; - const funcNameSell = 'previewDeposit'; - const funcNameBuy = 'previewMint'; + const srcTokenSymbolEnter = 'EURA'; + const destTokenSymbolEnter = 'stEUR'; + const funcNameSellEnter = 'previewDeposit'; + const funcNameBuyEnter = 'previewMint'; - // const srcTokenSymbol = 'stEUR'; - // const destTokenSymbol = 'agEUR'; - // const funcNameSell = 'previewRedeem'; - // const funcNameBuy = 'previewWithdraw'; + const srcTokenSymbolExit = 'stEUR'; + const destTokenSymbolExit = 'EURA'; + const funcNameSellExit = 'previewRedeem'; + const funcNameBuyExit = 'previewWithdraw'; const amountsForSell = [ 0n, - 1n * BI_POWS[tokens[srcTokenSymbol].decimals], - 2n * BI_POWS[tokens[srcTokenSymbol].decimals], - 3n * BI_POWS[tokens[srcTokenSymbol].decimals], - 4n * BI_POWS[tokens[srcTokenSymbol].decimals], - 5n * BI_POWS[tokens[srcTokenSymbol].decimals], - 6n * BI_POWS[tokens[srcTokenSymbol].decimals], - 7n * BI_POWS[tokens[srcTokenSymbol].decimals], - 8n * BI_POWS[tokens[srcTokenSymbol].decimals], - 9n * BI_POWS[tokens[srcTokenSymbol].decimals], - 10n * BI_POWS[tokens[srcTokenSymbol].decimals], + 1n * BI_POWS[tokens[srcTokenSymbolEnter].decimals], + 2n * BI_POWS[tokens[srcTokenSymbolEnter].decimals], + 3n * BI_POWS[tokens[srcTokenSymbolEnter].decimals], + 4n * BI_POWS[tokens[srcTokenSymbolEnter].decimals], + 5n * BI_POWS[tokens[srcTokenSymbolEnter].decimals], + 6n * BI_POWS[tokens[srcTokenSymbolEnter].decimals], + 7n * BI_POWS[tokens[srcTokenSymbolEnter].decimals], + 8n * BI_POWS[tokens[srcTokenSymbolEnter].decimals], + 9n * BI_POWS[tokens[srcTokenSymbolEnter].decimals], + 10n * BI_POWS[tokens[srcTokenSymbolEnter].decimals], ]; const amountsForBuy = [ 0n, - 1n * BI_POWS[tokens[destTokenSymbol].decimals], - 2n * BI_POWS[tokens[destTokenSymbol].decimals], - 3n * BI_POWS[tokens[destTokenSymbol].decimals], - 4n * BI_POWS[tokens[destTokenSymbol].decimals], - 5n * BI_POWS[tokens[destTokenSymbol].decimals], - 6n * BI_POWS[tokens[destTokenSymbol].decimals], - 7n * BI_POWS[tokens[destTokenSymbol].decimals], - 8n * BI_POWS[tokens[destTokenSymbol].decimals], - 9n * BI_POWS[tokens[destTokenSymbol].decimals], - 10n * BI_POWS[tokens[destTokenSymbol].decimals], + 1n * BI_POWS[tokens[destTokenSymbolEnter].decimals], + 2n * BI_POWS[tokens[destTokenSymbolEnter].decimals], + 3n * BI_POWS[tokens[destTokenSymbolEnter].decimals], + 4n * BI_POWS[tokens[destTokenSymbolEnter].decimals], + 5n * BI_POWS[tokens[destTokenSymbolEnter].decimals], + 6n * BI_POWS[tokens[destTokenSymbolEnter].decimals], + 7n * BI_POWS[tokens[destTokenSymbolEnter].decimals], + 8n * BI_POWS[tokens[destTokenSymbolEnter].decimals], + 9n * BI_POWS[tokens[destTokenSymbolEnter].decimals], + 10n * BI_POWS[tokens[destTokenSymbolEnter].decimals], ]; beforeAll(async () => { @@ -205,35 +205,89 @@ describe('AngleStakedStable', function () { } }); - it('getPoolIdentifiers and getPricesVolume SELL', async function () { + it('getPoolIdentifiers and getPricesVolume SELL - EURA', async () => { await testPricingOnNetwork( angleStakedStable, network, dexKey, blockNumber, - srcTokenSymbol, - destTokenSymbol, + srcTokenSymbolEnter, + destTokenSymbolEnter, SwapSide.SELL, amountsForSell, - funcNameSell, + funcNameSellEnter, ); }); - it('getPoolIdentifiers and getPricesVolume BUY', async function () { + it('getPoolIdentifiers and getPricesVolume BUY - stEUR', async () => { await testPricingOnNetwork( angleStakedStable, network, dexKey, blockNumber, - srcTokenSymbol, - destTokenSymbol, + srcTokenSymbolEnter, + destTokenSymbolEnter, SwapSide.BUY, amountsForBuy, - funcNameBuy, + funcNameBuyEnter, ); }); - it('getTopPoolsForToken', async function () { + it('getPoolIdentifiers and getPricesVolume SELL - stEUR', async () => { + await testPricingOnNetwork( + angleStakedStable, + network, + dexKey, + blockNumber, + srcTokenSymbolExit, + destTokenSymbolExit, + SwapSide.SELL, + amountsForSell, + funcNameSellExit, + ); + }); + + it('getPoolIdentifiers and getPricesVolume BUY - EURA', async () => { + await testPricingOnNetwork( + angleStakedStable, + network, + dexKey, + blockNumber, + srcTokenSymbolExit, + destTokenSymbolExit, + SwapSide.BUY, + amountsForBuy, + funcNameBuyExit, + ); + }); + + it('getTopPoolsForToken -EURA', async () => { + // We have to check without calling initializePricing, because + // pool-tracker is not calling that function + const newAngleStakedStable = new AngleStakedStable( + network, + dexKey, + dexHelper, + ); + if (newAngleStakedStable.updatePoolState) { + await newAngleStakedStable.updatePoolState(); + } + const poolLiquidity = await newAngleStakedStable.getTopPoolsForToken( + tokens[srcTokenSymbolEnter].address, + 10, + ); + console.log(`${srcTokenSymbolEnter} Top Pools:`, poolLiquidity); + + if (!newAngleStakedStable.hasConstantPriceLargeAmounts) { + checkPoolsLiquidity( + poolLiquidity, + Tokens[network][srcTokenSymbolEnter].address, + dexKey, + ); + } + }); + + it('getTopPoolsForToken - stEUR', async () => { // We have to check without calling initializePricing, because // pool-tracker is not calling that function const newAngleStakedStable = new AngleStakedStable( @@ -245,15 +299,15 @@ describe('AngleStakedStable', function () { await newAngleStakedStable.updatePoolState(); } const poolLiquidity = await newAngleStakedStable.getTopPoolsForToken( - tokens[srcTokenSymbol].address, + tokens[srcTokenSymbolExit].address, 10, ); - console.log(`${srcTokenSymbol} Top Pools:`, poolLiquidity); + console.log(`${srcTokenSymbolExit} Top Pools:`, poolLiquidity); if (!newAngleStakedStable.hasConstantPriceLargeAmounts) { checkPoolsLiquidity( poolLiquidity, - Tokens[network][srcTokenSymbol].address, + Tokens[network][srcTokenSymbolExit].address, dexKey, ); } diff --git a/src/dex/angle-staked-stable/angle-staked-stable-pool.ts b/src/dex/angle-staked-stable/angle-staked-stable-pool.ts index 6aded42f7..0180e9ea1 100644 --- a/src/dex/angle-staked-stable/angle-staked-stable-pool.ts +++ b/src/dex/angle-staked-stable/angle-staked-stable-pool.ts @@ -1,14 +1,14 @@ import { Interface } from '@ethersproject/abi'; -import { DeepReadonly } from 'ts-essentials'; -import { Address, BlockHeader, DexConfigMap, Log, Logger } from '../../types'; +import type { DeepReadonly } from 'ts-essentials'; +import type { BlockHeader, Log, Logger } from '../../types'; import { bigIntify, catchParseLogError, currentBigIntTimestampInS, } from '../../utils'; import { StatefulEventSubscriber } from '../../stateful-event-subscriber'; -import { IDexHelper } from '../../dex-helper/idex-helper'; -import { DexParams, PoolState } from './types'; +import type { IDexHelper } from '../../dex-helper/idex-helper'; +import type { DexParams, PoolState } from './types'; import StakedStableABI from '../../abi/angle/stagToken.json'; export class AngleStakedStableEventPool extends StatefulEventSubscriber { @@ -45,11 +45,11 @@ export class AngleStakedStableEventPool extends StatefulEventSubscriber> { - let poolState = { + const poolState = { totalAssets: 0n, totalSupply: 0n, lastUpdate: 0n, @@ -164,7 +164,7 @@ export class AngleStakedStableEventPool extends StatefulEventSubscriber 0n ? 1n : 0n; - return state.totalSupply == 0n + return state.totalSupply === 0n ? shares : (shares * newTotalAssets) / state.totalSupply + roundUp; } getRateRedeem(shares: bigint, state: PoolState): bigint { const newTotalAssets = this._accrue(state); - return state.totalSupply == 0n + return state.totalSupply === 0n ? shares : (shares * newTotalAssets) / state.totalSupply; } @@ -189,7 +189,7 @@ export class AngleStakedStableEventPool extends StatefulEventSubscriber 0n ? 1n : 0n; - return amount == 0n || state.totalSupply == 0n + return amount === 0n || state.totalSupply === 0n ? amount : (amount * state.totalSupply) / newTotalAssets + roundUp; } @@ -204,7 +204,7 @@ export class AngleStakedStableEventPool extends StatefulEventSubscriber 0) return amount; + if (exp === 0n || rate > 0) return amount; const expMinusOne = exp - 1n; const expMinusTwo = exp > 2n ? exp - 2n : 0n; const basePowerTwo = (rate * rate + this.HALF_BASE_27) / this.BASE_27; diff --git a/src/dex/angle-staked-stable/angle-staked-stable.ts b/src/dex/angle-staked-stable/angle-staked-stable.ts index 43c6d550b..2dd9815cf 100644 --- a/src/dex/angle-staked-stable/angle-staked-stable.ts +++ b/src/dex/angle-staked-stable/angle-staked-stable.ts @@ -1,6 +1,6 @@ import { Interface } from '@ethersproject/abi'; -import { AsyncOrSync } from 'ts-essentials'; -import { +import type { AsyncOrSync } from 'ts-essentials'; +import type { Token, Address, ExchangePrices, @@ -10,12 +10,12 @@ import { PoolLiquidity, Logger, } from '../../types'; -import { SwapSide, Network } from '../../constants'; +import { SwapSide, type Network } from '../../constants'; import * as CALLDATA_GAS_COST from '../../calldata-gas-cost'; import { getDexKeysWithNetwork } from '../../utils'; -import { IDex } from '../../dex/idex'; -import { IDexHelper } from '../../dex-helper/idex-helper'; -import { AngleStakedStableData, DexParams, PoolState } from './types'; +import type { IDex } from '../../dex/idex'; +import type { IDexHelper } from '../../dex-helper/idex-helper'; +import type { AngleStakedStableData, DexParams } from './types'; import { SimpleExchange } from '../simple-exchange'; import { AngleStakedStableConfig, Adapters } from './config'; import { AngleStakedStableEventPool } from './angle-staked-stable-pool'; @@ -41,7 +41,7 @@ export class AngleStakedStable logger: Logger; protected eventPools: AngleStakedStableEventPool | null = null; - protected isPaused: boolean = false; + protected isPaused = false; constructor( readonly network: Network, @@ -53,8 +53,8 @@ export class AngleStakedStable const config = AngleStakedStableConfig[dexKey][network]; this.logger = dexHelper.getLogger(dexKey); this.config = { - stEUR: config.stEUR.toLowerCase(), - agEUR: config.agEUR.toLowerCase(), + stEUR: config.stEUR!.toLowerCase(), + EURA: config.EURA.toLowerCase(), }; } @@ -90,7 +90,7 @@ export class AngleStakedStable blockNumber: number, ): Promise { if (!this._knownAddress(srcToken, destToken)) return []; - else return [this.dexKey]; + return [this.dexKey]; } // Returns pool prices for amounts. @@ -112,7 +112,7 @@ export class AngleStakedStable const state = this.eventPools?.getState(blockNumber); if (this.eventPools === null || state === undefined || state === null) return null; - if (srcTokenAddress === this.config.agEUR && side === SwapSide.SELL) + if (srcTokenAddress === this.config.EURA && side === SwapSide.SELL) return [ { prices: amounts.map(amount => @@ -122,10 +122,10 @@ export class AngleStakedStable gasCost: AngleStakedGasCost, exchange: this.dexKey, data: { exchange: `${this.config.stEUR}` }, - poolAddresses: [`${this.config.stEUR}_${this.config.agEUR}`], + poolAddresses: [`${this.config.stEUR}_${this.config.EURA}`], }, ]; - else if (destTokenAddress === this.config.agEUR && side === SwapSide.SELL) + if (destTokenAddress === this.config.EURA && side === SwapSide.SELL) return [ { prices: amounts.map(share => @@ -135,10 +135,10 @@ export class AngleStakedStable gasCost: AngleStakedGasCost, exchange: this.dexKey, data: { exchange: `${this.config.stEUR}` }, - poolAddresses: [`${this.config.stEUR}_${this.config.agEUR}`], + poolAddresses: [`${this.config.stEUR}_${this.config.EURA}`], }, ]; - else if (srcTokenAddress === this.config.agEUR && side === SwapSide.BUY) + if (srcTokenAddress === this.config.EURA && side === SwapSide.BUY) return [ { prices: amounts.map(share => @@ -148,22 +148,21 @@ export class AngleStakedStable gasCost: AngleStakedGasCost, exchange: this.dexKey, data: { exchange: `${this.config.stEUR}` }, - poolAddresses: [`${this.config.stEUR}_${this.config.agEUR}`], - }, - ]; - else - return [ - { - prices: amounts.map(amount => - this.eventPools!.getRateWithdraw(amount, state), - ), - unit: this.eventPools.getRateWithdraw(1n * BigInt(10 ** 18), state), - gasCost: AngleStakedGasCost, - exchange: this.dexKey, - data: { exchange: `${this.config.stEUR}` }, - poolAddresses: [`${this.config.stEUR}_${this.config.agEUR}`], + poolAddresses: [`${this.config.stEUR}_${this.config.EURA}`], }, ]; + return [ + { + prices: amounts.map(amount => + this.eventPools!.getRateWithdraw(amount, state), + ), + unit: this.eventPools.getRateWithdraw(1n * BigInt(10 ** 18), state), + gasCost: AngleStakedGasCost, + exchange: this.dexKey, + data: { exchange: `${this.config.stEUR}` }, + poolAddresses: [`${this.config.stEUR}_${this.config.EURA}`], + }, + ]; } // Returns estimated gas cost of calldata for this DEX in multiSwap @@ -212,7 +211,7 @@ export class AngleStakedStable // Encode here the transaction arguments const swapData = - srcToken.toLowerCase() === this.config.agEUR + srcToken.toLowerCase() === this.config.EURA ? AngleStakedStableEventPool.angleStakedStableIface.encodeFunctionData( side === SwapSide.SELL ? 'deposit' : 'mint', [ @@ -275,24 +274,23 @@ export class AngleStakedStable ): Promise { if ( this.isPaused || - (tokenAddress.toLowerCase() != this.config.agEUR && - tokenAddress.toLowerCase() != this.config.stEUR) + (tokenAddress.toLowerCase() !== this.config.EURA && + tokenAddress.toLowerCase() !== this.config.stEUR) ) return []; - else - return [ - { - exchange: this.dexKey, - address: this.config.stEUR, - connectorTokens: [ - tokenAddress.toLowerCase() == this.config.agEUR - ? ({ address: this.config.stEUR, decimals: 18 } as Token) - : ({ address: this.config.agEUR, decimals: 18 } as Token), - ], - // liquidity is infinite as to have been able to mint stEUR, you must have deposited agEUR - liquidityUSD: 1e12, - }, - ]; + return [ + { + exchange: this.dexKey, + address: this.config.stEUR, + connectorTokens: [ + tokenAddress.toLowerCase() === this.config.EURA + ? ({ address: this.config.stEUR, decimals: 18 } as Token) + : ({ address: this.config.EURA, decimals: 18 } as Token), + ], + // liquidity is infinite as to have been able to mint stEUR, you must have deposited EURA + liquidityUSD: 1e12, + }, + ]; } // This is optional function in case if your implementation has acquired any resources @@ -304,10 +302,16 @@ export class AngleStakedStable const destTokenAddress = destToken.address.toLowerCase(); if ( !( - (srcTokenAddress === this.config.agEUR && - destTokenAddress === this.config.stEUR) || - (srcTokenAddress === this.config.stEUR && - destTokenAddress === this.config.agEUR) + ( + (srcTokenAddress === this.config.EURA && + destTokenAddress === this.config.stEUR) || + (srcTokenAddress === this.config.stEUR && + destTokenAddress === this.config.EURA) + ) + // (srcTokenAddress === this.config.USDA && + // destTokenAddress === this.config.stUSD) || + // (srcTokenAddress === this.config.stUSD && + // destTokenAddress === this.config.USDA) ) ) { return false; diff --git a/src/dex/angle-staked-stable/config.ts b/src/dex/angle-staked-stable/config.ts index 5098d1d28..1415c1af8 100644 --- a/src/dex/angle-staked-stable/config.ts +++ b/src/dex/angle-staked-stable/config.ts @@ -5,20 +5,40 @@ import { Network, SwapSide } from '../../constants'; export const AngleStakedStableConfig: DexConfigMap = { AngleStakedStable: { [Network.ARBITRUM]: { - agEUR: '0xfa5ed56a203466cbbc2430a43c66b9d8723528e7', + EURA: '0xfa5ed56a203466cbbc2430a43c66b9d8723528e7', stEUR: '0x004626A008B1aCdC4c74ab51644093b155e59A23', + // USDA: "0x0000206329b97DB379d5E1Bf586BbDB969C63274", + // stUSD: "0x0022228a2cc5E7eF0274A7Baa600d44da5aB5776", }, [Network.MAINNET]: { - agEUR: '0x1a7e4e63778B4f12a199C062f3eFdD288afCBce8', + EURA: '0x1a7e4e63778B4f12a199C062f3eFdD288afCBce8', stEUR: '0x004626A008B1aCdC4c74ab51644093b155e59A23', + // USDA: "0x0000206329b97DB379d5E1Bf586BbDB969C63274", + // stUSD: "0x0022228a2cc5E7eF0274A7Baa600d44da5aB5776", }, [Network.OPTIMISM]: { - agEUR: '0x9485aca5bbbe1667ad97c7fe7c4531a624c8b1ed', + EURA: '0x9485aca5bbbe1667ad97c7fe7c4531a624c8b1ed', stEUR: '0x004626A008B1aCdC4c74ab51644093b155e59A23', + // USDA: "0x0000206329b97DB379d5E1Bf586BbDB969C63274", + // stUSD: "0x0022228a2cc5E7eF0274A7Baa600d44da5aB5776", }, [Network.POLYGON]: { - agEUR: '0xe0b52e49357fd4daf2c15e02058dce6bc0057db4', + EURA: '0xe0b52e49357fd4daf2c15e02058dce6bc0057db4', stEUR: '0x004626A008B1aCdC4c74ab51644093b155e59A23', + // USDA: "0x0000206329b97DB379d5E1Bf586BbDB969C63274", + // stUSD: "0x0022228a2cc5E7eF0274A7Baa600d44da5aB5776", + }, + [Network.BASE]: { + EURA: '0xA61BeB4A3d02decb01039e378237032B351125B4', + stEUR: '0x004626A008B1aCdC4c74ab51644093b155e59A23', + // USDA: "0x0000206329b97DB379d5E1Bf586BbDB969C63274", + // stUSD: "0x0022228a2cc5E7eF0274A7Baa600d44da5aB5776", + }, + [Network.BSC]: { + EURA: '0x12f31B73D812C6Bb0d735a218c086d44D5fe5f89', + stEUR: '0x004626A008B1aCdC4c74ab51644093b155e59A23', + // USDA: "0x0000206329b97DB379d5E1Bf586BbDB969C63274", + // stUSD: "0x0022228a2cc5E7eF0274A7Baa600d44da5aB5776", }, }, }; diff --git a/src/dex/angle-staked-stable/types.ts b/src/dex/angle-staked-stable/types.ts index ccc69d5d3..880676ad8 100644 --- a/src/dex/angle-staked-stable/types.ts +++ b/src/dex/angle-staked-stable/types.ts @@ -11,6 +11,6 @@ export type PoolState = { export type AngleStakedStableData = { exchange: Address }; export type DexParams = { + EURA: Address; stEUR: Address; - agEUR: Address; }; diff --git a/tests/constants-e2e.ts b/tests/constants-e2e.ts index b3fae1454..6a8a13d51 100644 --- a/tests/constants-e2e.ts +++ b/tests/constants-e2e.ts @@ -315,7 +315,7 @@ export const Tokens: { address: '0xc411db5f5eb3f7d552f9b8454b2d74097ccde6e3', decimals: 6, }, - agEUR: { + EURA: { address: '0x1a7e4e63778b4f12a199c062f3efdd288afcbce8', decimals: 18, }, @@ -323,6 +323,14 @@ export const Tokens: { address: '0x004626a008b1acdc4c74ab51644093b155e59a23', decimals: 18, }, + USDA: { + address: '0x0000206329b97DB379d5E1Bf586BbDB969C63274', + decimals: 18, + }, + stUSD: { + address: '0x0022228a2cc5E7eF0274A7Baa600d44da5aB5776', + decimals: 18, + }, GHO: { address: '0x40d16fc0246ad3160ccc09b8d0d3a2cd28ae6c2f', decimals: 18, @@ -473,7 +481,7 @@ export const Tokens: { address: '0xa3fa99a148fa48d14ed51d610c367c61876997f1', decimals: 18, }, - agEUR: { + EURA: { address: '0xe0b52e49357fd4daf2c15e02058dce6bc0057db4', decimals: 18, }, @@ -481,6 +489,14 @@ export const Tokens: { address: '0x004626a008b1acdc4c74ab51644093b155e59a23', decimals: 18, }, + USDA: { + address: '0x0000206329b97DB379d5E1Bf586BbDB969C63274', + decimals: 18, + }, + stUSD: { + address: '0x0022228a2cc5E7eF0274A7Baa600d44da5aB5776', + decimals: 18, + }, SDEX: { address: '0x6899fAcE15c14348E1759371049ab64A3a06bFA6', decimals: 18, @@ -651,6 +667,18 @@ export const Tokens: { address: '0xFdc66A08B0d0Dc44c17bbd471B88f49F50CdD20F', decimals: 18, }, + EURA: { + address: '0x12f31B73D812C6Bb0d735a218c086d44D5fe5f89', + decimals: 18, + }, + USDA: { + address: '0x0000206329b97DB379d5E1Bf586BbDB969C63274', + decimals: 18, + }, + stUSD: { + address: '0x0022228a2cc5E7eF0274A7Baa600d44da5aB5776', + decimals: 18, + }, }, [Network.AVALANCHE]: { USDCe: { @@ -893,7 +921,7 @@ export const Tokens: { address: '0x6bB7A17AcC227fd1F6781D1EEDEAE01B42047eE0', decimals: 18, }, - agEUR: { + EURA: { address: '0xfa5ed56a203466cbbc2430a43c66b9d8723528e7', decimals: 18, }, @@ -901,6 +929,14 @@ export const Tokens: { address: '0x004626a008b1acdc4c74ab51644093b155e59a23', decimals: 18, }, + USDA: { + address: '0x0000206329b97DB379d5E1Bf586BbDB969C63274', + decimals: 18, + }, + stUSD: { + address: '0x0022228a2cc5E7eF0274A7Baa600d44da5aB5776', + decimals: 18, + }, GRAIL: { address: '0x3d9907f9a368ad0a51be60f7da3b97cf940982d8', decimals: 18, @@ -968,7 +1004,7 @@ export const Tokens: { address: '0x68f180fcCe6836688e9084f035309E29Bf0A2095', decimals: 8, }, - agEUR: { + EURA: { address: '0x9485aca5bbbe1667ad97c7fe7c4531a624c8b1ed', decimals: 18, }, @@ -976,6 +1012,14 @@ export const Tokens: { address: '0x004626a008b1acdc4c74ab51644093b155e59a23', decimals: 18, }, + USDA: { + address: '0x0000206329b97DB379d5E1Bf586BbDB969C63274', + decimals: 18, + }, + stUSD: { + address: '0x0022228a2cc5E7eF0274A7Baa600d44da5aB5776', + decimals: 18, + }, frxETH: { address: '0x6806411765Af15Bddd26f8f544A34cC40cb9838B', decimals: 18, @@ -1040,6 +1084,18 @@ export const Tokens: { address: '0xFd4330b0312fdEEC6d4225075b82E00493FF2e3f', decimals: 18, }, + EURA: { + address: '0xA61BeB4A3d02decb01039e378237032B351125B4', + decimals: 18, + }, + USDA: { + address: '0x0000206329b97DB379d5E1Bf586BbDB969C63274', + decimals: 18, + }, + stUSD: { + address: '0x0022228a2cc5E7eF0274A7Baa600d44da5aB5776', + decimals: 18, + }, ETH: { address: ETHER_ADDRESS, decimals: 18 }, }, }; @@ -1106,8 +1162,10 @@ export const Holders: { aEthWETH: '0x645C4c0c95C1Aa6EF25d12f4a25038cA9b0C6Cc7', dUSDC: '0x2FC2F705110A7F46Ce85F701d7217EF1018f01A3', PSP: '0xE5E5440a1CE69C5cf67BFFA74d185e57c31b43E5', - agEUR: '0xa116f421ff82a9704428259fd8cc63347127b777', - stEUR: '0xfda462548ce04282f4b6d6619823a7c64fdc0185', + EURA: '0xa116f421ff82a9704428259fd8cc63347127b777', + stEUR: '0xdC7Aa225964267c7E0EfB35f4931426209E90312', + USDA: '0x5a54aD9860B08AAee07174887f9ee5107b0A2e72', + stUSD: '0x4e83c0a323b68E3Bc7CC8a4E35326Fd0544A291E', crvUSD: '0xA920De414eA4Ab66b97dA1bFE9e6EcA7d4219635', GHO: '0x844Dc85EdD8492A56228D293cfEbb823EF3E10EC', wibBTC: '0xFbdCA68601f835b27790D98bbb8eC7f05FDEaA9B', @@ -1151,6 +1209,10 @@ export const Holders: { amUSDC: '0x6e7f19cd23049c7118e14470e2bf85d2e26ee0ae', MAI: '0x9a8cf02f3e56c664ce75e395d0e4f3dc3dafe138', SDEX: '0xB0470cF15B22a6A32c49a7C20E3821B944A76058', + EURA: '0x9A760aa1Fe631fD9aC0Aee0965736121c7c132cc', + stEUR: '0xA9DdD91249DFdd450E81E1c56Ab60E1A62651701', + USDA: '0x741383AbD73891b40822A069f14d6fc5b5685020', + stUSD: '0xA9DdD91249DFdd450E81E1c56Ab60E1A62651701', }, [Network.FANTOM]: { DAI: '0x370f4b2dcf75c94d8d4450b493661a9c6170d0b5', @@ -1196,6 +1258,9 @@ export const Holders: { USDFI: '0x2E00D722e091836B39Db3e4dcE6eE51c90c5B221', SDEX: '0xB0470cF15B22a6A32c49a7C20E3821B944A76058', BNBx: '0xFF4606bd3884554CDbDabd9B6e25E2faD4f6fc54', + EURA: '0x4A5362ef534FFB27510E4E4C9A215BB5436377C2', + USDA: '0x16BCD5eFdd02da71dB7fc3a7468f21c0e6A617c2', + stUSD: '0x0022228a2cc5E7eF0274A7Baa600d44da5aB5776', }, [Network.AVALANCHE]: { AVAX: '0xD6216fC19DB775Df9774a6E33526131dA7D19a2c', @@ -1258,6 +1323,10 @@ export const Holders: { RDNT: '0x62383739d68dd0f844103db8dfb05a7eded5bbe6', SDEX: '0xb0470cf15b22a6a32c49a7c20e3821b944a76058', wstETH: '0x916792f7734089470de27297903bed8a4630b26d', + EURA: '0xf89051707a91D6b63ca7B090B15D1Eb964d12494', + stEUR: '0xE588611e7A2392507879E3be80531654b85C16aA', + USDA: '0xa9ddd91249dfdd450e81e1c56ab60e1a62651701', + stUSD: '0xa9ddd91249dfdd450e81e1c56ab60e1a62651701', }, [Network.OPTIMISM]: { ETH: '0x9ef21bE1C270AA1c3c3d750F458442397fBFFCB6', @@ -1276,6 +1345,10 @@ export const Holders: { rETH: '0x4c2e69e58b14de9afedfb94319519ce34e087283', WBTC: '0xb9c8f0d3254007ee4b98970b94544e473cd610ec', frxETH: '0x4d4edf8291d169f975b99914b6ab3326abb45938', + EURA: '0xC18dAC166eDa9538933258d21A272C1775C19c73', + stEUR: '0xA9DdD91249DFdd450E81E1c56Ab60E1A62651701', + USDA: '0x7dFf12833a6f0e88f610E79E11E9506848cCF187', + stUSD: '0x7FC680496D88610a69Ad79647f327892879b31CF', }, [Network.ZKEVM]: { ETH: '0x4F9A0e7FD2Bf6067db6994CF12E4495Df938E6e9', @@ -1295,6 +1368,10 @@ export const Holders: { BAL: '0x854b004700885a61107b458f11ecc169a019b764', GOLD: '0x1374c25b3710758c326ee0c70ec48b595d5ccf8c', SDEX: '0xa5d378c05192e3f1f365d6298921879c4d51c5a3', + EURA: '0x5b5614b9fffab7c751799eb12d5cb9165c8c40ad', + stEUR: '0xA9DdD91249DFdd450E81E1c56Ab60E1A62651701', + USDA: '0x177772af6669aca61c23d325ab4213e8ba56c79d', + stUSD: '0x8deeffb6047b8ee91b09334eb2a4ca120f43f596', }, };