@paraswap/dex-lib 3.0.4 → 3.0.6-balancer-direct-fn-fix.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/abi/augustus-v6/ABI.json +188 -284
- package/build/config.js +1 -1
- package/build/dex/balancer-v2/balancer-v2.d.ts +1 -1
- package/build/dex/balancer-v2/balancer-v2.js +26 -14
- package/build/dex/balancer-v2/balancer-v2.js.map +1 -1
- package/build/dex/balancer-v2/types.d.ts +2 -0
- package/package.json +1 -1
- package/src/abi/augustus-v6/ABI.json +188 -284
- package/src/config.ts +1 -1
- package/src/dex/balancer-v2/balancer-v2.ts +23 -20
- package/src/dex/balancer-v2/types.ts +2 -0
package/src/config.ts
CHANGED
|
@@ -46,7 +46,7 @@ const baseConfigs: { [network: number]: BaseConfig } = {
|
|
|
46
46
|
nativeTokenSymbol: 'ETH',
|
|
47
47
|
wrappedNativeTokenAddress: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
48
48
|
hasEIP1559: true,
|
|
49
|
-
augustusAddress: '
|
|
49
|
+
augustusAddress: '0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57',
|
|
50
50
|
augustusV6Address: '0x00000000FdAC7708D0D360BDDc1bc7d097F47439',
|
|
51
51
|
augustusRFQAddress: '0xe92b586627ccA7a83dC919cc7127196d70f55a06',
|
|
52
52
|
tokenTransferProxyAddress: '0x216b4b4ba9f3e719726886d34a177484278bfcae',
|
|
@@ -1006,8 +1006,6 @@ export class BalancerV2
|
|
|
1006
1006
|
const params = this.getBalancerParam(
|
|
1007
1007
|
srcToken,
|
|
1008
1008
|
destToken,
|
|
1009
|
-
srcAmount,
|
|
1010
|
-
destAmount,
|
|
1011
1009
|
data,
|
|
1012
1010
|
side,
|
|
1013
1011
|
this.dexHelper.config.data.augustusAddress!,
|
|
@@ -1072,8 +1070,6 @@ export class BalancerV2
|
|
|
1072
1070
|
public getBalancerParam(
|
|
1073
1071
|
srcToken: string,
|
|
1074
1072
|
destToken: string,
|
|
1075
|
-
srcAmount: string,
|
|
1076
|
-
destAmount: string,
|
|
1077
1073
|
data: OptimizedBalancerV2Data,
|
|
1078
1074
|
side: SwapSide,
|
|
1079
1075
|
recipient: string,
|
|
@@ -1110,17 +1106,30 @@ export class BalancerV2
|
|
|
1110
1106
|
path = path.reverse();
|
|
1111
1107
|
}
|
|
1112
1108
|
|
|
1113
|
-
const _swaps = path.map((hop, index) =>
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
amount
|
|
1109
|
+
const _swaps = path.map((hop, index) => {
|
|
1110
|
+
const assetInIndex = swapOffset + index;
|
|
1111
|
+
const assetOutIndex = swapOffset + index + 1;
|
|
1112
|
+
|
|
1113
|
+
const amount =
|
|
1118
1114
|
(side === SwapSide.SELL && index === 0) ||
|
|
1119
1115
|
(side === SwapSide.BUY && index === path.length - 1)
|
|
1120
1116
|
? swapData.amount
|
|
1121
|
-
: '0'
|
|
1122
|
-
|
|
1123
|
-
|
|
1117
|
+
: '0';
|
|
1118
|
+
|
|
1119
|
+
if (assetInIndex < 0 || assetOutIndex < 0) {
|
|
1120
|
+
const error = new Error(`Invalid indices in balancer`);
|
|
1121
|
+
this.logger.error(error.message, error);
|
|
1122
|
+
throw error;
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
return {
|
|
1126
|
+
poolId: hop.pool.id,
|
|
1127
|
+
assetInIndex,
|
|
1128
|
+
assetOutIndex,
|
|
1129
|
+
amount,
|
|
1130
|
+
userData: '0x',
|
|
1131
|
+
};
|
|
1132
|
+
});
|
|
1124
1133
|
|
|
1125
1134
|
swapOffset += path.length + 1;
|
|
1126
1135
|
|
|
@@ -1245,8 +1254,6 @@ export class BalancerV2
|
|
|
1245
1254
|
const [, swaps, assets, funds, limits, _deadline] = this.getBalancerParam(
|
|
1246
1255
|
srcToken,
|
|
1247
1256
|
destToken,
|
|
1248
|
-
srcAmount,
|
|
1249
|
-
destAmount,
|
|
1250
1257
|
data,
|
|
1251
1258
|
side,
|
|
1252
1259
|
this.dexHelper.config.data.augustusAddress!,
|
|
@@ -1316,8 +1323,6 @@ export class BalancerV2
|
|
|
1316
1323
|
const balancerParams = this.getBalancerParam(
|
|
1317
1324
|
srcToken,
|
|
1318
1325
|
destToken,
|
|
1319
|
-
fromAmount,
|
|
1320
|
-
toAmount,
|
|
1321
1326
|
data,
|
|
1322
1327
|
side,
|
|
1323
1328
|
this.dexHelper.config.data.augustusV6Address!,
|
|
@@ -1325,6 +1330,8 @@ export class BalancerV2
|
|
|
1325
1330
|
);
|
|
1326
1331
|
|
|
1327
1332
|
const swapParams: BalancerV2DirectParamV6 = [
|
|
1333
|
+
fromAmount,
|
|
1334
|
+
toAmount,
|
|
1328
1335
|
quotedAmount,
|
|
1329
1336
|
metadata,
|
|
1330
1337
|
this.encodeBeneficiaryAndApproveFlag(beneficiary, !data.isApproved),
|
|
@@ -1388,8 +1395,6 @@ export class BalancerV2
|
|
|
1388
1395
|
const params = this.getBalancerParam(
|
|
1389
1396
|
srcToken,
|
|
1390
1397
|
destToken,
|
|
1391
|
-
srcAmount,
|
|
1392
|
-
destAmount,
|
|
1393
1398
|
data,
|
|
1394
1399
|
side,
|
|
1395
1400
|
this.dexHelper.config.data.augustusAddress!,
|
|
@@ -1424,8 +1429,6 @@ export class BalancerV2
|
|
|
1424
1429
|
const params = this.getBalancerParam(
|
|
1425
1430
|
srcToken,
|
|
1426
1431
|
destToken,
|
|
1427
|
-
srcAmount,
|
|
1428
|
-
destAmount,
|
|
1429
1432
|
data,
|
|
1430
1433
|
side,
|
|
1431
1434
|
recipient,
|
|
@@ -138,6 +138,8 @@ export type BalancerV2DirectParam = [
|
|
|
138
138
|
];
|
|
139
139
|
|
|
140
140
|
export type BalancerV2DirectParamV6 = [
|
|
141
|
+
fromAmount: NumberAsString,
|
|
142
|
+
toAmount: NumberAsString,
|
|
141
143
|
quotedAmount: NumberAsString,
|
|
142
144
|
metadata: string,
|
|
143
145
|
beneficiaryAndApproveFlag: NumberAsString,
|