diff --git a/package.json b/package.json index 28c253f8413..902f9ff1d30 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rubic-sdk", - "version": "5.35.0", + "version": "5.36.0", "description": "Simplify dApp creation", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/src/common/tokens/constants/native-tokens.ts b/src/common/tokens/constants/native-tokens.ts index 7835f32944f..88a34a70f74 100644 --- a/src/common/tokens/constants/native-tokens.ts +++ b/src/common/tokens/constants/native-tokens.ts @@ -495,5 +495,12 @@ export const nativeTokensList: Record = { name: 'Bitcoin', symbol: 'BTC', decimals: 18 + }), + [BLOCKCHAIN_NAME.GRAVITY]: new Token({ + blockchain: BLOCKCHAIN_NAME.GRAVITY, + address: EvmWeb3Pure.nativeTokenAddress, + name: 'Gravity', + symbol: 'G', + decimals: 18 }) }; diff --git a/src/common/tokens/constants/wrapped-addresses.ts b/src/common/tokens/constants/wrapped-addresses.ts index 5270ec1e933..45c959852ce 100644 --- a/src/common/tokens/constants/wrapped-addresses.ts +++ b/src/common/tokens/constants/wrapped-addresses.ts @@ -52,6 +52,7 @@ export const wrappedAddress: Partial> = { [BLOCKCHAIN_NAME.SEI]: '0xE30feDd158A2e3b13e9badaeABaFc5516e95e8C7', [BLOCKCHAIN_NAME.CORE]: '0x191e94fa59739e188dce837f7f6978d84727ad01', [BLOCKCHAIN_NAME.BAHAMUT]: '0x4084ab20f8ffca76c19aaf854fb5fe9de6217fbb', + [BLOCKCHAIN_NAME.GRAVITY]: '0xBB859E225ac8Fb6BE1C7e38D87b767e95Fef0EbD', // Testnet [BLOCKCHAIN_NAME.GOERLI]: '0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6', [BLOCKCHAIN_NAME.SCROLL_SEPOLIA]: '0x5300000000000000000000000000000000000004', diff --git a/src/common/tokens/constants/wrapped-native-tokens.ts b/src/common/tokens/constants/wrapped-native-tokens.ts index d654c8f5b33..4729021d74f 100644 --- a/src/common/tokens/constants/wrapped-native-tokens.ts +++ b/src/common/tokens/constants/wrapped-native-tokens.ts @@ -471,5 +471,12 @@ export const wrappedNativeTokensList: Partial> name: 'Wrapped BTC', symbol: 'WBTC', decimals: 18 + }), + [BLOCKCHAIN_NAME.GRAVITY]: new Token({ + blockchain: BLOCKCHAIN_NAME.GRAVITY, + address: '0xBB859E225ac8Fb6BE1C7e38D87b767e95Fef0EbD', + name: 'Wrapped Gravity', + symbol: 'WG', + decimals: 18 }) }; diff --git a/src/core/blockchain/models/backend-blockchains.ts b/src/core/blockchain/models/backend-blockchains.ts index 96269b8a9a3..f387f1eac16 100644 --- a/src/core/blockchain/models/backend-blockchains.ts +++ b/src/core/blockchain/models/backend-blockchains.ts @@ -144,7 +144,8 @@ const BLOCKCHAINS_MAPPING = { [BLOCKCHAIN_NAME.SEI]: 'sei', [BLOCKCHAIN_NAME.CORE]: 'core', [BLOCKCHAIN_NAME.BAHAMUT]: 'bahamut', - [BLOCKCHAIN_NAME.BITLAYER]: 'bitlayer' + [BLOCKCHAIN_NAME.BITLAYER]: 'bitlayer', + [BLOCKCHAIN_NAME.GRAVITY]: 'gravity' } as const; export const TO_BACKEND_BLOCKCHAINS: Record = { diff --git a/src/core/blockchain/models/blockchain-name.ts b/src/core/blockchain/models/blockchain-name.ts index 9f0ef8912fe..f6660ae822c 100644 --- a/src/core/blockchain/models/blockchain-name.ts +++ b/src/core/blockchain/models/blockchain-name.ts @@ -70,7 +70,8 @@ export const EVM_BLOCKCHAIN_NAME = { SEI: 'SEI', CORE: 'CORE', BAHAMUT: 'BAHAMUT', - BITLAYER: 'BITLAYER' + BITLAYER: 'BITLAYER', + GRAVITY: 'GRAVITY' } as const; export const BLOCKCHAIN_NAME = { diff --git a/src/core/blockchain/utils/blockchains-info/constants/blockchain-id.ts b/src/core/blockchain/utils/blockchains-info/constants/blockchain-id.ts index d1c31b38934..b36407c5fd4 100644 --- a/src/core/blockchain/utils/blockchains-info/constants/blockchain-id.ts +++ b/src/core/blockchain/utils/blockchains-info/constants/blockchain-id.ts @@ -69,6 +69,7 @@ export const blockchainId: Record = { [BLOCKCHAIN_NAME.CORE]: 1116, [BLOCKCHAIN_NAME.BAHAMUT]: 5165, [BLOCKCHAIN_NAME.BITLAYER]: 200901, + [BLOCKCHAIN_NAME.GRAVITY]: 1625, // Tesnents [BLOCKCHAIN_NAME.GOERLI]: 5, [BLOCKCHAIN_NAME.BINANCE_SMART_CHAIN_TESTNET]: 87, diff --git a/src/core/blockchain/web3-public-service/web3-public/constants/multicall-addresses.ts b/src/core/blockchain/web3-public-service/web3-public/constants/multicall-addresses.ts index c11581880a6..59aad1efea8 100644 --- a/src/core/blockchain/web3-public-service/web3-public/constants/multicall-addresses.ts +++ b/src/core/blockchain/web3-public-service/web3-public/constants/multicall-addresses.ts @@ -67,5 +67,6 @@ export const MULTICALL_ADDRESSES: Record [BLOCKCHAIN_NAME.SEI]: '0xcA11bde05977b3631167028862bE2a173976CA11', [BLOCKCHAIN_NAME.CORE]: '0xcA11bde05977b3631167028862bE2a173976CA11', [BLOCKCHAIN_NAME.BAHAMUT]: '0xa385B1436fD2A6a1c6865E22c522A1aA40CaDCC6', - [BLOCKCHAIN_NAME.BITLAYER]: '0x5B256fE9e993902eCe49D138a5b1162cBb529474' + [BLOCKCHAIN_NAME.BITLAYER]: '0x5B256fE9e993902eCe49D138a5b1162cBb529474', + [BLOCKCHAIN_NAME.GRAVITY]: '0xcA11bde05977b3631167028862bE2a173976CA11' }; diff --git a/src/features/cross-chain/calculation-manager/providers/stargate-v2-provider/constants/stargate-v2-blockchain-supported-pools.ts b/src/features/cross-chain/calculation-manager/providers/stargate-v2-provider/constants/stargate-v2-blockchain-supported-pools.ts index f8e25d043be..0a26aecf0ab 100644 --- a/src/features/cross-chain/calculation-manager/providers/stargate-v2-provider/constants/stargate-v2-blockchain-supported-pools.ts +++ b/src/features/cross-chain/calculation-manager/providers/stargate-v2-provider/constants/stargate-v2-blockchain-supported-pools.ts @@ -74,4 +74,9 @@ export const stargateV2BlockchainSupportedPools: Record [BLOCKCHAIN_NAME.TAIKO]: 30290, [BLOCKCHAIN_NAME.SEI]: 30280, [BLOCKCHAIN_NAME.FLARE]: 30295 + // [BLOCKCHAIN_NAME.GRAVITY]: 30294 // [BLOCKCHAIN_NAME.IOTA]: 30284, }; diff --git a/src/features/cross-chain/calculation-manager/providers/stargate-v2-provider/constants/stargate-v2-contract-address.ts b/src/features/cross-chain/calculation-manager/providers/stargate-v2-provider/constants/stargate-v2-contract-address.ts index ec4e73dcc28..d071996db27 100644 --- a/src/features/cross-chain/calculation-manager/providers/stargate-v2-provider/constants/stargate-v2-contract-address.ts +++ b/src/features/cross-chain/calculation-manager/providers/stargate-v2-provider/constants/stargate-v2-contract-address.ts @@ -11,7 +11,8 @@ type StargateV2ContractAddress = Record< export const chainsWithoutPoolBalanceMethodOnContract = [ BLOCKCHAIN_NAME.TAIKO, BLOCKCHAIN_NAME.SEI, - BLOCKCHAIN_NAME.FLARE + BLOCKCHAIN_NAME.FLARE, + BLOCKCHAIN_NAME.GRAVITY ] as const; export const stargateV2ContractAddress: StargateV2ContractAddress = { @@ -96,4 +97,9 @@ export const stargateV2ContractAddress: StargateV2ContractAddress = { [stargateV2BridgeToken.USDT]: '0x1C10CC06DC6D35970d1D53B2A23c76ef370d4135', [stargateV2BridgeToken.WETH]: '0x8e8539e4CcD69123c623a106773F2b0cbbc58746' } + // [BLOCKCHAIN_NAME.GRAVITY]: { + // [stargateV2BridgeToken.USDC]: '0xC1B8045A6ef2934Cf0f78B0dbD489969Fa9Be7E4', + // [stargateV2BridgeToken.USDT]: '0x0B38e83B86d491735fEaa0a791F65c2B99535396', + // [stargateV2BridgeToken.WETH]: '0x17d65bF79E77B6Ab21d8a0afed3bC8657d8Ee0B2' + // } }; diff --git a/src/features/cross-chain/calculation-manager/providers/stargate-v2-provider/constants/stargate-v2-cross-chain-supported-blockchains.ts b/src/features/cross-chain/calculation-manager/providers/stargate-v2-provider/constants/stargate-v2-cross-chain-supported-blockchains.ts index 07821ad2291..104bd211bb2 100644 --- a/src/features/cross-chain/calculation-manager/providers/stargate-v2-provider/constants/stargate-v2-cross-chain-supported-blockchains.ts +++ b/src/features/cross-chain/calculation-manager/providers/stargate-v2-provider/constants/stargate-v2-cross-chain-supported-blockchains.ts @@ -18,6 +18,7 @@ export const stargateV2SupportedBlockchains = [ BLOCKCHAIN_NAME.TAIKO, BLOCKCHAIN_NAME.SEI, BLOCKCHAIN_NAME.FLARE + // BLOCKCHAIN_NAME.GRAVITY // BLOCKCHAIN_NAME.IOTA, ]; diff --git a/src/features/cross-chain/calculation-manager/providers/stargate-v2-provider/constants/stargate-v2-token-address.ts b/src/features/cross-chain/calculation-manager/providers/stargate-v2-provider/constants/stargate-v2-token-address.ts index 72bd4b2da0b..006a3e768a9 100644 --- a/src/features/cross-chain/calculation-manager/providers/stargate-v2-provider/constants/stargate-v2-token-address.ts +++ b/src/features/cross-chain/calculation-manager/providers/stargate-v2-provider/constants/stargate-v2-token-address.ts @@ -82,6 +82,11 @@ const addresses: StargateV2TokenAddress = { '0x0B38e83B86d491735fEaa0a791F65c2B99535396': stargateV2BridgeToken.USDT, '0x1502FA4be69d526124D453619276FacCab275d3D': stargateV2BridgeToken.WETH } + // [BLOCKCHAIN_NAME.GRAVITY]: { + // '0xf6f832466Cd6C21967E0D954109403f36Bc8ceaA': stargateV2BridgeToken.WETH, + // '0xFbDa5F676cB37624f28265A144A48B0d6e87d3b6': stargateV2BridgeToken.USDC, + // '0x816E810f9F787d669FB71932DeabF6c83781Cd48': stargateV2BridgeToken.USDT + // } }; export const stargateV2TokenAddress = Object.entries(addresses).reduce( diff --git a/src/features/cross-chain/calculation-manager/providers/symbiosis-provider/models/symbiosis-cross-chain-supported-blockchains.ts b/src/features/cross-chain/calculation-manager/providers/symbiosis-provider/models/symbiosis-cross-chain-supported-blockchains.ts index 00a4f437887..3974c223716 100644 --- a/src/features/cross-chain/calculation-manager/providers/symbiosis-provider/models/symbiosis-cross-chain-supported-blockchains.ts +++ b/src/features/cross-chain/calculation-manager/providers/symbiosis-provider/models/symbiosis-cross-chain-supported-blockchains.ts @@ -28,6 +28,7 @@ export const symbiosisCrossChainSupportedBlockchains = [ BLOCKCHAIN_NAME.TAIKO, BLOCKCHAIN_NAME.CORE, BLOCKCHAIN_NAME.BAHAMUT, + BLOCKCHAIN_NAME.GRAVITY, // Testnets BLOCKCHAIN_NAME.GOERLI, BLOCKCHAIN_NAME.BINANCE_SMART_CHAIN_TESTNET, diff --git a/src/features/on-chain/calculation-manager/constants/trade-providers/algebra-trade-providers.ts b/src/features/on-chain/calculation-manager/constants/trade-providers/algebra-trade-providers.ts index 5d5dd9084ea..75816e40430 100644 --- a/src/features/on-chain/calculation-manager/constants/trade-providers/algebra-trade-providers.ts +++ b/src/features/on-chain/calculation-manager/constants/trade-providers/algebra-trade-providers.ts @@ -17,4 +17,5 @@ export const AlgebraTradeProviders = [ BerachainTestnetAlgebraProvider, ModeAlgebraProvider, BlastFenixProvider + //CamelotGravityProvider ] as const; diff --git a/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-algebra-abstract/uniswap-v3-algebra-abstract-provider.ts b/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-algebra-abstract/uniswap-v3-algebra-abstract-provider.ts index 7b26194aea3..e31553d92f9 100644 --- a/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-algebra-abstract/uniswap-v3-algebra-abstract-provider.ts +++ b/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-algebra-abstract/uniswap-v3-algebra-abstract-provider.ts @@ -35,6 +35,7 @@ import { UniSwapV3ScrollSepoliaTrade } from 'src/features/on-chain/calculation-m import { AbiItem } from 'web3-utils'; import { AlgebraIntegralTrade } from '../../arthera-testnet/algebra-integral/algebra-integral-trade'; +import { CamelotGravityTrade } from '../../gravity/camelot-gravity/camelot-gravity-trade'; export abstract class UniswapV3AlgebraAbstractProvider< T extends UniswapV3AlgebraAbstractTrade = UniswapV3AlgebraAbstractTrade @@ -53,7 +54,8 @@ export abstract class UniswapV3AlgebraAbstractProvider< | typeof UniSwapV3ScrollSepoliaTrade | typeof BerachainTestnetAlgebraTrade | typeof ModeAlgebraTrade - | typeof BlastFenixTrade; + | typeof BlastFenixTrade + | typeof CamelotGravityTrade; protected abstract readonly quoterController: UniswapV3AlgebraQuoterController; diff --git a/src/features/on-chain/calculation-manager/providers/dexes/gravity/camelot-gravity/camelot-gravity-provider.ts b/src/features/on-chain/calculation-manager/providers/dexes/gravity/camelot-gravity/camelot-gravity-provider.ts new file mode 100644 index 00000000000..e162d3de30e --- /dev/null +++ b/src/features/on-chain/calculation-manager/providers/dexes/gravity/camelot-gravity/camelot-gravity-provider.ts @@ -0,0 +1,60 @@ +import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name'; +import { EvmWeb3Pure } from 'src/core/blockchain/web3-pure/typed-web3-pure/evm-web3-pure/evm-web3-pure'; +import { createTokenNativeAddressProxyInPathStartAndEnd } from 'src/features/common/utils/token-native-address-proxy'; + +import { ON_CHAIN_TRADE_TYPE, OnChainTradeType } from '../../../common/models/on-chain-trade-type'; +import { AlgebraQuoterController } from '../../common/algebra/algebra-quoter-controller'; +import { UniswapV3AlgebraTradeStructOmitPath } from '../../common/uniswap-v3-algebra-abstract/models/uniswap-v3-algebra-trade-struct'; +import { UniswapV3AlgebraAbstractProvider } from '../../common/uniswap-v3-algebra-abstract/uniswap-v3-algebra-abstract-provider'; +import { QUICK_SWAP_V3_ROUTER_CONTRACT_ABI } from '../../polygon/quick-swap-v3/constants/swap-router-contract-data'; +import { QuickSwapV3Route } from '../../polygon/quick-swap-v3/models/quick-swap-v3-route'; +import { defaultzGravityProviderConfiguration } from '../default-constants'; +import { CamelotGravityTrade } from './camelot-gravity-trade'; +import { CAMELOT_GRAVITY_ROUTER_CONTRACT_ADDRESS } from './constants/gravity-swap-router-contract-address'; +import { CAMELOT_GRAVITY_PROVIDER_CONFIGURATION } from './constants/provider-configuration'; +import { + CAMELOT_GRAVITY_QUOTER_CONTRACT_ABI, + CAMELOT_GRAVITY_QUOTER_CONTRACT_ADDRESS +} from './constants/quote-contract-data'; + +export class CamelotGravityProvider extends UniswapV3AlgebraAbstractProvider { + protected readonly contractAddress = CAMELOT_GRAVITY_ROUTER_CONTRACT_ADDRESS; + + protected readonly contractAbi = QUICK_SWAP_V3_ROUTER_CONTRACT_ABI; + + public readonly blockchain = BLOCKCHAIN_NAME.GRAVITY; + + protected readonly OnChainTradeClass = CamelotGravityTrade; + + protected readonly quoterController = new AlgebraQuoterController( + this.blockchain, + defaultzGravityProviderConfiguration.routingProvidersAddresses, + CAMELOT_GRAVITY_QUOTER_CONTRACT_ADDRESS, + CAMELOT_GRAVITY_QUOTER_CONTRACT_ABI + ); + + protected readonly providerConfiguration = CAMELOT_GRAVITY_PROVIDER_CONFIGURATION; + + public get type(): OnChainTradeType { + return ON_CHAIN_TRADE_TYPE.CAMELOT; + } + + protected createTradeInstance( + tradeStruct: UniswapV3AlgebraTradeStructOmitPath, + route: QuickSwapV3Route, + providerAddress: string + ): CamelotGravityTrade { + const path = createTokenNativeAddressProxyInPathStartAndEnd( + route.path, + EvmWeb3Pure.nativeTokenAddress + ); + return new CamelotGravityTrade( + { + ...tradeStruct, + path, + route + }, + providerAddress + ); + } +} diff --git a/src/features/on-chain/calculation-manager/providers/dexes/gravity/camelot-gravity/camelot-gravity-trade.ts b/src/features/on-chain/calculation-manager/providers/dexes/gravity/camelot-gravity/camelot-gravity-trade.ts new file mode 100644 index 00000000000..d0bd0e496c7 --- /dev/null +++ b/src/features/on-chain/calculation-manager/providers/dexes/gravity/camelot-gravity/camelot-gravity-trade.ts @@ -0,0 +1,73 @@ +import { Token } from 'src/common/tokens'; +import { MethodData } from 'src/core/blockchain/web3-public-service/web3-public/models/method-data'; + +import { ON_CHAIN_TRADE_TYPE, OnChainTradeType } from '../../../common/models/on-chain-trade-type'; +import { AlgebraQuoterController } from '../../common/algebra/algebra-quoter-controller'; +import { UniswapV3AlgebraAbstractTrade } from '../../common/uniswap-v3-algebra-abstract/uniswap-v3-algebra-abstract-trade'; +import { QUICK_SWAP_V3_ROUTER_CONTRACT_ABI } from '../../polygon/quick-swap-v3/constants/swap-router-contract-data'; +import { QuickSwapV3Route } from '../../polygon/quick-swap-v3/models/quick-swap-v3-route'; +import { QuickSwapV3TradeStruct } from '../../polygon/quick-swap-v3/models/quick-swap-v3-trade-struct'; +import { CAMELOT_GRAVITY_ROUTER_CONTRACT_ADDRESS } from './constants/gravity-swap-router-contract-address'; + +export class CamelotGravityTrade extends UniswapV3AlgebraAbstractTrade { + public static get type(): OnChainTradeType { + return ON_CHAIN_TRADE_TYPE.CAMELOT; + } + + public readonly dexContractAddress = CAMELOT_GRAVITY_ROUTER_CONTRACT_ADDRESS; + + protected readonly contractAbi = QUICK_SWAP_V3_ROUTER_CONTRACT_ABI; + + protected readonly unwrapWethMethodName = 'unwrapWNativeToken'; + + private readonly route: QuickSwapV3Route; + + public readonly wrappedPath: ReadonlyArray; + + constructor(tradeStruct: QuickSwapV3TradeStruct, providerAddress: string) { + super(tradeStruct, providerAddress); + + this.route = tradeStruct.route; + + this.wrappedPath = this.route.path; + } + + /** + * Returns swap `exactInput` method's name and arguments to use in Swap contract. + */ + protected getSwapRouterExactInputMethodData(walletAddress: string): MethodData { + const amountParams = this.getAmountParams(); + + if (this.route.path.length === 2 && this.route?.path?.[0] && this.route?.path?.[1]) { + const methodName = this.exact === 'input' ? 'exactInputSingle' : 'exactOutputSingle'; + + return { + methodName, + methodArguments: [ + [ + this.route.path[0].address, + this.route.path[1].address, + walletAddress, + this.deadlineMinutesTimestamp, + ...amountParams, + 0 + ] + ] + }; + } + + const methodName = this.exact === 'input' ? 'exactInput' : 'exactOutput'; + + return { + methodName, + methodArguments: [ + [ + AlgebraQuoterController.getEncodedPath(this.route.path), + walletAddress, + this.deadlineMinutesTimestamp, + ...amountParams + ] + ] + }; + } +} diff --git a/src/features/on-chain/calculation-manager/providers/dexes/gravity/camelot-gravity/constants/gravity-swap-router-contract-address.ts b/src/features/on-chain/calculation-manager/providers/dexes/gravity/camelot-gravity/constants/gravity-swap-router-contract-address.ts new file mode 100644 index 00000000000..f25a4386e56 --- /dev/null +++ b/src/features/on-chain/calculation-manager/providers/dexes/gravity/camelot-gravity/constants/gravity-swap-router-contract-address.ts @@ -0,0 +1 @@ +export const CAMELOT_GRAVITY_ROUTER_CONTRACT_ADDRESS = '0x60A186019F81bFD04aFc16c9C01804a04E79e68B'; diff --git a/src/features/on-chain/calculation-manager/providers/dexes/gravity/camelot-gravity/constants/provider-configuration.ts b/src/features/on-chain/calculation-manager/providers/dexes/gravity/camelot-gravity/constants/provider-configuration.ts new file mode 100644 index 00000000000..af3a8ed8f37 --- /dev/null +++ b/src/features/on-chain/calculation-manager/providers/dexes/gravity/camelot-gravity/constants/provider-configuration.ts @@ -0,0 +1,9 @@ +import { wrappedNativeTokensList } from 'src/common/tokens/constants/wrapped-native-tokens'; +import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name'; + +import { UniswapV3AlgebraProviderConfiguration } from '../../../common/uniswap-v3-algebra-abstract/models/uniswap-v3-algebra-provider-configuration'; + +export const CAMELOT_GRAVITY_PROVIDER_CONFIGURATION: UniswapV3AlgebraProviderConfiguration = { + wethAddress: wrappedNativeTokensList[BLOCKCHAIN_NAME.GRAVITY]!.address, + maxTransitTokens: 1 +}; diff --git a/src/features/on-chain/calculation-manager/providers/dexes/gravity/camelot-gravity/constants/quote-contract-data.ts b/src/features/on-chain/calculation-manager/providers/dexes/gravity/camelot-gravity/constants/quote-contract-data.ts new file mode 100644 index 00000000000..2f54bb7c97d --- /dev/null +++ b/src/features/on-chain/calculation-manager/providers/dexes/gravity/camelot-gravity/constants/quote-contract-data.ts @@ -0,0 +1,103 @@ +import { AbiItem } from 'web3-utils'; + +export const CAMELOT_GRAVITY_QUOTER_CONTRACT_ADDRESS = '0x52CFD1d72A64f8D13711bb7Dc3899653dbd4191B'; + +export const CAMELOT_GRAVITY_QUOTER_CONTRACT_ABI: AbiItem[] = [ + { + inputs: [ + { internalType: 'address', name: '_factory', type: 'address' }, + { internalType: 'address', name: '_WNativeToken', type: 'address' }, + { internalType: 'address', name: '_poolDeployer', type: 'address' } + ], + stateMutability: 'nonpayable', + type: 'constructor' + }, + { + inputs: [], + name: 'WNativeToken', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function' + }, + { + inputs: [ + { internalType: 'int256', name: 'amount0Delta', type: 'int256' }, + { internalType: 'int256', name: 'amount1Delta', type: 'int256' }, + { internalType: 'bytes', name: 'path', type: 'bytes' } + ], + name: 'algebraSwapCallback', + outputs: [], + stateMutability: 'view', + type: 'function' + }, + { + inputs: [], + name: 'factory', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function' + }, + { + inputs: [], + name: 'poolDeployer', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function' + }, + { + inputs: [ + { internalType: 'bytes', name: 'path', type: 'bytes' }, + { internalType: 'uint256', name: 'amountIn', type: 'uint256' } + ], + name: 'quoteExactInput', + outputs: [ + { internalType: 'uint256', name: 'amountOut', type: 'uint256' }, + { internalType: 'uint16[]', name: 'fees', type: 'uint16[]' } + ], + stateMutability: 'nonpayable', + type: 'function' + }, + { + inputs: [ + { internalType: 'address', name: 'tokenIn', type: 'address' }, + { internalType: 'address', name: 'tokenOut', type: 'address' }, + { internalType: 'uint256', name: 'amountIn', type: 'uint256' }, + { internalType: 'uint160', name: 'limitSqrtPrice', type: 'uint160' } + ], + name: 'quoteExactInputSingle', + outputs: [ + { internalType: 'uint256', name: 'amountOut', type: 'uint256' }, + { internalType: 'uint16', name: 'fee', type: 'uint16' } + ], + stateMutability: 'nonpayable', + type: 'function' + }, + { + inputs: [ + { internalType: 'bytes', name: 'path', type: 'bytes' }, + { internalType: 'uint256', name: 'amountOut', type: 'uint256' } + ], + name: 'quoteExactOutput', + outputs: [ + { internalType: 'uint256', name: 'amountIn', type: 'uint256' }, + { internalType: 'uint16[]', name: 'fees', type: 'uint16[]' } + ], + stateMutability: 'nonpayable', + type: 'function' + }, + { + inputs: [ + { internalType: 'address', name: 'tokenIn', type: 'address' }, + { internalType: 'address', name: 'tokenOut', type: 'address' }, + { internalType: 'uint256', name: 'amountOut', type: 'uint256' }, + { internalType: 'uint160', name: 'limitSqrtPrice', type: 'uint160' } + ], + name: 'quoteExactOutputSingle', + outputs: [ + { internalType: 'uint256', name: 'amountIn', type: 'uint256' }, + { internalType: 'uint16', name: 'fee', type: 'uint16' } + ], + stateMutability: 'nonpayable', + type: 'function' + } +]; diff --git a/src/features/on-chain/calculation-manager/providers/dexes/gravity/default-constants.ts b/src/features/on-chain/calculation-manager/providers/dexes/gravity/default-constants.ts new file mode 100644 index 00000000000..50a84ed5989 --- /dev/null +++ b/src/features/on-chain/calculation-manager/providers/dexes/gravity/default-constants.ts @@ -0,0 +1,20 @@ +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'; + +const defaultGravityRoutingProvidersAddresses = [ + wrappedNativeTokensList[BLOCKCHAIN_NAME.GRAVITY]!.address, // WG + '0xFbDa5F676cB37624f28265A144A48B0d6e87d3b6', // USDC + '0x816e810f9f787d669fb71932deabf6c83781cd48', // USDT + '0x729ed87bbe7b7e4b7f09bcb9c668580818d98bb9', // WBTC + '0xf6f832466cd6c21967e0d954109403f36bc8ceaa' // WETH +]; + +const defaultGravityWethAddress = wrappedNativeTokensList[BLOCKCHAIN_NAME.GRAVITY]!.address; + +export const defaultzGravityProviderConfiguration: UniswapV2ProviderConfiguration = { + maxTransitTokens: 1, + routingProvidersAddresses: defaultGravityRoutingProvidersAddresses, + wethAddress: defaultGravityWethAddress +};