-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
109 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/features/on-chain/calculation-manager/providers/dexes/bahamut/default-constants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { wrappedNativeTokensList } from 'src/common/tokens/constants/wrapped-native-tokens'; | ||
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name'; | ||
|
||
import { UniswapV2ProviderConfiguration } from '../common/uniswap-v2-abstract/models/uniswap-v2-provider-configuration'; | ||
|
||
export const defaultBahamutRoutingProvidersAddresses = [ | ||
wrappedNativeTokensList[BLOCKCHAIN_NAME.BAHAMUT]!.address, //WFTN | ||
'0xDeF886C55a79830C47108eeb9c37e78a49684e41', //USDT | ||
'0x4237e0a5b55233d5b6d6d1d9bf421723954130d8', //USDC | ||
'0xE5b3562A0fa9eC3e718C96FfE349e1280D2Be591' //WETH | ||
]; | ||
|
||
const defaultBahamutWethAddress = wrappedNativeTokensList[BLOCKCHAIN_NAME.BAHAMUT]!.address; | ||
|
||
export const defaultBahamutProviderConfiguration: UniswapV2ProviderConfiguration = { | ||
maxTransitTokens: 1, | ||
routingProvidersAddresses: defaultBahamutRoutingProvidersAddresses, | ||
wethAddress: defaultBahamutWethAddress | ||
}; |
5 changes: 5 additions & 0 deletions
5
...ures/on-chain/calculation-manager/providers/dexes/bahamut/uniswap-v2-bahamut/constants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { defaultBahamutProviderConfiguration } from '../default-constants'; | ||
|
||
export const UNISWAP_V2_BAHAMUT_CONTRACT_ADDRESS = '0xF660558a4757Fb5953d269FF32E228Ae3d5f6c68'; | ||
|
||
export const UNISWAP_V2_BAHAMUT_PROVIDER_CONFIGURATION = defaultBahamutProviderConfiguration; |
21 changes: 21 additions & 0 deletions
21
...ulation-manager/providers/dexes/bahamut/uniswap-v2-bahamut/uniswap-v2-bahamut-provider.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name'; | ||
|
||
import { evmProviderDefaultOptions } from '../../common/on-chain-provider/evm-on-chain-provider/constants/evm-provider-default-options'; | ||
import { UniswapV2CalculationOptions } from '../../common/uniswap-v2-abstract/models/uniswap-v2-calculation-options'; | ||
import { UniswapV2AbstractProvider } from '../../common/uniswap-v2-abstract/uniswap-v2-abstract-provider'; | ||
import { UNISWAP_V2_BAHAMUT_PROVIDER_CONFIGURATION } from './constants'; | ||
import { UniswapV2BahamutTrade } from './uniswap-v2-bahamut-trade'; | ||
|
||
export class UniswapV2BahamutProvider extends UniswapV2AbstractProvider<UniswapV2BahamutTrade> { | ||
public readonly blockchain = BLOCKCHAIN_NAME.BAHAMUT; | ||
|
||
protected readonly defaultOptions: UniswapV2CalculationOptions = { | ||
...evmProviderDefaultOptions, | ||
deadlineMinutes: 60, | ||
disableMultihops: false | ||
}; | ||
|
||
public readonly UniswapV2TradeClass = UniswapV2BahamutTrade; | ||
|
||
public readonly providerSettings = UNISWAP_V2_BAHAMUT_PROVIDER_CONFIGURATION; | ||
} |
26 changes: 26 additions & 0 deletions
26
...alculation-manager/providers/dexes/bahamut/uniswap-v2-bahamut/uniswap-v2-bahamut-trade.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { EvmEncodeConfig } from 'src/core/blockchain/web3-pure/typed-web3-pure/evm-web3-pure/models/evm-encode-config'; | ||
import { EncodeTransactionOptions } from 'src/features/common/models/encode-transaction-options'; | ||
import { checkUnsupportedReceiverAddress } from 'src/features/common/utils/check-unsupported-receiver-address'; | ||
|
||
import { ON_CHAIN_TRADE_TYPE, OnChainTradeType } from '../../../common/models/on-chain-trade-type'; | ||
import { UniswapV2AbstractTrade } from '../../common/uniswap-v2-abstract/uniswap-v2-abstract-trade'; | ||
import { UNISWAP_V2_BAHAMUT_CONTRACT_ADDRESS } from './constants'; | ||
|
||
export class UniswapV2BahamutTrade extends UniswapV2AbstractTrade { | ||
public static get type(): OnChainTradeType { | ||
return ON_CHAIN_TRADE_TYPE.UNISWAP_BAHAMUT; | ||
} | ||
|
||
public readonly dexContractAddress = UNISWAP_V2_BAHAMUT_CONTRACT_ADDRESS; | ||
|
||
public async encode(options: EncodeTransactionOptions): Promise<EvmEncodeConfig> { | ||
await checkUnsupportedReceiverAddress(options.receiverAddress, this.walletAddress); | ||
await this.checkFromAddress(options.fromAddress, true); | ||
await this.checkReceiverAddress(options.receiverAddress); | ||
|
||
if (this.useProxy) { | ||
return this.encodeProxy(options); | ||
} | ||
return this.encodeDirect(options); | ||
} | ||
} |