Skip to content

Commit

Permalink
fix: cleanup & tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JackieJoo committed Apr 8, 2024
1 parent 7e17b7a commit 529a7d7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 62 deletions.
74 changes: 14 additions & 60 deletions src/dex/angle-staked-stable/angle-staked-stable-e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,6 @@ import { Network, ContractMethod, SwapSide } from '../../constants';
import { StaticJsonRpcProvider } from '@ethersproject/providers';
import { generateConfig } from '../../config';

/*
README
======
This test script should add e2e tests for AngleStakedStable. The tests
should cover as many cases as possible. Most of the DEXes follow
the following test structure:
- DexName
- ForkName + Network
- ContractMethod
- ETH -> Token swap
- Token -> ETH swap
- Token -> Token swap
The template already enumerates the basic structure which involves
testing simpleSwap, multiSwap, megaSwap contract methods for
ETH <> TOKEN and TOKEN <> TOKEN swaps. You should replace tokenA and
tokenB with any two highly liquid tokens on AngleStakedStable for the tests
to work. If the tokens that you would like to use are not defined in
Tokens or Holders map, you can update the './tests/constants-e2e'
Other than the standard cases that are already added by the template
it is highly recommended to add test cases which could be specific
to testing AngleStakedStable (Eg. Tests based on poolType, special tokens,
etc).
You can run this individual test script by running:
`npx jest src/dex/<dex-name>/<dex-name>-e2e.test.ts`
e2e tests use the Tenderly fork api. Please add the following to your
.env file:
TENDERLY_TOKEN=Find this under Account>Settings>Authorization.
TENDERLY_ACCOUNT_ID=Your Tenderly account name.
TENDERLY_PROJECT=Name of a Tenderly project you have created in your
dashboard.
(This comment should be removed from the final implementation)
*/

function testForNetwork(
network: Network,
dexKey: string,
Expand Down Expand Up @@ -91,6 +52,19 @@ function testForNetwork(
provider,
);
});
it(`${tokenBSymbol} -> ${tokenASymbol}`, async () => {
await testE2E(
tokens[tokenBSymbol],
tokens[tokenASymbol],
holders[tokenBSymbol],
side === SwapSide.SELL ? tokenBAmount : tokenAAmount,
side,
dexKey,
contractMethod,
network,
provider,
);
});
});
});
}),
Expand All @@ -101,7 +75,7 @@ function testForNetwork(
describe('AngleStakedStable E2E', () => {
const dexKey = 'AngleStakedStable';

describe('Mainnet - agEUR -> stEUR', () => {
describe('Mainnet', () => {
const network = Network.MAINNET;

const tokenASymbol: string = 'agEUR';
Expand All @@ -111,26 +85,6 @@ describe('AngleStakedStable E2E', () => {
const tokenBAmount: string = '1000000000000000000';
const nativeTokenAmount = '1000000000000000000';

testForNetwork(
network,
dexKey,
tokenASymbol,
tokenBSymbol,
tokenAAmount,
tokenBAmount,
nativeTokenAmount,
);
});
describe('Mainnet - stEUR -> agEUR', () => {
const network = Network.MAINNET;

const tokenASymbol: string = 'stEUR';
const tokenBSymbol: string = 'agEUR';

const tokenAAmount: string = '1000000000000000000';
const tokenBAmount: string = '1000000000000000000';
const nativeTokenAmount = '1000000000000000000';

testForNetwork(
network,
dexKey,
Expand Down
2 changes: 1 addition & 1 deletion tests/constants-e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ export const Holders: {
EURS: '0xC1056Adeb61a01964Ea265cA95EffB7016f9Ed78',
EURT: '0x6914FC70fAC4caB20a8922E900C4BA57fEECf8E1',
CRV: '0x7a16fF8270133F063aAb6C9977183D9e72835428',
jEUR: '0x4f0CF2F63913524b85c1126AB7eE7957857f3482',
jEUR: '0x937Df4e3d6dB229A10ff0098ab3A1bCC40C33ea4',
UST: '0xf16e9b0d03470827a95cdfd0cb8a8a3b46969b91',
SAITAMA: '0x763d5d93f27615aac852b70549f5877b92193864',
aETH: '0xc03c4476fbe25138bf724fa1b95551c6e6b8fd2c',
Expand Down
2 changes: 1 addition & 1 deletion tests/utils-e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class APIParaswapSDK implements IParaSwapSDK {
amount: amount.toString(),
options: {
includeDEXS: [this.dexKey],
includeContractMethods: [contractMethod],
includeContractMethods: [contractMethod as any],
partner: 'any',
},
srcDecimals: from.decimals,
Expand Down

0 comments on commit 529a7d7

Please sign in to comment.