Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Hashflow to be needWrapNative=true + CurveV1Factory dynamic needWrapNative #807

Merged
merged 34 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
174682c
fix: use partialSwap that allows insert amount on Dexalot
KanievskyiDanylo Sep 23, 2024
7170e62
Update Hashflow to be needWrapNative=true
aburkut Oct 7, 2024
cb00a9f
Merge branch 'feat/BACK-1706' into aburkut/back-1507-hashflow-need-wr…
aburkut Oct 8, 2024
88a5fd1
Add dynamic needWrapNative support and update CurveV1Factory to use t…
aburkut Oct 8, 2024
f16e592
Add pool discovery fixes for CurveV1Factory
aburkut Oct 8, 2024
780a303
3.8.42-hashflow-need-wrap-native-curve-v1-factory-dynamic-need-wrap-n…
aburkut Oct 8, 2024
13d2058
Update adapter addresses in config
aburkut Oct 9, 2024
c4952d1
refactor needWrapNative for CurveV1Factory
aburkut Oct 9, 2024
e813c0b
add more e2e tests for CurveV1Factory
aburkut Oct 9, 2024
e6da1b3
solve merge conflicts
aburkut Oct 9, 2024
477d058
solve merge conflicts
aburkut Oct 9, 2024
3112d68
3.8.42-hashflow-need-wrap-native-curve-v1-factory-dynamic-need-wrap-n…
aburkut Oct 9, 2024
3c26857
fix weth pools discovery for hashflow
aburkut Oct 9, 2024
0fa2092
3.8.42-hashflow-need-wrap-native-curve-v1-factory-dynamic-need-wrap-n…
aburkut Oct 9, 2024
3e7a27d
update e2e tests for hashflow
aburkut Oct 9, 2024
46cb755
rollback executor addresses
aburkut Oct 9, 2024
a49dc10
3.8.42-hashflow-need-wrap-native-curve-v1-factory-dynamic-need-wrap-n…
aburkut Oct 9, 2024
d9128d0
return back dexalot changes
aburkut Oct 10, 2024
b7ca156
update executor addresses
aburkut Oct 10, 2024
6e20055
3.8.42-hashflow-need-wrap-native-curve-v1-factory-dynamic-need-wrap-n…
aburkut Oct 10, 2024
e7a96a3
update ex01 and ex02 addresses on multiple chains in config
aburkut Oct 10, 2024
277716e
3.8.42-hashflow-need-wrap-native-curve-v1-factory-dynamic-need-wrap-n…
aburkut Oct 10, 2024
044f2f5
update ex03 address on multiple chains in config
aburkut Oct 10, 2024
80e2480
refactor needWrapNative
aburkut Oct 10, 2024
509b048
fix requested change about eth address
aburkut Oct 10, 2024
ec35a74
fix requested change about eth address
aburkut Oct 10, 2024
a794599
3.8.42-hashflow-need-wrap-native-curve-v1-factory-dynamic-need-wrap-n…
aburkut Oct 10, 2024
da0f116
chore: refactor dynamic needWrapNative on CurveV1Factory
KanievskyiDanylo Oct 11, 2024
cdcc37d
chore: simplify pool filtering in curve-v1-factory
KanievskyiDanylo Oct 11, 2024
2c1c714
3.8.42-hashflow-need-wrap-native-curve-v1-factory-dynamic-need-wrap-n…
aburkut Oct 11, 2024
3aad0e5
add base chain support for hashflow
aburkut Oct 11, 2024
611a41b
rollback base chain support for hashflow
aburkut Oct 11, 2024
082572e
3.9.0
aburkut Oct 11, 2024
c4bf089
remove commented line
aburkut Oct 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@paraswap/dex-lib",
"version": "3.8.41",
"version": "3.8.42-hashflow-need-wrap-native-curve-v1-factory-dynamic-need-wrap-native.5",
"main": "build/index.js",
"types": "build/index.d.ts",
"repository": "https://github.com/paraswap/paraswap-dex-lib",
Expand Down Expand Up @@ -54,8 +54,8 @@
"@balancer-labs/sor": "4.1.1-beta.4",
"@bgd-labs/aave-address-book": "2.21.1",
"@ethersproject/abi": "^5.7.0",
"@hashflow/sdk": "1.2.4",
"@hashflow/taker-js": "0.3.4",
"@hashflow/sdk": "^2.2.7",
"@hashflow/taker-js": "^0.3.7",
"@paraswap/core": "2.4.0",
"async": "^3.2.4",
"axios": "0.27.2",
Expand Down
64 changes: 33 additions & 31 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,18 @@ const baseConfigs: { [network: number]: BaseConfig } = {
privateHttpProvider: process.env.HTTP_PROVIDER_1,
augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
executorsAddresses: {
Executor01: '0xa600910B670804230E00A100000D28000AE005C0',
Executor02: '0x3800091020a00290f20606b000000000E38c33Ef',
Executor03: '0x20004f017a0bC0050bc004d9C500a7A089800000',
Executor01: '0x000010036C0190E009a000d0fc3541100A07380A',
Executor02: '0x00C600b30fb0400701010F4b080409018B9006E0',
Executor03: '0xe009F00e200A090090fC70e02d70B232000c0802',
},
adapterAddresses: {
Adapter01: '0x9bE264469eF954c139Da4A45Cf76CbCC5e3A6A73',
Adapter02: '0xFC2Ba6E830a04C25e207B8214b26d8C713F6881F',
Adapter03: '0xBAEeb4540f59d30E567a5B563CC0c4587eDd9366',
Adapter03: '0x80F5509eDD9A7AAfd14Cf2B0436dC23385F760d7',
Adapter04: '0x369A2FDb910d432f0a07381a5E3d27572c876713',
Adapter05: '0x3329dfa55A40B450952FBE0203167Ae6908E656d',
Adapter06: '0xAeb7B3688a658C3f3B1AEd94d69b7b8045D64B57',
BuyAdapter: '0x84bEF12C9931cE12662cc9F2366b6a5029E4BD29',
BuyAdapter: '0x736518161516c1cfBD5bf5e7049FCBDC9b933987',
BuyAdapter02: '0x2299568c3299e7420033deA9009233FF89F5C485',
},
uniswapV2ExchangeRouterAddress:
Expand Down Expand Up @@ -146,9 +146,9 @@ const baseConfigs: { [network: number]: BaseConfig } = {
privateHttpProvider: process.env.HTTP_PROVIDER_56,
augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
executorsAddresses: {
Executor01: '0xa600910B670804230E00A100000D28000AE005C0',
Executor02: '0x3800091020a00290f20606b000000000E38c33Ef',
Executor03: '0x20004f017a0bC0050bc004d9C500a7A089800000',
Executor01: '0x000010036C0190E009a000d0fc3541100A07380A',
Executor02: '0x00C600b30fb0400701010F4b080409018B9006E0',
Executor03: '0xe009F00e200A090090fC70e02d70B232000c0802',
},
hashFlowAuthToken: process.env.API_KEY_HASHFLOW_AUTH_TOKEN || '',
swaapV2AuthToken: process.env.API_KEY_SWAAP_V2_AUTH_TOKEN || '',
Expand All @@ -157,7 +157,8 @@ const baseConfigs: { [network: number]: BaseConfig } = {
adapterAddresses: {
BscAdapter01: '0xA31d9C571DF00e0F428B0bD24c34D103E8112222',
BscAdapter02: '0xb9768a1C6e4917E30927beeC4b2874d45fD333Cf',
BscBuyAdapter: '0x06158216cFf091ADc7340441717edd8Ebd7A54d7',
BscAdapter03: '0x34D41cE301257a4615D4F5AD260FA91D03925243',
BscBuyAdapter: '0x56cc27eCfb42E22a413E785086E708dA87aF8103',
},
rpcPollingMaxAllowedStateDelayInBlocks: 1,
rpcPollingBlocksBackToTriggerUpdate: 1,
Expand All @@ -181,18 +182,18 @@ const baseConfigs: { [network: number]: BaseConfig } = {
privateHttpProvider: process.env.HTTP_PROVIDER_137,
augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
executorsAddresses: {
Executor01: '0xa600910B670804230E00A100000D28000AE005C0',
Executor02: '0x3800091020a00290f20606b000000000E38c33Ef',
Executor03: '0x20004f017a0bC0050bc004d9C500a7A089800000',
Executor01: '0x000010036C0190E009a000d0fc3541100A07380A',
Executor02: '0x00C600b30fb0400701010F4b080409018B9006E0',
Executor03: '0xe009F00e200A090090fC70e02d70B232000c0802',
},
hashFlowAuthToken: process.env.API_KEY_HASHFLOW_AUTH_TOKEN || '',
hashFlowDisabledMMs:
process.env[`HASHFLOW_DISABLED_MMS_137`]?.split(',') || [],
adapterAddresses: {
PolygonAdapter01: '0xE44769f42E1e9592f86B82f206407a8f7C84b4ed',
PolygonAdapter02: '0xE7d4CC1589311BD7Bb58739269748a20DAAD755D',
PolygonAdapter02: '0xC5A6637aA6D3E0fCBE870c2B5a5377988097f3F4',
PolygonAdapter03: '0x5A9037E0DCa7a8f30C1E6925e92eb402B7F6250E',
PolygonBuyAdapter: '0x60577C58F46AD63f36607541b86011c19B2033Fe',
PolygonBuyAdapter: '0xb96aB183767219d3b5B72D0f8DC96e2201653fB0',
},
uniswapV2ExchangeRouterAddress:
'0xf3938337F7294fEf84e9B2c6D548A93F956Cc281',
Expand Down Expand Up @@ -222,14 +223,14 @@ const baseConfigs: { [network: number]: BaseConfig } = {
dexalotAuthToken: process.env.API_KEY_DEXALOT_AUTH_TOKEN || '',
augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
executorsAddresses: {
Executor01: '0xa600910B670804230E00A100000D28000AE005C0',
Executor02: '0x3800091020a00290f20606b000000000E38c33Ef',
Executor03: '0x20004f017a0bC0050bc004d9C500a7A089800000',
Executor01: '0x000010036C0190E009a000d0fc3541100A07380A',
Executor02: '0x00C600b30fb0400701010F4b080409018B9006E0',
Executor03: '0xe009F00e200A090090fC70e02d70B232000c0802',
},
adapterAddresses: {
AvalancheAdapter01: '0x745Ec73855CeC7249E5fF4c9DD81cc65b4D297a9',
AvalancheAdapter02: '0xf34974E9E4A8F07C23062716ff15201Fb97ab595',
AvalancheBuyAdapter: '0x392BbDb4fFe2F6620F0d40b53A50E1c724fA5499',
AvalancheAdapter02: '0x5FC6a951c5e279d77c4d37F4aa14DaE0187BFD2A',
AvalancheBuyAdapter: '0x40D9aF198DbfA04734558d53831362059f7Bdcb5',
},
uniswapV2ExchangeRouterAddress:
'0x53e693c6C7FFC4446c53B205Cf513105Bf140D7b',
Expand Down Expand Up @@ -291,16 +292,17 @@ const baseConfigs: { [network: number]: BaseConfig } = {
process.env[`HASHFLOW_DISABLED_MMS_42161`]?.split(',') || [],
augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
executorsAddresses: {
Executor01: '0xa600910B670804230E00A100000D28000AE005C0',
Executor02: '0x3800091020a00290f20606b000000000E38c33Ef',
Executor03: '0x20004f017a0bC0050bc004d9C500a7A089800000',
Executor01: '0x000010036C0190E009a000d0fc3541100A07380A',
Executor02: '0x00C600b30fb0400701010F4b080409018B9006E0',
Executor03: '0xe009F00e200A090090fC70e02d70B232000c0802',
},
dexalotAuthToken: process.env.API_KEY_DEXALOT_AUTH_TOKEN || '',
adapterAddresses: {
ArbitrumAdapter01: '0x369A2FDb910d432f0a07381a5E3d27572c876713',
ArbitrumAdapter02: '0x58a5f0b73969800FAFf8556cD2187E3FCE71A6cb',
ArbitrumAdapter03: '0x8119ea49712ee6Ba420C9E503B6fF594e71d9AB2',
ArbitrumAdapter03: '0x033683deBC0860AbF6F502E1b5F381CFc11C7615',
ArbitrumBuyAdapter: '0x23A85545632C7f11A53d64AaB532dc06c5731278',
ArbitrumBuyAdapter02: '0x78A7BcEFc470b7070E03684E567c43Af97487443',
},
uniswapV2ExchangeRouterAddress:
'0xB41dD984730dAf82f5C41489E21ac79D5e3B61bC',
Expand All @@ -325,18 +327,18 @@ const baseConfigs: { [network: number]: BaseConfig } = {
privateHttpProvider: process.env.HTTP_PROVIDER_10,
augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
executorsAddresses: {
Executor01: '0xa600910B670804230E00A100000D28000AE005C0',
Executor02: '0x3800091020a00290f20606b000000000E38c33Ef',
Executor03: '0x20004f017a0bC0050bc004d9C500a7A089800000',
Executor01: '0x000010036C0190E009a000d0fc3541100A07380A',
Executor02: '0x00C600b30fb0400701010F4b080409018B9006E0',
Executor03: '0xe009F00e200A090090fC70e02d70B232000c0802',
},
hashFlowAuthToken: process.env.API_KEY_HASHFLOW_AUTH_TOKEN || '',
swaapV2AuthToken: process.env.API_KEY_SWAAP_V2_AUTH_TOKEN || '',
hashFlowDisabledMMs:
process.env[`HASHFLOW_DISABLED_MMS_10`]?.split(',') || [],
adapterAddresses: {
OptimismAdapter01: '0x5dcf544b0c9689fa67dcb713fd2656d217e25a59',
OptimismAdapter02: '0xFec367A0ae3294550123333A05410379D8C59Ec5',
OptimismBuyAdapter: '0x40B9CcB57Ed0629C1d7183f1e6F7f351bc9e0F96',
OptimismAdapter02: '0xb569288D1aC6B4914e0a9F556c8B4a9d52149BD6',
OptimismBuyAdapter: '0xC1ad83d2DE4799C9b0175468ba69305f4e22EAbb',
},
uniswapV2ExchangeRouterAddress:
'0xB41dD984730dAf82f5C41489E21ac79D5e3B61bC',
Expand Down Expand Up @@ -400,9 +402,9 @@ const baseConfigs: { [network: number]: BaseConfig } = {
hashFlowDisabledMMs: [],
augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
executorsAddresses: {
Executor01: '0xa600910B670804230E00A100000D28000AE005C0',
Executor02: '0x3800091020a00290f20606b000000000E38c33Ef',
Executor03: '0x20004f017a0bC0050bc004d9C500a7A089800000',
Executor01: '0x000010036C0190E009a000d0fc3541100A07380A',
Executor02: '0x00C600b30fb0400701010F4b080409018B9006E0',
Executor03: '0xe009F00e200A090090fC70e02d70B232000c0802',
},
adapterAddresses: {
BaseAdapter01: '0xe53d24CD81cC81bbf271AD7B02D0d67f851D727c',
Expand Down
2 changes: 2 additions & 0 deletions src/dex/aave-v2/aave-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ export class AaveV2
readonly hasConstantPriceLargeAmounts = true;
readonly isFeeOnTransferSupported = false;

needWrapNative = false;
aburkut marked this conversation as resolved.
Show resolved Hide resolved

public static dexKeysWithNetwork: { key: string; networks: Network[] }[] =
getDexKeysWithNetwork(AaveV2Config);

Expand Down
2 changes: 2 additions & 0 deletions src/dex/aave-v3-stata/aave-v3-stata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export class AaveV3Stata

readonly isFeeOnTransferSupported = false;

needWrapNative = false;

public static dexKeysWithNetwork: { key: string; networks: Network[] }[] =
getDexKeysWithNetwork(AaveV3StataConfig);

Expand Down
2 changes: 2 additions & 0 deletions src/dex/aave-v3/aave-v3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export class AaveV3 extends SimpleExchange implements IDex<Data, Param> {
readonly hasConstantPriceLargeAmounts = true;
readonly isFeeOnTransferSupported = false;

needWrapNative = false;

public static dexKeysWithNetwork: { key: string; networks: Network[] }[] =
getDexKeysWithNetwork(Config);

Expand Down
2 changes: 2 additions & 0 deletions src/dex/bancor/bancor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export class Bancor
static dexKeys = ['bancor'];
exchangeRouterInterface: Interface;

needWrapNative = false;

constructor(dexHelper: IDexHelper) {
super(dexHelper, 'bancor');
this.exchangeRouterInterface = new Interface(BancorABI as JsonFragment[]);
Expand Down
2 changes: 2 additions & 0 deletions src/dex/compound/compound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export class Compound
static dexKeys = ['compound'];
cethInterface: Interface;

needWrapNative = false;

constructor(dexHelper: IDexHelper) {
super(dexHelper, 'compound');
this.cethInterface = new Interface(Ceth as JsonFragment[]);
Expand Down
53 changes: 38 additions & 15 deletions src/dex/curve-v1-factory/curve-v1-factory-e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ export function testForNetwork(
[
ContractMethod.swapExactAmountIn,
ContractMethod.swapExactAmountInOnCurveV1,
// ContractMethod.simpleSwap,
// ContractMethod.directCurveV1Swap,
// ContractMethod.multiSwap,
// ContractMethod.megaSwap,
],
],
]),
Expand Down Expand Up @@ -176,21 +180,40 @@ describe('CurveV1Factory E2E', () => {
describe('Mainnet ng pool', () => {
const network = Network.MAINNET;

describe('ETH -> STETH', () => {
const tokenASymbol: string = 'ETH';
const tokenBSymbol: string = 'STETH';

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

testForNetwork(
network,
dexKey,
tokenASymbol,
tokenBSymbol,
tokenAAmount,
tokenBAmount,
);
describe('Dynamic needWrapNative', () => {
describe('ETH -> STETH', () => {
const tokenASymbol: string = 'ETH';
const tokenBSymbol: string = 'STETH';

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

testForNetwork(
network,
dexKey,
tokenASymbol,
tokenBSymbol,
tokenAAmount,
tokenBAmount,
);
});

describe('WETH -> STETH', () => {
const tokenASymbol: string = 'WETH';
const tokenBSymbol: string = 'STETH';

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

testForNetwork(
network,
dexKey,
tokenASymbol,
tokenBSymbol,
tokenAAmount,
tokenBAmount,
);
});
});

describe('crvUSD -> USDT', () => {
Expand Down
Loading
Loading