/
aerodrome-provider.ts
39 lines (35 loc) · 2.17 KB
/
aerodrome-provider.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import BigNumber from 'bignumber.js';
import { PriceToken } from 'src/common/tokens';
import { BLOCKCHAIN_NAME, EvmBlockchainName } from 'src/core/blockchain/models/blockchain-name';
import { OnChainProxyFeeInfo } from 'src/features/on-chain/calculation-manager/providers/common/models/on-chain-proxy-fee-info';
import { Exact } from 'src/features/on-chain/calculation-manager/providers/common/on-chain-trade/evm-on-chain-trade/models/exact';
import { AerodromePathFactory } from 'src/features/on-chain/calculation-manager/providers/dexes/base/aerodrome/aerodrome-path-factory';
import { AerodromeTrade } from 'src/features/on-chain/calculation-manager/providers/dexes/base/aerodrome/aerodrome-trade';
import { AERODROME_PROVIDER_CONFIGURATION } from 'src/features/on-chain/calculation-manager/providers/dexes/base/aerodrome/constants';
import { UniswapCalculatedInfo } from 'src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v2-abstract/models/uniswap-calculated-info';
import { UniswapV2CalculationOptions } from 'src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v2-abstract/models/uniswap-v2-calculation-options';
import { UniswapV2AbstractProvider } from 'src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v2-abstract/uniswap-v2-abstract-provider';
export class AerodromeProvider extends UniswapV2AbstractProvider<AerodromeTrade> {
public readonly blockchain = BLOCKCHAIN_NAME.BASE;
public readonly UniswapV2TradeClass = AerodromeTrade;
public readonly providerSettings = AERODROME_PROVIDER_CONFIGURATION;
protected async getAmountAndPath(
from: PriceToken<EvmBlockchainName>,
to: PriceToken<EvmBlockchainName>,
weiAmount: BigNumber,
exact: Exact,
options: UniswapV2CalculationOptions,
proxyFeeInfo: OnChainProxyFeeInfo | undefined,
gasPriceInUsd: BigNumber | undefined
): Promise<UniswapCalculatedInfo> {
const pathFactory = new AerodromePathFactory(this, {
from,
to,
weiAmount,
exact,
options,
proxyFeeInfo
});
return pathFactory.getAmountAndPath(gasPriceInUsd);
}
}