Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into aburkut/back-1745-f…
Browse files Browse the repository at this point in the history
…luid
  • Loading branch information
KanievskyiDanylo committed Oct 30, 2024
2 parents 631cd72 + 94bd80a commit 7fb5d4f
Show file tree
Hide file tree
Showing 33 changed files with 830 additions and 268 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@paraswap/dex-lib",
"version": "3.9.7-fluid-dex.3",
"version": "3.10.0",
"main": "build/index.js",
"types": "build/index.d.ts",
"repository": "https://github.com/paraswap/paraswap-dex-lib",
Expand Down
30 changes: 29 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@ const baseConfigs: { [network: number]: BaseConfig } = {
PolygonZkEvmAdapter01: '0xd63B7691dD98fa89A2ea5e1604700489c585aa7B',
PolygonZkEvmBuyAdapter: '0xe2137168CdA486a2555E16c597905854C84F9127',
},

rpcPollingMaxAllowedStateDelayInBlocks: 0,
rpcPollingBlocksBackToTriggerUpdate: 0,
hashFlowAuthToken: process.env.API_KEY_HASHFLOW_AUTH_TOKEN || '',
Expand All @@ -387,6 +386,35 @@ const baseConfigs: { [network: number]: BaseConfig } = {
// FIXME: Not set properly
uniswapV2ExchangeRouterAddress: '',
},
[Network.GNOSIS]: {
network: Network.GNOSIS,
networkName: 'Gnosis',
isTestnet: false,
nativeTokenName: 'xDAI',
nativeTokenSymbol: 'XDAI',
wrappedNativeTokenAddress: '0xe91d153e0b41518a2ce8dd3d7944fa863463a97d',
hasEIP1559: false,
augustusAddress: '0x0000000000000000000000000000000000000000',
tokenTransferProxyAddress: '0x0000000000000000000000000000000000000000',
multicallV2Address: '0xca11bde05977b3631167028862be2a173976ca11',
privateHttpProvider: process.env.HTTP_PROVIDER_100,
adapterAddresses: {},
augustusRFQAddress: '0x92EaD5bACf6F0E995FA46Ad8215A9b11f67ca241',
augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
executorsAddresses: {
Executor01: '0x000010036c0190e009a000d0fc3541100a07380a',
Executor02: '0x00c600b30fb0400701010f4b080409018b9006e0',
Executor03: '0xe009f00e200a090090fc70e02d70b232000c0802',
},
rpcPollingMaxAllowedStateDelayInBlocks: 0,
rpcPollingBlocksBackToTriggerUpdate: 0,
hashFlowDisabledMMs: [],
uniswapV3EventLoggingSampleRate: 0,
rfqConfigs: {},
forceRpcFallbackDexs: [],
uniswapV2ExchangeRouterAddress:
'0xfa39c1c670b48956eeF9fd0BbD0E81A290326330',
},
[Network.BASE]: {
network: Network.BASE,
networkName: 'Base',
Expand Down
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export enum Network {
ARBITRUM = 42161,
OPTIMISM = 10,
BASE = 8453,
GNOSIS = 100,
}
export const SUBGRAPH_TIMEOUT = 20 * 1000;

Expand Down
8 changes: 4 additions & 4 deletions src/dex/aave-v3-stata/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
AaveV3BNB,
AaveV3Base,
AaveV3Ethereum,
// AaveV3Gnosis,
AaveV3Gnosis,
// AaveV3Metis,
AaveV3Optimism,
AaveV3Polygon,
Expand Down Expand Up @@ -37,9 +37,9 @@ export const AaveV3StataConfig: DexConfigMap<DexParams> = {
[Network.BSC]: {
factoryAddress: AaveV3BNB.STATIC_A_TOKEN_FACTORY,
},
// [Network.Gnosis]: {
// factoryAddress: AaveV3Gnosis.STATIC_A_TOKEN_FACTORY,
// },
[Network.GNOSIS]: {
factoryAddress: AaveV3Gnosis.STATIC_A_TOKEN_FACTORY,
},
// [Network.Scroll]: {
// factoryAddress: AaveV3Scroll.STATIC_A_TOKEN_FACTORY,
// },
Expand Down
69 changes: 69 additions & 0 deletions src/dex/aave-v3/aave-v3-e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -506,4 +506,73 @@ describe('AaveV3 E2E', () => {
);
});
});

describe('AaveV3 GNOSIS', () => {
const network = Network.GNOSIS;
const tokens = Tokens[network];
const holders = Holders[network];
const provider = new StaticJsonRpcProvider(
generateConfig(network).privateHttpProvider,
network,
);

const pairs = [
{
tokenSymbol: 'XDAI',
aTokenSymbol: 'aGnoWXDAI',
amount: '1000000000000000000',
},
{
tokenSymbol: 'USDC',
aTokenSymbol: 'aGnoUSDC',
amount: '10000000',
},
{
tokenSymbol: 'wstETH',
aTokenSymbol: 'aGnowstETH',
amount: '1000000000000000000',
},
];

const sideToContractMethods = new Map([
[SwapSide.SELL, [ContractMethod.swapExactAmountIn]],
[SwapSide.BUY, [ContractMethod.swapExactAmountOut]],
]);

pairs.forEach(pair => {
sideToContractMethods.forEach((contractMethods, side) =>
contractMethods.forEach((contractMethod: ContractMethod) => {
describe(`${contractMethod}`, () => {
it(pair.aTokenSymbol + ' -> ' + pair.tokenSymbol, async () => {
await testE2E(
tokens[pair.aTokenSymbol],
tokens[pair.tokenSymbol],
holders[pair.aTokenSymbol],
pair.amount,
side,
dexKey,
contractMethod,
network,
provider,
);
});

it(pair.tokenSymbol + ' -> ' + pair.aTokenSymbol, async () => {
await testE2E(
tokens[pair.tokenSymbol],
tokens[pair.aTokenSymbol],
holders[pair.tokenSymbol],
pair.amount,
side,
dexKey,
contractMethod,
network,
provider,
);
});
});
}),
);
});
});
});
2 changes: 1 addition & 1 deletion src/dex/aave-v3/aave-v3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class AaveV3 extends SimpleExchange implements IDex<Data, Param> {
}

getAdapters(side: SwapSide): { name: string; index: number }[] | null {
return this.adapters[side];
return this.adapters?.[side] ?? null;
}

async initializePricing(blockNumber: number): Promise<void> {
Expand Down
7 changes: 7 additions & 0 deletions src/dex/aave-v3/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
AaveV3Optimism,
AaveV3Polygon,
AaveV3PolygonZkEvm,
AaveV3Gnosis,
} from '@bgd-labs/aave-address-book';

// TODO: find vals for V3
Expand Down Expand Up @@ -70,6 +71,12 @@ export const Config: DexConfigMap<DexParam> = {
poolAddress: AaveV3PolygonZkEvm.POOL,
wethGatewayAddress: AaveV3PolygonZkEvm.WETH_GATEWAY,
},
[Network.GNOSIS]: {
ethGasCost: 246 * 100,
lendingGasCost: 328 * 1000,
poolAddress: AaveV3Gnosis.POOL,
wethGatewayAddress: AaveV3Gnosis.WETH_GATEWAY,
},
},
};

Expand Down
22 changes: 22 additions & 0 deletions src/dex/algebra/algebra-e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,4 +288,26 @@ describe('Algebra', () => {
nativeTokenAmount,
);
});

describe('SwaprV3', () => {
const dexKey = 'SwaprV3';
const network = Network.GNOSIS;

const tokenASymbol: string = 'WXDAI';
const tokenBSymbol: string = 'USDC';

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

testForNetwork(
network,
dexKey,
tokenASymbol,
tokenBSymbol,
tokenAAmount,
tokenBAmount,
nativeTokenAmount,
);
});
});
2 changes: 1 addition & 1 deletion src/dex/algebra/algebra-pool-v1_9_bidirectional_fee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class AlgebraEventPoolV1_9_bidirectional_fee extends AlgebraEventPoolV1_1
mapKey,
poolInitCodeHash,
poolDeployer,
false, // forceManualStateGeneration; mainly for zkEVM
true, // forceManualStateGeneration; mainly used for xLayer
false, // areTicksCompressed
);

Expand Down
21 changes: 21 additions & 0 deletions src/dex/algebra/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ export const AlgebraConfig: DexConfigMap<DexParams> = {
subgraphURL: '3CA9ffebLkS3N2otXaSj8XaDDdspty75upBjKTUS79qY',
uniswapMulticall: '0x1F98415757620B543A52E61c46B32eB19261F984',
deployer: '0xc0d4323426c709e8d04b5b130e7f059523464a91',
// optimism fork uses v1.9-bidirectional-fee (with TickSpacing event and simple `fee` in globalState),
// not sure why v1.1 is used here
version: 'v1.1',
},
},
Expand All @@ -79,6 +81,25 @@ export const AlgebraConfig: DexConfigMap<DexParams> = {
uniswapMulticall: '0x1F98415757620B543A52E61c46B32eB19261F984',
deployer: '0x6dd3fb9653b10e806650f107c3b5a0a6ff974f65',
version: 'v1.9',
// looks like it isn't used as we override it with dexHelper.config.data.forceRpcFallbackDexs in constructor
forceRPC: true,
},
},
SwaprV3: {
[Network.GNOSIS]: {
factory: '0xA0864cCA6E114013AB0e27cbd5B6f4c8947da766',
router: '0xfFB643E73f280B97809A8b41f7232AB401a04ee1',
quoter: '0xcBaD9FDf0D2814659Eb26f600EFDeAF005Eda0F7',
initHash:
'0xbce37a54eab2fcd71913a0d40723e04238970e7fc1159bfd58ad5b79531697e7',
chunksCount: 10,
initRetryFrequency: 10,
// AlgebraStateMulticall
algebraStateMulticall: '0x49C46f7f88110ccA234ef27Cd664510f7bbF5998',
subgraphURL: 'AAA1vYjxwFHzbt6qKwLHNcDSASyr1J1xVViDH8gTMFMR',
uniswapMulticall: '0x4dfa9a980efE4802E969AC33968E3d6E59B8a19e',
deployer: '0xC1b576AC6Ec749d5Ace1787bF9Ec6340908ddB47',
version: 'v1.9-bidirectional-fee',
forceRPC: true,
},
},
Expand Down
Loading

0 comments on commit 7fb5d4f

Please sign in to comment.