Skip to content

Commit

Permalink
add fraxtal mainnet (#804)
Browse files Browse the repository at this point in the history
  • Loading branch information
IDIDOS authored Jan 28, 2025
2 parents 2e9a569 + 0e4dd7f commit 9ba210e
Show file tree
Hide file tree
Showing 24 changed files with 352 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rubic-sdk",
"version": "5.52.0",
"version": "5.52.1",
"description": "Simplify dApp creation",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
7 changes: 7 additions & 0 deletions src/common/tokens/constants/native-tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -720,5 +720,12 @@ export const nativeTokensList: Record<BlockchainName, Token> = {
name: 'Ethereum',
symbol: 'ETH',
decimals: 18
}),
[BLOCKCHAIN_NAME.FRAXTAL]: new Token({
blockchain: BLOCKCHAIN_NAME.FRAXTAL,
address: EvmWeb3Pure.nativeTokenAddress,
name: 'Frax Ether',
symbol: 'frxETH',
decimals: 18
})
};
1 change: 1 addition & 0 deletions src/common/tokens/constants/wrapped-addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export const wrappedAddress: Partial<Record<EvmBlockchainName, string>> = {
[BLOCKCHAIN_NAME.FLARE]: '0x1d80c49bbbcd1c0911346656b529df9e5c2f783d',
[BLOCKCHAIN_NAME.SONIC]: '0x039e2fb66102314ce7b64ce5ce3e5183bc94ad38',
[BLOCKCHAIN_NAME.MORPH]: '0x5300000000000000000000000000000000000011',
[BLOCKCHAIN_NAME.FRAXTAL]: '0xfc00000000000000000000000000000000000006',
// Testnet
[BLOCKCHAIN_NAME.GOERLI]: '0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6',
[BLOCKCHAIN_NAME.SCROLL_SEPOLIA]: '0x5300000000000000000000000000000000000004',
Expand Down
7 changes: 7 additions & 0 deletions src/common/tokens/constants/wrapped-native-tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -506,5 +506,12 @@ export const wrappedNativeTokensList: Partial<Record<EvmBlockchainName, Token>>
name: 'Wrapped Ether',
symbol: 'WETH',
decimals: 18
}),
[BLOCKCHAIN_NAME.FRAXTAL]: new Token({
blockchain: BLOCKCHAIN_NAME.FRAXTAL,
address: '0xfc00000000000000000000000000000000000006',
name: 'Wrapped Frax Ether',
symbol: 'wfrxETH',
decimals: 18
})
};
3 changes: 2 additions & 1 deletion src/core/blockchain/models/backend-blockchains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ const BLOCKCHAINS_MAPPING = {
[BLOCKCHAIN_NAME.UNICHAIN_SEPOLIA_TESTNET]: 'unichain-sepolia-testnet',
[BLOCKCHAIN_NAME.SONEIUM_TESTNET]: 'soneium-minato',
[BLOCKCHAIN_NAME.SONIC]: 'sonic',
[BLOCKCHAIN_NAME.MORPH]: 'morph'
[BLOCKCHAIN_NAME.MORPH]: 'morph',
[BLOCKCHAIN_NAME.FRAXTAL]: 'fraxtal'
} as const;

export const TO_BACKEND_BLOCKCHAINS: Record<BlockchainName, BackendBlockchain> = {
Expand Down
3 changes: 2 additions & 1 deletion src/core/blockchain/models/blockchain-name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ export const EVM_BLOCKCHAIN_NAME = {
BITLAYER: 'BITLAYER',
GRAVITY: 'GRAVITY',
SONIC: 'SONIC',
MORPH: 'MORPH'
MORPH: 'MORPH',
FRAXTAL: 'FRAXTAL'
} as const;

export const BLOCKCHAIN_NAME = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export const blockchainId: Record<BlockchainName, number> = {
[BLOCKCHAIN_NAME.GRAVITY]: 1625,
[BLOCKCHAIN_NAME.SONIC]: 146,
[BLOCKCHAIN_NAME.MORPH]: 2818,
[BLOCKCHAIN_NAME.FRAXTAL]: 252,
// Tesnents
[BLOCKCHAIN_NAME.GOERLI]: 5,
[BLOCKCHAIN_NAME.BINANCE_SMART_CHAIN_TESTNET]: 87,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,6 @@ export const MULTICALL_ADDRESSES: Record<Web3PublicSupportedBlockchain, string>
[BLOCKCHAIN_NAME.UNICHAIN_SEPOLIA_TESTNET]: '0xca11bde05977b3631167028862be2a173976ca11',
[BLOCKCHAIN_NAME.SONEIUM_TESTNET]: '0xcA11bde05977b3631167028862bE2a173976CA11',
[BLOCKCHAIN_NAME.SONIC]: '0xcA11bde05977b3631167028862bE2a173976CA11',
[BLOCKCHAIN_NAME.MORPH]: '0x74F689bb9f86BD24d370BE2a2B9C74446ce08843'
[BLOCKCHAIN_NAME.MORPH]: '0x74F689bb9f86BD24d370BE2a2B9C74446ce08843',
[BLOCKCHAIN_NAME.FRAXTAL]: '0xcA11bde05977b3631167028862bE2a173976CA11'
};
3 changes: 2 additions & 1 deletion src/features/common/constants/proxy-supported-blockchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export const proxySupportedBlockchains = [
BLOCKCHAIN_NAME.GRAVITY,
BLOCKCHAIN_NAME.FLARE,
BLOCKCHAIN_NAME.SONIC,
BLOCKCHAIN_NAME.MORPH
BLOCKCHAIN_NAME.MORPH,
BLOCKCHAIN_NAME.FRAXTAL
// BLOCKCHAIN_NAME.OKE_X_CHAIN,
// BLOCKCHAIN_NAME.GNOSIS,
// BLOCKCHAIN_NAME.FUSE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ const ALTERNATIVE_ROUTER1_NETWORKS = [
BLOCKCHAIN_NAME.BITLAYER,
BLOCKCHAIN_NAME.FLARE,
BLOCKCHAIN_NAME.SONIC,
BLOCKCHAIN_NAME.MORPH
BLOCKCHAIN_NAME.MORPH,
BLOCKCHAIN_NAME.FRAXTAL
] as const;

function isAlternativeRouter1Network(blockchain: BlockchainName): boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export const owlToSupportedBlockchains = [
BLOCKCHAIN_NAME.BITLAYER,
BLOCKCHAIN_NAME.GRAVITY,
BLOCKCHAIN_NAME.SONIC,
BLOCKCHAIN_NAME.MORPH
BLOCKCHAIN_NAME.MORPH,
BLOCKCHAIN_NAME.FRAXTAL
] as const;

export type OwlToSupportedBlockchain = (typeof owlToSupportedBlockchains)[number];
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name';
import { rubicProxyContractAddress } from 'src/features/cross-chain/calculation-manager/providers/common/constants/rubic-proxy-contract-address';
import { UniversalContract } from 'src/features/cross-chain/calculation-manager/providers/common/models/universal-contract';
import {
Expand All @@ -9,6 +10,16 @@ export const SquidrouterContractAddress: Record<
SquidrouterCrossChainSupportedBlockchain,
UniversalContract
> = squidrouterCrossChainSupportedBlockchains.reduce((acc, blockchain) => {
if (blockchain === BLOCKCHAIN_NAME.FRAXTAL) {
return {
...acc,
[blockchain]: {
providerRouter: '0xDC3D8e1Abe590BCa428a8a2FC4CfDbD1AcF57Bd9',
providerGateway: '0xDC3D8e1Abe590BCa428a8a2FC4CfDbD1AcF57Bd9',
rubicRouter: rubicProxyContractAddress[blockchain].gateway
}
};
}
return {
...acc,
[blockchain]: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export const squidrouterCrossChainSupportedBlockchains = [
BLOCKCHAIN_NAME.BASE,
BLOCKCHAIN_NAME.MANTLE,
BLOCKCHAIN_NAME.SCROLL,
BLOCKCHAIN_NAME.BLAST
BLOCKCHAIN_NAME.BLAST,
BLOCKCHAIN_NAME.FRAXTAL
// BLOCKCHAIN_NAME.FILECOIN
] as const;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const symbiosisCrossChainSupportedBlockchains = [
BLOCKCHAIN_NAME.BAHAMUT,
BLOCKCHAIN_NAME.TON,
BLOCKCHAIN_NAME.GRAVITY,
BLOCKCHAIN_NAME.FRAXTAL,
// Testnets
BLOCKCHAIN_NAME.GOERLI,
BLOCKCHAIN_NAME.BINANCE_SMART_CHAIN_TESTNET,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { CurveMoonbeamProvider } from 'src/features/on-chain/calculation-manager
import { CurveOptimismProvider } from 'src/features/on-chain/calculation-manager/providers/dexes/optimism/curve-optimism/curve-optimism-provider';
import { CurvePolygonProvider } from 'src/features/on-chain/calculation-manager/providers/dexes/polygon/curve-polygon/curve-polygon-provider';

import { CurveFraxtalProvider } from '../../providers/dexes/fraxtal/curve-fraxtal/curve-fraxtal-provider';

export const CurveTradeProviders = [
CurveArbitrumProvider,
CurveAvalancheProvider,
Expand All @@ -19,5 +21,6 @@ export const CurveTradeProviders = [
CurveGnosisProvider,
CurveMoonbeamProvider,
CurveOptimismProvider,
CurvePolygonProvider
CurvePolygonProvider,
CurveFraxtalProvider
] as const;
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import { SilkSwapBahamutProvider } from '../../providers/dexes/bahamut/silk-swap
import { BlazeSwapFlareProvider } from '../../providers/dexes/flare/blaze-swap-flare/blaze-swap-flare-provider';
import { EnosysFlareProvider } from '../../providers/dexes/flare/enosys-flare/enosys-v2-flare/enosys-flare-provider';
import { SparkDexFlareProvider } from '../../providers/dexes/flare/spark-dex-flare/spark-dex-v2-flare/spark-dex-flare-provider';
import { FraxSwapV2Provider } from '../../providers/dexes/fraxtal/frax-swap-v2/frax-swap-v2-provider';
import { SushiSwapZetachainProvider } from '../../providers/dexes/zetachain/sushi-swap-zetachain/sushi-swap-zetachain-provider';

export const UniswapV2TradeProviders = [
Expand Down Expand Up @@ -172,5 +173,7 @@ export const UniswapV2TradeProviders = [
SparkDexFlareProvider,
EnosysFlareProvider,
// Morph
BulbaswapProvider
BulbaswapProvider,
// Fraxtal
FraxSwapV2Provider
] as const;
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const ON_CHAIN_TRADE_TYPE = {
FENIX_V3: 'FENIX_V3',
FINKUJIRA: 'FINKUJIRA',
FUSIONX: 'FUSIONX',
FRAX_SWAP_V2: 'FRAX_SWAP_V2',

HONEY_SWAP: 'HONEY_SWAP',
HORIZONDEX: 'HORIZONDEX',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name';

import { CurveAbstractProvider } from '../../common/curve-provider/curve-abstract-provider';
import { CurveFraxtalTrade } from './curve-fraxtal-trade';

export class CurveFraxtalProvider extends CurveAbstractProvider<CurveFraxtalTrade> {
public readonly blockchain = BLOCKCHAIN_NAME.FRAXTAL;

public readonly Trade = CurveFraxtalTrade;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { CurveAbstractTrade } from '../../common/curve-provider/curve-abstract-trade';

export class CurveFraxtalTrade extends CurveAbstractTrade {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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 defaultFraxtalRoutingProvidersAddresses = [
wrappedNativeTokensList[BLOCKCHAIN_NAME.FRAXTAL]!.address, // wfrxETH
'0xFc00000000000000000000000000000000000001', // FRAX
'0xfc00000000000000000000000000000000000005', // sfrxETH
'0xfc00000000000000000000000000000000000002', // FXS
'0xfc00000000000000000000000000000000000008', // sFRAX
'0xfc00000000000000000000000000000000000007', // frxBTC
'0xfc00000000000000000000000000000000000003', // FPI
'0xfc00000000000000000000000000000000000004', // FPIS
'0x2416092f143378750bb29b79eD961ab195CcEea5', // ezETH
'0x4d15EA9C2573ADDAeD814e48C148b5262694646A', // USDT
'0xDcc0F2D8F90FDe85b10aC1c8Ab57dc0AE946A543' // USDC
];

const defaultFraxtalWethAddress = wrappedNativeTokensList[BLOCKCHAIN_NAME.FRAXTAL]!.address;

export const defaultFraxtalProviderConfiguration: UniswapV2ProviderConfiguration = {
maxTransitTokens: 2,
routingProvidersAddresses: defaultFraxtalRoutingProvidersAddresses,
wethAddress: defaultFraxtalWethAddress
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { defaultFraxtalProviderConfiguration } from '../default-constants';

export const FRAXSWAP_V2_CONTRACT_ADDRESS = '0x2Dd1B4D4548aCCeA497050619965f91f78b3b532';
export const FRAXSWAP_V2_PROVIDER_CONFIGURATION = defaultFraxtalProviderConfiguration;
Loading

0 comments on commit 9ba210e

Please sign in to comment.