diff --git a/libs/defi/oeth/src/redeem/actions.ts b/libs/defi/oeth/src/redeem/actions.ts index afa8cae87..be64853b2 100644 --- a/libs/defi/oeth/src/redeem/actions.ts +++ b/libs/defi/oeth/src/redeem/actions.ts @@ -5,61 +5,13 @@ import type { SwapApi } from '@origin/shared/providers'; import type { OethRedeemAction } from './types'; -const defaultApi: SwapApi = { - isRouteAvailable: async () => true, - estimateAmount: async (config, { amountIn }) => { - console.log('Amount estimation not implemented'); - - return amountIn; - }, - estimateGas: async () => { - console.log('Gas estimation not implemented'); - - return 0n; - }, - estimateRoute: async (config, { amountIn, route }) => { - console.log('Route estimation not implemented'); - - return { - ...route, - estimatedAmount: amountIn, - allowanceAmount: 0n, - approvalGas: 0n, - gas: 0n, - rate: 0, - }; - }, - allowance: async () => { - console.log('Allowance not implemented'); - - return 0n; - }, - estimateApprovalGas: async () => { - console.log('Gas approval estimation not implemented'); - - return 0n; - }, - approve: async () => { - console.log('Approve operation not implemented'); - return null; - }, - swap: async () => { - console.log('Route swap operation not implemented'); - return null; - }, - buttonLabel: defineMessage({ defaultMessage: 'Redeem' }), - routeLabel: defineMessage({ defaultMessage: 'Redeem' }), -}; - export const redeemActions: Record = { 'swap-curve-oeth': { - ...defaultApi, ...SwapCurveOeth, routeLabel: defineMessage({ defaultMessage: 'Swap via Curve' }), buttonLabel: defineMessage({ defaultMessage: 'Redeem' }), }, 'redeem-vault-oeth': { - ...defaultApi, ...redeemVaultOeth, routeLabel: defineMessage({ defaultMessage: 'Redeem via OETH Vault' }), buttonLabel: defineMessage({ defaultMessage: 'Redeem' }), diff --git a/libs/defi/oeth/src/swap/actions.ts b/libs/defi/oeth/src/swap/actions.ts index 12d0e337a..e1e5a4634 100644 --- a/libs/defi/oeth/src/swap/actions.ts +++ b/libs/defi/oeth/src/swap/actions.ts @@ -14,97 +14,43 @@ import type { SwapApi } from '@origin/shared/providers'; import type { OethSwapAction } from './types'; -const defaultApi: SwapApi = { - isRouteAvailable: async () => true, - estimateAmount: async (config, { amountIn }) => { - console.log('Amount estimation not implemented'); - - return amountIn; - }, - estimateGas: async () => { - console.log('Gas estimation not implemented'); - - return 0n; - }, - estimateRoute: async (config, { amountIn, route }) => { - console.log('Route estimation not implemented'); - - return { - ...route, - estimatedAmount: amountIn, - allowanceAmount: 0n, - approvalGas: 0n, - gas: 0n, - rate: 0, - }; - }, - allowance: async () => { - console.log('Allowance not implemented'); - - return 0n; - }, - estimateApprovalGas: async () => { - console.log('Gas approval estimation not implemented'); - - return 0n; - }, - approve: async () => { - console.log('Approve operation not implemented'); - return null; - }, - swap: async () => { - console.log('Route swap operation not implemented'); - return null; - }, - buttonLabel: defineMessage({ defaultMessage: 'Swap' }), - routeLabel: defineMessage({ defaultMessage: 'Swap' }), -}; - export const oethSwapActions: Record = { 'swap-curve-oeth': { - ...defaultApi, ...SwapCurveOeth, routeLabel: defineMessage({ defaultMessage: 'Swap via Curve' }), buttonLabel: defineMessage({ defaultMessage: 'Swap' }), }, 'swap-curve-oeth-eth': { - ...defaultApi, ...swapCurveOethEth, routeLabel: defineMessage({ defaultMessage: 'Swap via CurvePool' }), buttonLabel: defineMessage({ defaultMessage: 'Swap' }), }, 'swap-curve-oeth-sfrxeth': { - ...defaultApi, ...swapCurveOethSfrxeth, routeLabel: defineMessage({ defaultMessage: 'Swap via Curve' }), buttonLabel: defineMessage({ defaultMessage: 'Swap' }), }, 'swap-zapper-oeth-eth': { - ...defaultApi, ...swapZapperOethEth, routeLabel: defineMessage({ defaultMessage: 'Mint with Vault' }), buttonLabel: defineMessage({ defaultMessage: 'Mint' }), }, 'swap-zapper-oeth-sfrxeth': { - ...defaultApi, ...swapZapperOethSfrxeth, routeLabel: defineMessage({ defaultMessage: 'Mint with Vault' }), buttonLabel: defineMessage({ defaultMessage: 'Mint' }), }, 'mint-vault-oeth': { - ...defaultApi, ...mintVaultOeth, routeLabel: defineMessage({ defaultMessage: 'Mint with Vault' }), buttonLabel: defineMessage({ defaultMessage: 'Mint' }), }, 'wrap-oeth-oeth': { - ...defaultApi, ...wrapOethWoeth, routeLabel: defineMessage({ defaultMessage: 'Wrap with Origin' }), buttonLabel: defineMessage({ defaultMessage: 'Wrap' }), }, 'unwrap-oeth-woeth': { - ...defaultApi, ...unwrapOethWoeth, routeLabel: defineMessage({ defaultMessage: 'Unwrap with Origin' }), buttonLabel: defineMessage({ defaultMessage: 'Unwrap' }), diff --git a/libs/defi/ousd/src/swap/actions.ts b/libs/defi/ousd/src/swap/actions.ts index a432286cb..9e9f466d4 100644 --- a/libs/defi/ousd/src/swap/actions.ts +++ b/libs/defi/ousd/src/swap/actions.ts @@ -14,92 +14,38 @@ import type { SwapApi } from '@origin/shared/providers'; import type { OusdSwapAction } from './types'; -const defaultApi: SwapApi = { - isRouteAvailable: async () => true, - estimateAmount: async (config, { amountIn }) => { - console.log('Amount estimation not implemented'); - - return amountIn; - }, - estimateGas: async () => { - console.log('Gas estimation not implemented'); - - return 0n; - }, - estimateRoute: async (config, { amountIn, route }) => { - console.log('Route estimation not implemented'); - - return { - ...route, - estimatedAmount: amountIn, - allowanceAmount: 0n, - approvalGas: 0n, - gas: 0n, - rate: 0, - }; - }, - allowance: async () => { - console.log('Allowance not implemented'); - - return 0n; - }, - estimateApprovalGas: async () => { - console.log('Gas approval estimation not implemented'); - - return 0n; - }, - approve: async () => { - console.log('Approve operation not implemented'); - return null; - }, - swap: async () => { - console.log('Route swap operation not implemented'); - return null; - }, - routeLabel: defineMessage({ defaultMessage: 'Swap' }), - buttonLabel: defineMessage({ defaultMessage: 'Swap' }), -}; - export const ousdSwapActions: Record = { 'swap-flipper-ousd': { - ...defaultApi, ...swapFlipperOusd, routeLabel: defineMessage({ defaultMessage: 'Swap via Flipper' }), }, 'mint-vault-ousd': { - ...defaultApi, ...mintVaultOusd, routeLabel: defineMessage({ defaultMessage: 'Mint with Vault' }), buttonLabel: defineMessage({ defaultMessage: 'Mint' }), }, 'swap-sushiswap-ousd': { - ...defaultApi, ...swapSushiswapOusd, routeLabel: defineMessage({ defaultMessage: 'Swap via SushiSwap' }), }, 'swap-curve-ousd': { - ...defaultApi, ...swapCurveOusd, routeLabel: defineMessage({ defaultMessage: 'Swap via Curve' }), }, 'swap-uniswap-v2-ousd': { - ...defaultApi, ...swapUniswapV2Ousd, routeLabel: defineMessage({ defaultMessage: 'Swap via Uniswap V2' }), }, 'swap-uniswap-v3-ousd': { - ...defaultApi, ...swapUniswapV3Ousd, routeLabel: defineMessage({ defaultMessage: 'Swap via Uniswap V3' }), }, 'wrap-ousd-wousd': { - ...defaultApi, ...wrapOusdWousd, routeLabel: defineMessage({ defaultMessage: 'Wrap with Origin' }), buttonLabel: defineMessage({ defaultMessage: 'Wrap' }), }, 'unwrap-ousd-wousd': { - ...defaultApi, ...unwrapOusdWousd, routeLabel: defineMessage({ defaultMessage: 'Unwrap with Origin' }), buttonLabel: defineMessage({ defaultMessage: 'Unwrap' }), diff --git a/libs/oeth/redeem/src/actions.ts b/libs/oeth/redeem/src/actions.ts index afa8cae87..be64853b2 100644 --- a/libs/oeth/redeem/src/actions.ts +++ b/libs/oeth/redeem/src/actions.ts @@ -5,61 +5,13 @@ import type { SwapApi } from '@origin/shared/providers'; import type { OethRedeemAction } from './types'; -const defaultApi: SwapApi = { - isRouteAvailable: async () => true, - estimateAmount: async (config, { amountIn }) => { - console.log('Amount estimation not implemented'); - - return amountIn; - }, - estimateGas: async () => { - console.log('Gas estimation not implemented'); - - return 0n; - }, - estimateRoute: async (config, { amountIn, route }) => { - console.log('Route estimation not implemented'); - - return { - ...route, - estimatedAmount: amountIn, - allowanceAmount: 0n, - approvalGas: 0n, - gas: 0n, - rate: 0, - }; - }, - allowance: async () => { - console.log('Allowance not implemented'); - - return 0n; - }, - estimateApprovalGas: async () => { - console.log('Gas approval estimation not implemented'); - - return 0n; - }, - approve: async () => { - console.log('Approve operation not implemented'); - return null; - }, - swap: async () => { - console.log('Route swap operation not implemented'); - return null; - }, - buttonLabel: defineMessage({ defaultMessage: 'Redeem' }), - routeLabel: defineMessage({ defaultMessage: 'Redeem' }), -}; - export const redeemActions: Record = { 'swap-curve-oeth': { - ...defaultApi, ...SwapCurveOeth, routeLabel: defineMessage({ defaultMessage: 'Swap via Curve' }), buttonLabel: defineMessage({ defaultMessage: 'Redeem' }), }, 'redeem-vault-oeth': { - ...defaultApi, ...redeemVaultOeth, routeLabel: defineMessage({ defaultMessage: 'Redeem via OETH Vault' }), buttonLabel: defineMessage({ defaultMessage: 'Redeem' }), diff --git a/libs/oeth/swap/src/actions.ts b/libs/oeth/swap/src/actions.ts index b7be6b886..7f6b0414d 100644 --- a/libs/oeth/swap/src/actions.ts +++ b/libs/oeth/swap/src/actions.ts @@ -14,97 +14,43 @@ import type { SwapApi } from '@origin/shared/providers'; import type { OethSwapAction } from './types'; -const defaultApi: SwapApi = { - isRouteAvailable: async () => true, - estimateAmount: async (config, { amountIn }) => { - console.log('Amount estimation not implemented'); - - return amountIn; - }, - estimateGas: async () => { - console.log('Gas estimation not implemented'); - - return 0n; - }, - estimateRoute: async (config, { amountIn, route }) => { - console.log('Route estimation not implemented'); - - return { - ...route, - estimatedAmount: amountIn, - allowanceAmount: 0n, - approvalGas: 0n, - gas: 0n, - rate: 0, - }; - }, - allowance: async () => { - console.log('Allowance not implemented'); - - return 0n; - }, - estimateApprovalGas: async () => { - console.log('Gas approval estimation not implemented'); - - return 0n; - }, - approve: async () => { - console.log('Approve operation not implemented'); - return null; - }, - swap: async () => { - console.log('Route swap operation not implemented'); - return null; - }, - buttonLabel: defineMessage({ defaultMessage: 'Swap' }), - routeLabel: defineMessage({ defaultMessage: 'Swap' }), -}; - export const swapActions: Record = { 'swap-curve-oeth': { - ...defaultApi, ...SwapCurveOeth, routeLabel: defineMessage({ defaultMessage: 'Swap via Curve' }), buttonLabel: defineMessage({ defaultMessage: 'Swap' }), }, 'swap-curve-oeth-eth': { - ...defaultApi, ...swapCurveOethEth, routeLabel: defineMessage({ defaultMessage: 'Swap via CurvePool' }), buttonLabel: defineMessage({ defaultMessage: 'Swap' }), }, 'swap-curve-oeth-sfrxeth': { - ...defaultApi, ...swapCurveOethSfrxeth, routeLabel: defineMessage({ defaultMessage: 'Swap via Curve' }), buttonLabel: defineMessage({ defaultMessage: 'Swap' }), }, 'swap-zapper-oeth-eth': { - ...defaultApi, ...swapZapperOethEth, routeLabel: defineMessage({ defaultMessage: 'Mint with Vault' }), buttonLabel: defineMessage({ defaultMessage: 'Mint' }), }, 'swap-zapper-oeth-sfrxeth': { - ...defaultApi, ...swapZapperOethSfrxeth, routeLabel: defineMessage({ defaultMessage: 'Mint with Vault' }), buttonLabel: defineMessage({ defaultMessage: 'Mint' }), }, 'mint-vault-oeth': { - ...defaultApi, ...mintVaultOeth, routeLabel: defineMessage({ defaultMessage: 'Mint with Vault' }), buttonLabel: defineMessage({ defaultMessage: 'Mint' }), }, 'wrap-oeth-oeth': { - ...defaultApi, ...wrapOethWoeth, routeLabel: defineMessage({ defaultMessage: 'Wrap with Origin' }), buttonLabel: defineMessage({ defaultMessage: 'Wrap' }), }, 'unwrap-oeth-woeth': { - ...defaultApi, ...unwrapOethWoeth, routeLabel: defineMessage({ defaultMessage: 'Unwrap with Origin' }), buttonLabel: defineMessage({ defaultMessage: 'Unwrap' }), diff --git a/libs/ousd/swap/src/actions.ts b/libs/ousd/swap/src/actions.ts index 19ad155d7..ffee36fb0 100644 --- a/libs/ousd/swap/src/actions.ts +++ b/libs/ousd/swap/src/actions.ts @@ -14,92 +14,38 @@ import type { SwapApi } from '@origin/shared/providers'; import type { SwapAction } from './types'; -const defaultApi: SwapApi = { - isRouteAvailable: async () => true, - estimateAmount: async (config, { amountIn }) => { - console.log('Amount estimation not implemented'); - - return amountIn; - }, - estimateGas: async () => { - console.log('Gas estimation not implemented'); - - return 0n; - }, - estimateRoute: async (config, { amountIn, route }) => { - console.log('Route estimation not implemented'); - - return { - ...route, - estimatedAmount: amountIn, - allowanceAmount: 0n, - approvalGas: 0n, - gas: 0n, - rate: 0, - }; - }, - allowance: async () => { - console.log('Allowance not implemented'); - - return 0n; - }, - estimateApprovalGas: async () => { - console.log('Gas approval estimation not implemented'); - - return 0n; - }, - approve: async () => { - console.log('Approve operation not implemented'); - return null; - }, - swap: async () => { - console.log('Route swap operation not implemented'); - return null; - }, - routeLabel: defineMessage({ defaultMessage: 'Swap' }), - buttonLabel: defineMessage({ defaultMessage: 'Swap' }), -}; - export const swapActions: Record = { 'swap-flipper-ousd': { - ...defaultApi, ...swapFlipperOusd, routeLabel: defineMessage({ defaultMessage: 'Swap via Flipper' }), }, 'mint-vault-ousd': { - ...defaultApi, ...mintVaultOusd, routeLabel: defineMessage({ defaultMessage: 'Mint with Vault' }), buttonLabel: defineMessage({ defaultMessage: 'Mint' }), }, 'swap-sushiswap-ousd': { - ...defaultApi, ...swapSushiswapOusd, routeLabel: defineMessage({ defaultMessage: 'Swap via SushiSwap' }), }, 'swap-curve-ousd': { - ...defaultApi, ...swapCurveOusd, routeLabel: defineMessage({ defaultMessage: 'Swap via Curve' }), }, 'swap-uniswap-v2-ousd': { - ...defaultApi, ...swapUniswapV2Ousd, routeLabel: defineMessage({ defaultMessage: 'Swap via Uniswap V2' }), }, 'swap-uniswap-v3-ousd': { - ...defaultApi, ...swapUniswapV3Ousd, routeLabel: defineMessage({ defaultMessage: 'Swap via Uniswap V3' }), }, 'wrap-ousd-wousd': { - ...defaultApi, ...wrapOusdWousd, routeLabel: defineMessage({ defaultMessage: 'Wrap with Origin' }), buttonLabel: defineMessage({ defaultMessage: 'Wrap' }), }, 'unwrap-ousd-wousd': { - ...defaultApi, ...unwrapOusdWousd, routeLabel: defineMessage({ defaultMessage: 'Unwrap with Origin' }), buttonLabel: defineMessage({ defaultMessage: 'Unwrap' }), diff --git a/libs/prime/restake/src/actions.ts b/libs/prime/restake/src/actions.ts index 4facd2819..266969726 100644 --- a/libs/prime/restake/src/actions.ts +++ b/libs/prime/restake/src/actions.ts @@ -9,65 +9,20 @@ import type { SwapApi } from '@origin/shared/providers'; import type { RestakeAction } from './types'; -const defaultApi: SwapApi = { - isRouteAvailable: async () => true, - estimateAmount: async (config, { amountIn }) => { - console.log('Amount estimation not implemented'); - - return amountIn; - }, - estimateGas: async () => { - console.log('Gas estimation not implemented'); - - return 0n; - }, - estimateRoute: async (config, { amountIn, route }) => { - console.log('Route estimation not implemented'); - - return { - ...route, - estimatedAmount: amountIn, - allowanceAmount: 0n, - approvalGas: 0n, - gas: 0n, - rate: 0, - }; - }, - allowance: async () => { - console.log('Allowance not implemented'); - - return 0n; - }, - estimateApprovalGas: async () => { - console.log('Gas approval estimation not implemented'); - - return 0n; - }, - approve: async () => { - console.log('Approve operation not implemented'); - return null; - }, - swap: async () => { - console.log('Route swap operation not implemented'); - return null; - }, - buttonLabel: defineMessage({ defaultMessage: 'Stake' }), - routeLabel: defineMessage({ defaultMessage: 'PrimeStaked' }), -}; - export const restakeActions: Record = { 'restake-prime': { - ...defaultApi, ...restakePrime, + buttonLabel: defineMessage({ defaultMessage: 'Stake' }), + routeLabel: defineMessage({ defaultMessage: 'PrimeStaked' }), }, 'swap-uniswap-prime': { - ...defaultApi, ...swapUniswapPrime, buttonLabel: defineMessage({ defaultMessage: 'Swap with Uniswap' }), routeLabel: defineMessage({ defaultMessage: 'Uniswap V3' }), }, 'swap-zapper-prime': { - ...defaultApi, ...swapZapperPrime, + buttonLabel: defineMessage({ defaultMessage: 'Stake' }), + routeLabel: defineMessage({ defaultMessage: 'PrimeStaked' }), }, }; diff --git a/libs/shared/routes/src/defaultRoute.ts b/libs/shared/routes/src/defaultRoute.ts new file mode 100644 index 000000000..2daf60b2d --- /dev/null +++ b/libs/shared/routes/src/defaultRoute.ts @@ -0,0 +1,49 @@ +import { defineMessage } from 'react-intl'; + +import type { SwapApi } from '@origin/shared/providers'; + +export const defaultRoute: SwapApi = { + isRouteAvailable: async () => true, + estimateAmount: async (config, { amountIn }) => { + console.log('Amount estimation not implemented'); + + return amountIn; + }, + estimateGas: async () => { + console.log('Gas estimation not implemented'); + + return 0n; + }, + estimateRoute: async (config, { amountIn, route }) => { + console.log('Route estimation not implemented'); + + return { + ...route, + estimatedAmount: amountIn, + allowanceAmount: 0n, + approvalGas: 0n, + gas: 0n, + rate: 0, + }; + }, + allowance: async () => { + console.log('Allowance not implemented'); + + return 0n; + }, + estimateApprovalGas: async () => { + console.log('Gas approval estimation not implemented'); + + return 0n; + }, + approve: async () => { + console.log('Approve operation not implemented'); + return null; + }, + swap: async () => { + console.log('Route swap operation not implemented'); + return null; + }, + buttonLabel: defineMessage({ defaultMessage: 'Swap' }), + routeLabel: defineMessage({ defaultMessage: 'Swap' }), +}; diff --git a/libs/shared/routes/src/oeth/mintVaultOeth.ts b/libs/shared/routes/src/oeth/mintVaultOeth.ts index 11f218f8f..e16ea1bd6 100644 --- a/libs/shared/routes/src/oeth/mintVaultOeth.ts +++ b/libs/shared/routes/src/oeth/mintVaultOeth.ts @@ -12,6 +12,7 @@ import { import { erc20Abi, formatUnits, parseUnits } from 'viem'; import { GAS_BUFFER } from '../constants'; +import { defaultRoute } from '../defaultRoute'; import type { Allowance, @@ -285,6 +286,7 @@ const swap: Swap = async ( }; export const mintVaultOeth = { + ...defaultRoute, isRouteAvailable, estimateAmount, estimateGas, diff --git a/libs/shared/routes/src/oeth/redeemVaultOeth.ts b/libs/shared/routes/src/oeth/redeemVaultOeth.ts index 1c9f86483..133144cea 100644 --- a/libs/shared/routes/src/oeth/redeemVaultOeth.ts +++ b/libs/shared/routes/src/oeth/redeemVaultOeth.ts @@ -11,6 +11,7 @@ import { import { erc20Abi, formatUnits, maxUint256 } from 'viem'; import { GAS_BUFFER } from '../constants'; +import { defaultRoute } from '../defaultRoute'; import type { Allowance, @@ -211,6 +212,7 @@ const swap: Swap = async ( }; export const redeemVaultOeth = { + ...defaultRoute, isRouteAvailable, estimateAmount, estimateGas, diff --git a/libs/shared/routes/src/oeth/swapCurveOeth/index.ts b/libs/shared/routes/src/oeth/swapCurveOeth/index.ts index 25f1bf65b..e4a0a620f 100644 --- a/libs/shared/routes/src/oeth/swapCurveOeth/index.ts +++ b/libs/shared/routes/src/oeth/swapCurveOeth/index.ts @@ -20,6 +20,7 @@ import { path } from 'ramda'; import { erc20Abi, formatUnits, maxUint256 } from 'viem'; import { GAS_BUFFER } from '../../constants'; +import { defaultRoute } from '../../defaultRoute'; import { curveRoutes } from './curveRoutes'; import type { @@ -330,6 +331,7 @@ const swap: Swap = async ( }; export const SwapCurveOeth = { + ...defaultRoute, estimateAmount, estimateGas, estimateRoute, diff --git a/libs/shared/routes/src/oeth/swapCurveOethEth.ts b/libs/shared/routes/src/oeth/swapCurveOethEth.ts index 123dead73..bbd999994 100644 --- a/libs/shared/routes/src/oeth/swapCurveOethEth.ts +++ b/libs/shared/routes/src/oeth/swapCurveOethEth.ts @@ -14,6 +14,7 @@ import { import { formatUnits, isAddressEqual, maxUint256 } from 'viem'; import { GAS_BUFFER } from '../constants'; +import { defaultRoute } from '../defaultRoute'; import type { Allowance, @@ -227,6 +228,7 @@ const swap: Swap = async ( }; export const swapCurveOethEth = { + ...defaultRoute, estimateAmount, estimateGas, estimateRoute, diff --git a/libs/shared/routes/src/oeth/swapCurveOethSfrxeth.ts b/libs/shared/routes/src/oeth/swapCurveOethSfrxeth.ts index b805e7d4c..e6e8ab616 100644 --- a/libs/shared/routes/src/oeth/swapCurveOethSfrxeth.ts +++ b/libs/shared/routes/src/oeth/swapCurveOethSfrxeth.ts @@ -15,6 +15,7 @@ import { import { erc20Abi, formatUnits } from 'viem'; import { GAS_BUFFER } from '../constants'; +import { defaultRoute } from '../defaultRoute'; import type { Allowance, @@ -252,6 +253,7 @@ const swap: Swap = async ( }; export const swapCurveOethSfrxeth = { + ...defaultRoute, estimateAmount, estimateGas, estimateRoute, diff --git a/libs/shared/routes/src/oeth/swapZapperOethEth.ts b/libs/shared/routes/src/oeth/swapZapperOethEth.ts index 89386991a..c15ae5a06 100644 --- a/libs/shared/routes/src/oeth/swapZapperOethEth.ts +++ b/libs/shared/routes/src/oeth/swapZapperOethEth.ts @@ -11,6 +11,7 @@ import { import { erc20Abi, formatUnits, maxUint256 } from 'viem'; import { GAS_BUFFER } from '../constants'; +import { defaultRoute } from '../defaultRoute'; import type { Allowance, @@ -205,6 +206,7 @@ const swap: Swap = async ( }; export const swapZapperOethEth = { + ...defaultRoute, estimateAmount, estimateGas, estimateRoute, diff --git a/libs/shared/routes/src/oeth/swapZapperOethSfrxeth.ts b/libs/shared/routes/src/oeth/swapZapperOethSfrxeth.ts index 4c462feee..28973b4e3 100644 --- a/libs/shared/routes/src/oeth/swapZapperOethSfrxeth.ts +++ b/libs/shared/routes/src/oeth/swapZapperOethSfrxeth.ts @@ -12,6 +12,7 @@ import { import { erc20Abi, formatUnits, maxUint256, parseUnits } from 'viem'; import { GAS_BUFFER } from '../constants'; +import { defaultRoute } from '../defaultRoute'; import type { Allowance, @@ -229,6 +230,7 @@ const swap: Swap = async ( }; export const swapZapperOethSfrxeth = { + ...defaultRoute, estimateAmount, estimateGas, estimateRoute, diff --git a/libs/shared/routes/src/oeth/unwrapOethWoeth.ts b/libs/shared/routes/src/oeth/unwrapOethWoeth.ts index 5a04cd8ee..ed80173ed 100644 --- a/libs/shared/routes/src/oeth/unwrapOethWoeth.ts +++ b/libs/shared/routes/src/oeth/unwrapOethWoeth.ts @@ -8,6 +8,8 @@ import { } from '@wagmi/core'; import { formatUnits, maxUint256 } from 'viem'; +import { defaultRoute } from '../defaultRoute'; + import type { Allowance, Approve, @@ -148,6 +150,7 @@ const swap: Swap = async ({ config }, { amountIn }) => { }; export const unwrapOethWoeth = { + ...defaultRoute, estimateAmount, estimateGas, estimateRoute, diff --git a/libs/shared/routes/src/oeth/wrapOethWoeth.ts b/libs/shared/routes/src/oeth/wrapOethWoeth.ts index 346b79f9c..8d479d7f4 100644 --- a/libs/shared/routes/src/oeth/wrapOethWoeth.ts +++ b/libs/shared/routes/src/oeth/wrapOethWoeth.ts @@ -10,6 +10,8 @@ import { } from '@wagmi/core'; import { erc20Abi, formatUnits } from 'viem'; +import { defaultRoute } from '../defaultRoute'; + import type { Allowance, Approve, @@ -213,6 +215,7 @@ const swap: Swap = async ( }; export const wrapOethWoeth = { + ...defaultRoute, estimateAmount, estimateGas, estimateRoute, diff --git a/libs/shared/routes/src/ousd/mintVaultOusd.ts b/libs/shared/routes/src/ousd/mintVaultOusd.ts index f09c1c65e..eaaaa36b0 100644 --- a/libs/shared/routes/src/ousd/mintVaultOusd.ts +++ b/libs/shared/routes/src/ousd/mintVaultOusd.ts @@ -16,6 +16,7 @@ import { import { formatUnits, parseUnits } from 'viem'; import { GAS_BUFFER } from '../constants'; +import { defaultRoute } from '../defaultRoute'; import type { Allowance, @@ -298,6 +299,7 @@ const swap: Swap = async ( }; export const mintVaultOusd = { + ...defaultRoute, isRouteAvailable, estimateAmount, estimateGas, diff --git a/libs/shared/routes/src/ousd/swapCurveOusd.ts b/libs/shared/routes/src/ousd/swapCurveOusd.ts index 45f948476..943731ff8 100644 --- a/libs/shared/routes/src/ousd/swapCurveOusd.ts +++ b/libs/shared/routes/src/ousd/swapCurveOusd.ts @@ -18,6 +18,7 @@ import { import { formatUnits } from 'viem'; import { GAS_BUFFER, MAX_PRICE } from '../constants'; +import { defaultRoute } from '../defaultRoute'; import type { Allowance, @@ -308,6 +309,7 @@ const swap: Swap = async ( }; export const swapCurveOusd = { + ...defaultRoute, isRouteAvailable, estimateAmount, estimateGas, diff --git a/libs/shared/routes/src/ousd/swapFlipperOusd.ts b/libs/shared/routes/src/ousd/swapFlipperOusd.ts index 8fe4a0220..1117706d0 100644 --- a/libs/shared/routes/src/ousd/swapFlipperOusd.ts +++ b/libs/shared/routes/src/ousd/swapFlipperOusd.ts @@ -10,6 +10,8 @@ import { } from '@wagmi/core'; import { formatUnits } from 'viem'; +import { defaultRoute } from '../defaultRoute'; + import type { Token } from '@origin/shared/contracts'; import type { Allowance, @@ -217,6 +219,7 @@ const swap: Swap = async ( }; export const swapFlipperOusd = { + ...defaultRoute, isRouteAvailable, estimateAmount, estimateGas, diff --git a/libs/shared/routes/src/ousd/swapSushiswapOusd.ts b/libs/shared/routes/src/ousd/swapSushiswapOusd.ts index 677a995e3..5c2ca151e 100644 --- a/libs/shared/routes/src/ousd/swapSushiswapOusd.ts +++ b/libs/shared/routes/src/ousd/swapSushiswapOusd.ts @@ -12,6 +12,7 @@ import { last } from 'ramda'; import { formatUnits } from 'viem'; import { GAS_BUFFER, MAX_PRICE } from '../constants'; +import { defaultRoute } from '../defaultRoute'; import type { Token } from '@origin/shared/contracts'; import type { @@ -308,6 +309,7 @@ const swap: Swap = async ( }; export const swapSushiswapOusd = { + ...defaultRoute, isRouteAvailable, estimateAmount, estimateGas, diff --git a/libs/shared/routes/src/ousd/swapUniswapV2Ousd.ts b/libs/shared/routes/src/ousd/swapUniswapV2Ousd.ts index 53aa67f1b..000c73b82 100644 --- a/libs/shared/routes/src/ousd/swapUniswapV2Ousd.ts +++ b/libs/shared/routes/src/ousd/swapUniswapV2Ousd.ts @@ -16,6 +16,7 @@ import { last } from 'ramda'; import { formatUnits } from 'viem'; import { GAS_BUFFER, MAX_PRICE } from '../constants'; +import { defaultRoute } from '../defaultRoute'; import type { Token } from '@origin/shared/contracts'; import type { @@ -310,6 +311,7 @@ const swap: Swap = async ( }; export const swapUniswapV2Ousd = { + ...defaultRoute, isRouteAvailable, estimateAmount, estimateGas, diff --git a/libs/shared/routes/src/ousd/swapUniswapV3Ousd.ts b/libs/shared/routes/src/ousd/swapUniswapV3Ousd.ts index f5ff9895c..8d5f273f2 100644 --- a/libs/shared/routes/src/ousd/swapUniswapV3Ousd.ts +++ b/libs/shared/routes/src/ousd/swapUniswapV3Ousd.ts @@ -14,6 +14,8 @@ import { } from '@wagmi/core'; import { encodePacked, formatUnits } from 'viem'; +import { defaultRoute } from '../defaultRoute'; + import type { Token } from '@origin/shared/contracts'; import type { Allowance, @@ -358,6 +360,7 @@ const swap: Swap = async ( }; export const swapUniswapV3Ousd = { + ...defaultRoute, isRouteAvailable, estimateAmount, estimateGas, diff --git a/libs/shared/routes/src/ousd/unwrapOusdWousd.ts b/libs/shared/routes/src/ousd/unwrapOusdWousd.ts index 4289fdaec..aa9ddcaa4 100644 --- a/libs/shared/routes/src/ousd/unwrapOusdWousd.ts +++ b/libs/shared/routes/src/ousd/unwrapOusdWousd.ts @@ -8,6 +8,8 @@ import { } from '@wagmi/core'; import { formatUnits, maxUint256 } from 'viem'; +import { defaultRoute } from '../defaultRoute'; + import type { Allowance, Approve, @@ -146,6 +148,7 @@ const swap: Swap = async ({ config }, { amountIn }) => { }; export const unwrapOusdWousd = { + ...defaultRoute, estimateAmount, estimateGas, estimateRoute, diff --git a/libs/shared/routes/src/ousd/wrapOusdWousd.ts b/libs/shared/routes/src/ousd/wrapOusdWousd.ts index 7f3c46722..65a89bafc 100644 --- a/libs/shared/routes/src/ousd/wrapOusdWousd.ts +++ b/libs/shared/routes/src/ousd/wrapOusdWousd.ts @@ -10,6 +10,8 @@ import { } from '@wagmi/core'; import { erc20Abi, formatUnits } from 'viem'; +import { defaultRoute } from '../defaultRoute'; + import type { Allowance, Approve, @@ -207,6 +209,7 @@ const swap: Swap = async ( }; export const wrapOusdWousd = { + ...defaultRoute, estimateAmount, estimateGas, estimateRoute, diff --git a/libs/shared/routes/src/prime/restakePrime.ts b/libs/shared/routes/src/prime/restakePrime.ts index 4729d6fd8..b3775fadb 100644 --- a/libs/shared/routes/src/prime/restakePrime.ts +++ b/libs/shared/routes/src/prime/restakePrime.ts @@ -17,6 +17,8 @@ import { } from '@wagmi/core'; import { formatUnits } from 'viem'; +import { defaultRoute } from '../defaultRoute'; + import type { Allowance, Approve, @@ -234,6 +236,7 @@ const swap: Swap = async ( }; export const restakePrime = { + ...defaultRoute, isRouteAvailable, estimateAmount, estimateRoute, diff --git a/libs/shared/routes/src/prime/swapUniwsapPrime.ts b/libs/shared/routes/src/prime/swapUniwsapPrime.ts index ae9934528..258f14b87 100644 --- a/libs/shared/routes/src/prime/swapUniwsapPrime.ts +++ b/libs/shared/routes/src/prime/swapUniwsapPrime.ts @@ -9,6 +9,8 @@ import { } from '@wagmi/core'; import { formatUnits, maxUint256 } from 'viem'; +import { defaultRoute } from '../defaultRoute'; + import type { Allowance, EstimateAmount, @@ -163,6 +165,7 @@ const swap: Swap = async ( }; export const swapUniswapPrime = { + ...defaultRoute, isRouteAvailable, estimateAmount, estimateGas, diff --git a/libs/shared/routes/src/prime/swapZapperPrime.ts b/libs/shared/routes/src/prime/swapZapperPrime.ts index e98ed0e50..981b9558a 100644 --- a/libs/shared/routes/src/prime/swapZapperPrime.ts +++ b/libs/shared/routes/src/prime/swapZapperPrime.ts @@ -5,6 +5,8 @@ import { getAccount, simulateContract, writeContract } from '@wagmi/core'; import { div, eq, setDecimals } from 'dnum'; import { formatUnits, maxUint256 } from 'viem'; +import { defaultRoute } from '../defaultRoute'; + import type { Allowance, Approve, @@ -96,6 +98,7 @@ const swap: Swap = async ( }; export const swapZapperPrime = { + ...defaultRoute, estimateAmount, estimateRoute, allowance,