Skip to content

Commit da8723b

Browse files
committed
feat: refactor mTBILL strategy to handle all midas assets
1 parent 46031b1 commit da8723b

File tree

6 files changed

+415
-241
lines changed

6 files changed

+415
-241
lines changed

src/common/utils/viemClients.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import dotenv from "dotenv"
2+
dotenv.config()
3+
14
import {
25
http,
36
type Chain,

src/server.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ import { swapRouter } from "@/api/routes/swap/swapRouter"
99
import errorHandler from "@/common/middleware/errorHandler"
1010
import rateLimiter from "@/common/middleware/rateLimiter"
1111
import requestLogger from "@/common/middleware/requestLogger"
12-
import dotenv from "dotenv"
13-
14-
dotenv.config()
1512

1613
const logger = pino({ name: "server start" })
1714
const app: Express = express()

src/swapService/config/mainnet.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ import {
33
StrategyBalmySDK,
44
StrategyCombinedUniswap,
55
StrategyERC4626Wrapper,
6-
StrategyMTBILL,
6+
StrategyMidas,
77
StrategyRepayWrapper,
88
} from "../strategies"
9-
import { MTBILL_MAINNET } from "../strategies/strategyMTBILL"
109

1110
const SUSDS_MAINNET = "0xa3931d71877c0e7a3148cb7eb4463524fec27fbd"
1211
const EBTC_MAINNET = "0x657e8c867d8b37dcc18fa4caead9c45eb088c642"
@@ -35,10 +34,8 @@ const mainnetRoutingConfig: ChainRoutingConfig = [
3534
match: { isPendlePT: true },
3635
},
3736
{
38-
strategy: StrategyMTBILL.name(),
39-
match: {
40-
tokensInOrOut: [MTBILL_MAINNET],
41-
},
37+
strategy: StrategyMidas.name(),
38+
match: {}, // supports function will match mTokens
4239
},
4340
{
4441
strategy: StrategyERC4626Wrapper.name(),

src/swapService/strategies/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import { StrategyBalmySDK } from "./strategyBalmySDK"
33
import { StrategyCombinedUniswap } from "./strategyCombinedUniswap"
44
import { StrategyERC4626Wrapper } from "./strategyERC4626Wrapper"
55
import { StrategyLifi } from "./strategyLifi"
6-
import { StrategyMTBILL } from "./strategyMTBILL"
6+
import { StrategyMidas } from "./strategyMidas"
77
import { StrategyPendle } from "./strategyPendle"
88
import { StrategyRepayWrapper } from "./strategyRepayWrapper"
99

1010
export {
1111
Strategy1Inch,
1212
StrategyCombinedUniswap,
13-
StrategyMTBILL,
13+
StrategyMidas,
1414
StrategyPendle,
1515
StrategyLifi,
1616
StrategyRepayWrapper,
@@ -21,7 +21,7 @@ export {
2121
export const strategies = {
2222
[Strategy1Inch.name()]: Strategy1Inch,
2323
[StrategyPendle.name()]: StrategyPendle,
24-
[StrategyMTBILL.name()]: StrategyMTBILL,
24+
[StrategyMidas.name()]: StrategyMidas,
2525
[StrategyCombinedUniswap.name()]: StrategyCombinedUniswap,
2626
[StrategyRepayWrapper.name()]: StrategyRepayWrapper,
2727
[StrategyBalmySDK.name()]: StrategyBalmySDK,

src/swapService/strategies/strategyERC4626Wrapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const defaultConfig: {
4141
asset: "0x66a1E37c9b0eAddca17d3662D6c05F4DECf3e110",
4242
assetDustEVault: "0x3a8992754e2ef51d8f90620d2766278af5c59b90",
4343
},
44-
// // {
44+
// {
4545
// chainId: 1,
4646
// protocol: "sUSDS",
4747
// vault: "0xa3931d71877C0E7a3148CB7Eb4463524FEc27fbD",

0 commit comments

Comments
 (0)