@paraswap/dex-lib 2.36.3-dexalot.4 → 2.36.3-retro
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/config.js +0 -2
- package/build/config.js.map +1 -1
- package/build/dex/dexalot/dexalot.d.ts +2 -2
- package/build/dex/dexalot/dexalot.js +5 -1
- package/build/dex/dexalot/dexalot.js.map +1 -1
- package/build/dex/index.js +0 -2
- package/build/dex/index.js.map +1 -1
- package/build/dex/uniswap-v3/config.js +14 -0
- package/build/dex/uniswap-v3/config.js.map +1 -1
- package/build/dex/uniswap-v3/uniswap-v3.js +1 -0
- package/build/dex/uniswap-v3/uniswap-v3.js.map +1 -1
- package/build/types.d.ts +0 -1
- package/package.json +1 -1
- package/src/config.ts +0 -3
- package/src/dex/index.ts +0 -2
- package/src/dex/uniswap-v3/config.ts +15 -0
- package/src/dex/uniswap-v3/uniswap-v3-e2e.test.ts +25 -0
- package/src/dex/uniswap-v3/uniswap-v3-integration.test.ts +144 -0
- package/src/dex/uniswap-v3/uniswap-v3.ts +1 -0
- package/src/types.ts +0 -1
- package/tests/constants-e2e.ts +1 -1
- package/src/abi/dexalot/DexalotMainnetRFQ.json +0 -887
- package/src/dex/dexalot/config.ts +0 -18
- package/src/dex/dexalot/constants.ts +0 -29
- package/src/dex/dexalot/dexalot-e2e.test.ts +0 -192
- package/src/dex/dexalot/dexalot-integration.test.ts +0 -188
- package/src/dex/dexalot/dexalot.ts +0 -997
- package/src/dex/dexalot/rate-fetcher.ts +0 -197
- package/src/dex/dexalot/types.ts +0 -131
- package/src/dex/dexalot/validators.ts +0 -46
|
@@ -1100,3 +1100,147 @@ describe('SushiSwapV3', () => {
|
|
|
1100
1100
|
});
|
|
1101
1101
|
});
|
|
1102
1102
|
});
|
|
1103
|
+
|
|
1104
|
+
|
|
1105
|
+
describe('Retro', () => {
|
|
1106
|
+
const dexKey = 'Retro';
|
|
1107
|
+
|
|
1108
|
+
describe('Polygon', () => {
|
|
1109
|
+
let blockNumber: number;
|
|
1110
|
+
let retro: UniswapV3;
|
|
1111
|
+
|
|
1112
|
+
const network = Network.POLYGON;
|
|
1113
|
+
const dexHelper = new DummyDexHelper(network);
|
|
1114
|
+
const TokenASymbol = 'USDC';
|
|
1115
|
+
const TokenA = Tokens[network][TokenASymbol];
|
|
1116
|
+
|
|
1117
|
+
const TokenBSymbol = 'USDT';
|
|
1118
|
+
const TokenB = Tokens[network][TokenBSymbol];
|
|
1119
|
+
|
|
1120
|
+
beforeEach(async () => {
|
|
1121
|
+
blockNumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
1122
|
+
retro = new UniswapV3(network, dexKey, dexHelper);
|
|
1123
|
+
});
|
|
1124
|
+
|
|
1125
|
+
it('getPoolIdentifiers and getPricesVolume SELL', async function () {
|
|
1126
|
+
const amounts = [0n, BI_POWS[6], 2000000n];
|
|
1127
|
+
|
|
1128
|
+
const pools = await retro.getPoolIdentifiers(
|
|
1129
|
+
TokenA,
|
|
1130
|
+
TokenB,
|
|
1131
|
+
SwapSide.SELL,
|
|
1132
|
+
blockNumber,
|
|
1133
|
+
);
|
|
1134
|
+
console.log(
|
|
1135
|
+
`${TokenASymbol} <> ${TokenBSymbol} Pool Identifiers: `,
|
|
1136
|
+
pools,
|
|
1137
|
+
);
|
|
1138
|
+
|
|
1139
|
+
expect(pools.length).toBeGreaterThan(0);
|
|
1140
|
+
|
|
1141
|
+
const poolPrices = await retro.getPricesVolume(
|
|
1142
|
+
TokenA,
|
|
1143
|
+
TokenB,
|
|
1144
|
+
amounts,
|
|
1145
|
+
SwapSide.SELL,
|
|
1146
|
+
blockNumber,
|
|
1147
|
+
pools,
|
|
1148
|
+
);
|
|
1149
|
+
console.log(
|
|
1150
|
+
`${TokenASymbol} <> ${TokenBSymbol} Pool Prices: `,
|
|
1151
|
+
poolPrices,
|
|
1152
|
+
);
|
|
1153
|
+
|
|
1154
|
+
expect(poolPrices).not.toBeNull();
|
|
1155
|
+
checkPoolPrices(poolPrices!, amounts, SwapSide.SELL, dexKey);
|
|
1156
|
+
|
|
1157
|
+
let falseChecksCounter = 0;
|
|
1158
|
+
await Promise.all(
|
|
1159
|
+
poolPrices!.map(async price => {
|
|
1160
|
+
const fee = retro.eventPools[price.poolIdentifier!]!.feeCode;
|
|
1161
|
+
const res = await checkOnChainPricing(
|
|
1162
|
+
dexHelper,
|
|
1163
|
+
retro,
|
|
1164
|
+
'quoteExactInputSingle',
|
|
1165
|
+
blockNumber,
|
|
1166
|
+
'0xfe08be075758935cb6cb9318d1fbb60920416d4e',
|
|
1167
|
+
price.prices,
|
|
1168
|
+
TokenA.address,
|
|
1169
|
+
TokenB.address,
|
|
1170
|
+
fee,
|
|
1171
|
+
amounts,
|
|
1172
|
+
);
|
|
1173
|
+
if (res === false) falseChecksCounter++;
|
|
1174
|
+
}),
|
|
1175
|
+
);
|
|
1176
|
+
|
|
1177
|
+
expect(falseChecksCounter).toBeLessThan(poolPrices!.length);
|
|
1178
|
+
});
|
|
1179
|
+
|
|
1180
|
+
it('getPoolIdentifiers and getPricesVolume BUY', async function () {
|
|
1181
|
+
const amounts = [0n, BI_POWS[6], 2000000n];
|
|
1182
|
+
|
|
1183
|
+
const pools = await retro.getPoolIdentifiers(
|
|
1184
|
+
TokenA,
|
|
1185
|
+
TokenB,
|
|
1186
|
+
SwapSide.BUY,
|
|
1187
|
+
blockNumber,
|
|
1188
|
+
);
|
|
1189
|
+
console.log(
|
|
1190
|
+
`${TokenASymbol} <> ${TokenBSymbol} Pool Identifiers: `,
|
|
1191
|
+
pools,
|
|
1192
|
+
);
|
|
1193
|
+
|
|
1194
|
+
expect(pools.length).toBeGreaterThan(0);
|
|
1195
|
+
|
|
1196
|
+
const poolPrices = await retro.getPricesVolume(
|
|
1197
|
+
TokenA,
|
|
1198
|
+
TokenB,
|
|
1199
|
+
amounts,
|
|
1200
|
+
SwapSide.BUY,
|
|
1201
|
+
blockNumber,
|
|
1202
|
+
pools,
|
|
1203
|
+
);
|
|
1204
|
+
console.log(
|
|
1205
|
+
`${TokenASymbol} <> ${TokenBSymbol} Pool Prices: `,
|
|
1206
|
+
poolPrices,
|
|
1207
|
+
);
|
|
1208
|
+
|
|
1209
|
+
expect(poolPrices).not.toBeNull();
|
|
1210
|
+
checkPoolPrices(poolPrices!, amounts, SwapSide.SELL, dexKey);
|
|
1211
|
+
|
|
1212
|
+
let falseChecksCounter = 0;
|
|
1213
|
+
await Promise.all(
|
|
1214
|
+
poolPrices!.map(async price => {
|
|
1215
|
+
const fee = retro.eventPools[price.poolIdentifier!]!.feeCode;
|
|
1216
|
+
const res = await checkOnChainPricing(
|
|
1217
|
+
dexHelper,
|
|
1218
|
+
retro,
|
|
1219
|
+
'quoteExactOutputSingle',
|
|
1220
|
+
blockNumber,
|
|
1221
|
+
'0xfe08be075758935cb6cb9318d1fbb60920416d4e',
|
|
1222
|
+
price.prices,
|
|
1223
|
+
TokenA.address,
|
|
1224
|
+
TokenB.address,
|
|
1225
|
+
fee,
|
|
1226
|
+
amounts,
|
|
1227
|
+
);
|
|
1228
|
+
if (res === false) falseChecksCounter++;
|
|
1229
|
+
}),
|
|
1230
|
+
);
|
|
1231
|
+
|
|
1232
|
+
expect(falseChecksCounter).toBeLessThan(poolPrices!.length);
|
|
1233
|
+
});
|
|
1234
|
+
|
|
1235
|
+
it('getTopPoolsForToken', async function () {
|
|
1236
|
+
const poolLiquidity = await retro.getTopPoolsForToken(
|
|
1237
|
+
TokenB.address,
|
|
1238
|
+
10,
|
|
1239
|
+
);
|
|
1240
|
+
console.log(`${TokenASymbol} Top Pools:`, poolLiquidity);
|
|
1241
|
+
|
|
1242
|
+
checkPoolsLiquidity(poolLiquidity, TokenB.address, dexKey);
|
|
1243
|
+
});
|
|
1244
|
+
});
|
|
1245
|
+
|
|
1246
|
+
});
|
package/src/types.ts
CHANGED
package/tests/constants-e2e.ts
CHANGED
|
@@ -1081,7 +1081,7 @@ export const Holders: {
|
|
|
1081
1081
|
TSD: '0x691A89db352B72dDb249bFe16503494eC0D920A4',
|
|
1082
1082
|
THO: '0xc40d16c47394a506d451475c8a7c46c1175c1da1',
|
|
1083
1083
|
aAvaUSDT: '0x50B1Ba98Cf117c9682048D56628B294ebbAA4ec2',
|
|
1084
|
-
USDT: '
|
|
1084
|
+
USDT: '0x4aeFa39caEAdD662aE31ab0CE7c8C2c9c0a013E8',
|
|
1085
1085
|
aAvaWAVAX: '0x1B18Df70863636AEe4BfBAb6F7C70ceBCA9bA404',
|
|
1086
1086
|
oldFRAX: '0x4e3376018add04ebe4c46bf6f924ddec8c67aa7b',
|
|
1087
1087
|
newFRAX: '0x4e3376018add04ebe4c46bf6f924ddec8c67aa7b',
|