Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

feat: + SoulSwap DEX on AVAX and FTM #1304

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/asset-swapper/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ export enum ERC20BridgeSource {
UbeSwap = 'UbeSwap',
MobiusMoney = 'MobiusMoney',
// Fantom
SoulSwap = 'SoulSwap',
SpiritSwap = 'SpiritSwap',
SpookySwap = 'SpookySwap',
Beethovenx = 'Beethovenx',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
SADDLE_ARBITRUM_INFOS,
SHELL_POOLS_BY_CHAIN_ID,
SHIBASWAP_ROUTER_BY_CHAIN_ID,
SOULSWAP_ROUTER_BY_CHAIN_ID,
SPIRITSWAP_ROUTER_BY_CHAIN_ID,
SPOOKYSWAP_ROUTER_BY_CHAIN_ID,
SUSHISWAP_ROUTER_BY_CHAIN_ID,
Expand Down Expand Up @@ -481,6 +482,7 @@ export function uniswapV2LikeRouterAddress(
| ERC20BridgeSource.Pangolin
| ERC20BridgeSource.UbeSwap
| ERC20BridgeSource.MorpheusSwap
| ERC20BridgeSource.SoulSwap
| ERC20BridgeSource.SpookySwap
| ERC20BridgeSource.SpiritSwap
| ERC20BridgeSource.BiSwap
Expand Down Expand Up @@ -520,6 +522,8 @@ export function uniswapV2LikeRouterAddress(
return UBESWAP_ROUTER_BY_CHAIN_ID[chainId];
case ERC20BridgeSource.MorpheusSwap:
return MORPHEUSSWAP_ROUTER_BY_CHAIN_ID[chainId];
case ERC20BridgeSource.SoulSwap:
return SOULSWAP_ROUTER_BY_CHAIN_ID[chainId];
case ERC20BridgeSource.SpookySwap:
return SPOOKYSWAP_ROUTER_BY_CHAIN_ID[chainId];
case ERC20BridgeSource.SpiritSwap:
Expand Down
17 changes: 15 additions & 2 deletions src/asset-swapper/utils/market_operation_utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export const SELL_SOURCE_FILTER_BY_CHAIN_ID: Record<ChainId, SourceFilters> = {
ERC20BridgeSource.Pangolin,
ERC20BridgeSource.TraderJoe,
ERC20BridgeSource.SushiSwap,
ERC20BridgeSource.SoulSwap,
ERC20BridgeSource.Curve,
ERC20BridgeSource.CurveV2,
ERC20BridgeSource.KyberDmm,
Expand All @@ -175,6 +176,7 @@ export const SELL_SOURCE_FILTER_BY_CHAIN_ID: Record<ChainId, SourceFilters> = {
ERC20BridgeSource.Curve,
ERC20BridgeSource.CurveV2,
ERC20BridgeSource.MorpheusSwap,
ERC20BridgeSource.SoulSwap,
ERC20BridgeSource.SpiritSwap,
ERC20BridgeSource.SpookySwap,
ERC20BridgeSource.SushiSwap,
Expand Down Expand Up @@ -312,6 +314,7 @@ export const BUY_SOURCE_FILTER_BY_CHAIN_ID: Record<ChainId, SourceFilters> = {
ERC20BridgeSource.Pangolin,
ERC20BridgeSource.TraderJoe,
ERC20BridgeSource.SushiSwap,
ERC20BridgeSource.SoulSwap,
ERC20BridgeSource.Curve,
ERC20BridgeSource.CurveV2,
ERC20BridgeSource.KyberDmm,
Expand All @@ -328,6 +331,7 @@ export const BUY_SOURCE_FILTER_BY_CHAIN_ID: Record<ChainId, SourceFilters> = {
ERC20BridgeSource.Curve,
ERC20BridgeSource.CurveV2,
ERC20BridgeSource.MorpheusSwap,
ERC20BridgeSource.SoulSwap,
ERC20BridgeSource.SpiritSwap,
ERC20BridgeSource.SpookySwap,
ERC20BridgeSource.SushiSwap,
Expand Down Expand Up @@ -390,8 +394,8 @@ export const FEE_QUOTE_SOURCES_BY_CHAIN_ID = valueByChainId<ERC20BridgeSource[]>
[ChainId.Goerli]: [ERC20BridgeSource.UniswapV2, ERC20BridgeSource.SushiSwap],
[ChainId.PolygonMumbai]: [ERC20BridgeSource.UniswapV3],
[ChainId.Polygon]: [ERC20BridgeSource.QuickSwap, ERC20BridgeSource.SushiSwap, ERC20BridgeSource.UniswapV3],
[ChainId.Avalanche]: [ERC20BridgeSource.Pangolin, ERC20BridgeSource.TraderJoe, ERC20BridgeSource.SushiSwap],
[ChainId.Fantom]: [ERC20BridgeSource.SpiritSwap, ERC20BridgeSource.SpookySwap, ERC20BridgeSource.SushiSwap],
[ChainId.Avalanche]: [ERC20BridgeSource.Pangolin, ERC20BridgeSource.TraderJoe, ERC20BridgeSource.SoulSwap, ERC20BridgeSource.SushiSwap],
[ChainId.Fantom]: [ERC20BridgeSource.SoulSwap, ERC20BridgeSource.SpiritSwap, ERC20BridgeSource.SpookySwap, ERC20BridgeSource.SushiSwap],
[ChainId.Celo]: [ERC20BridgeSource.UbeSwap, ERC20BridgeSource.SushiSwap],
[ChainId.Optimism]: [ERC20BridgeSource.UniswapV3],
[ChainId.Arbitrum]: [ERC20BridgeSource.UniswapV3, ERC20BridgeSource.SushiSwap],
Expand Down Expand Up @@ -1789,6 +1793,14 @@ export const MORPHEUSSWAP_ROUTER_BY_CHAIN_ID = valueByChainId<string>(
NULL_ADDRESS,
);

export const SOULSWAP_ROUTER_BY_CHAIN_ID = valueByChainId<string>(
{
[ChainId.Avalanche]: '0xa4594460a9d3d41e8b85542d34e23adabc3c86ef',
[ChainId.Fantom]: '0x6b3d631b87fe27af29efec61d2ab8ce4d621ccbf',
},
NULL_ADDRESS,
);

export const SPIRITSWAP_ROUTER_BY_CHAIN_ID = valueByChainId<string>(
{
[ChainId.Fantom]: '0x16327e3fbdaca3bcf7e38f5af2599d2ddc33ae52',
Expand Down Expand Up @@ -2170,6 +2182,7 @@ export const DEFAULT_GAS_SCHEDULE: GasSchedule = {
// Fantom
//
[ERC20BridgeSource.MorpheusSwap]: uniswapV2CloneGasSchedule,
[ERC20BridgeSource.SoulSwap]: uniswapV2CloneGasSchedule,
[ERC20BridgeSource.SpiritSwap]: uniswapV2CloneGasSchedule,
[ERC20BridgeSource.SpookySwap]: uniswapV2CloneGasSchedule,
[ERC20BridgeSource.Yoshi]: uniswapV2CloneGasSchedule,
Expand Down
4 changes: 4 additions & 0 deletions src/asset-swapper/utils/market_operation_utils/orders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ export function getErc20BridgeSourceToBridgeSource(source: ERC20BridgeSource): s
return encodeBridgeSourceId(BridgeProtocol.UniswapV2, 'UbeSwap');
case ERC20BridgeSource.Beethovenx:
return encodeBridgeSourceId(BridgeProtocol.BalancerV2Batch, 'Beethovenx');
case ERC20BridgeSource.SoulSwap:
return encodeBridgeSourceId(BridgeProtocol.UniswapV2, 'SoulSwap');
case ERC20BridgeSource.SpiritSwap:
return encodeBridgeSourceId(BridgeProtocol.UniswapV2, 'SpiritSwap');
case ERC20BridgeSource.SpookySwap:
Expand Down Expand Up @@ -274,6 +276,7 @@ export function createBridgeDataForBridgeOrder(order: OptimizedMarketBridgeOrder
case ERC20BridgeSource.Pangolin:
case ERC20BridgeSource.TraderJoe:
case ERC20BridgeSource.UbeSwap:
case ERC20BridgeSource.SoulSwap:
case ERC20BridgeSource.SpiritSwap:
case ERC20BridgeSource.SpookySwap:
case ERC20BridgeSource.MorpheusSwap:
Expand Down Expand Up @@ -473,6 +476,7 @@ const BRIDGE_ENCODERS: {
[ERC20BridgeSource.ShibaSwap]: routerAddressPathEncoder,
[ERC20BridgeSource.Pangolin]: routerAddressPathEncoder,
[ERC20BridgeSource.TraderJoe]: routerAddressPathEncoder,
[ERC20BridgeSource.SoulSwap]: routerAddressPathEncoder,
[ERC20BridgeSource.SpiritSwap]: routerAddressPathEncoder,
[ERC20BridgeSource.SpookySwap]: routerAddressPathEncoder,
[ERC20BridgeSource.MorpheusSwap]: routerAddressPathEncoder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1551,6 +1551,7 @@ export class SamplerOperations {
case ERC20BridgeSource.Pangolin:
case ERC20BridgeSource.TraderJoe:
case ERC20BridgeSource.UbeSwap:
case ERC20BridgeSource.SoulSwap:
case ERC20BridgeSource.SpiritSwap:
case ERC20BridgeSource.SpookySwap:
case ERC20BridgeSource.Yoshi:
Expand Down Expand Up @@ -1892,6 +1893,7 @@ export class SamplerOperations {
case ERC20BridgeSource.Pangolin:
case ERC20BridgeSource.TraderJoe:
case ERC20BridgeSource.UbeSwap:
case ERC20BridgeSource.SoulSwap:
case ERC20BridgeSource.SpiritSwap:
case ERC20BridgeSource.SpookySwap:
case ERC20BridgeSource.Yoshi:
Expand Down