From b57c615ad74d2cc0472ecde1ee483a9c237cf2b0 Mon Sep 17 00:00:00 2001 From: Siddharth2207 Date: Fri, 27 Mar 2026 18:19:24 +0530 Subject: [PATCH 1/2] fix: use withdraw4 for Orderbook V6 in intra-orderbook calldata The getCalldata dispatch was falling through to getCalldataForV4Order for all V4 orders, which hardcodes withdraw3 (V5). V6 replaced withdraw3 with withdraw4, causing a revert. Added getCalldataForV4OrderV6 using the V6 ABI and updated the dispatch to route V6 pairs correctly. Co-Authored-By: Claude Sonnet 4.6 --- src/core/modes/intra/simulation.ts | 62 +++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/src/core/modes/intra/simulation.ts b/src/core/modes/intra/simulation.ts index acb3a023..03043494 100644 --- a/src/core/modes/intra/simulation.ts +++ b/src/core/modes/intra/simulation.ts @@ -265,7 +265,65 @@ export class IntraOrderbookTradeSimulator extends TradeSimulatorBase { } /** - * Builds the calldata for v4 order + * Builds the calldata for v4 order on Orderbook V6 + * @param task - The ensure withdraw bounty task object + */ + getCalldataForV4OrderV6(task: TaskType): `0x${string}` { + const withdrawInputCalldata = encodeFunctionData({ + abi: ABI.Orderbook.V6.Primary.Orderbook, + functionName: "withdraw4", + args: [ + this.tradeArgs.orderDetails.buyToken, + this.inputBountyVaultId, + maxFloat(this.tradeArgs.orderDetails.buyTokenDecimals), + [], + ], + }); + const withdrawOutputCalldata = encodeFunctionData({ + abi: ABI.Orderbook.V6.Primary.Orderbook, + functionName: "withdraw4", + args: [ + this.tradeArgs.orderDetails.sellToken, + this.outputBountyVaultId, + maxFloat(this.tradeArgs.orderDetails.sellTokenDecimals), + this.tradeArgs.solver.appOptions.gasCoveragePercentage === "0" ? [] : [task], + ], + }); + const clear3Calldata = encodeFunctionData({ + abi: ABI.Orderbook.V6.Primary.Orderbook, + functionName: "clear3", + args: [ + this.tradeArgs.orderDetails.takeOrder.struct.order, + this.tradeArgs.counterpartyOrderDetails.struct.order, + { + aliceInputIOIndex: BigInt( + this.tradeArgs.orderDetails.takeOrder.struct.inputIOIndex, + ), + aliceOutputIOIndex: BigInt( + this.tradeArgs.orderDetails.takeOrder.struct.outputIOIndex, + ), + bobInputIOIndex: BigInt( + this.tradeArgs.counterpartyOrderDetails.struct.inputIOIndex, + ), + bobOutputIOIndex: BigInt( + this.tradeArgs.counterpartyOrderDetails.struct.outputIOIndex, + ), + aliceBountyVaultId: this.inputBountyVaultId, + bobBountyVaultId: this.outputBountyVaultId, + }, + [], + [], + ], + }); + return encodeFunctionData({ + abi: ABI.Orderbook.V6.Primary.Orderbook, + functionName: "multicall", + args: [[clear3Calldata, withdrawInputCalldata, withdrawOutputCalldata]], + }); + } + + /** + * Builds the calldata for v4 order on Orderbook V5 * @param task - The ensure withdraw bounty task object */ getCalldataForV4Order(task: TaskType): `0x${string}` { @@ -329,6 +387,8 @@ export class IntraOrderbookTradeSimulator extends TradeSimulatorBase { getCalldata(task: TaskType): `0x${string}` { if (Pair.isV3(this.tradeArgs.orderDetails)) { return this.getCalldataForV3Order(task); + } else if (Pair.isV4OrderbookV6(this.tradeArgs.orderDetails)) { + return this.getCalldataForV4OrderV6(task); } else { return this.getCalldataForV4Order(task); } From a31dd44c0982b5aa50cea3b67967ce4955cc2ecf Mon Sep 17 00:00:00 2001 From: Siddharth2207 Date: Wed, 1 Apr 2026 21:53:37 +0530 Subject: [PATCH 2/2] bump sushiswap submodule to add cbBTC to Base routing bases Picks up rainlanguage/sushiswap#44 so wtMSTR (and other tokens only paired with cbBTC on Hydrex) can be priced in ETH terms by the solver. Co-Authored-By: Claude Sonnet 4.6 --- lib/sushiswap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sushiswap b/lib/sushiswap index 925a210b..1b2b675e 160000 --- a/lib/sushiswap +++ b/lib/sushiswap @@ -1 +1 @@ -Subproject commit 925a210bcf35d61bea451deb36f0d2079210ca7a +Subproject commit 1b2b675effe0187889d3de66da2048e711a117e2