chore: Write encoding rust calldata to file and read in solidity test

This way we can automatically replace the calldata when something changes. We don't need to manually replace the string ourselves.

--- don't change below this line ---
ENG-4453 Took 3 hours 26 minutes
This commit is contained in:
Diana Carvalho
2025-04-29 10:23:47 +01:00
parent b03c58d833
commit 0ff4aef0c7
16 changed files with 277 additions and 153 deletions

View File

@@ -1,14 +1,15 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.26;
import {EkuboExecutor, TokenTransfer} from "@src/executors/EkuboExecutor.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../TestUtils.sol";
import {Constants} from "../Constants.sol";
import {Test, console} from "forge-std/Test.sol";
import {NATIVE_TOKEN_ADDRESS} from "@ekubo/math/constants.sol";
import {EkuboExecutor, TokenTransfer} from "@src/executors/EkuboExecutor.sol";
import {ICore} from "@ekubo/interfaces/ICore.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {NATIVE_TOKEN_ADDRESS} from "@ekubo/math/constants.sol";
import {console} from "forge-std/Test.sol";
contract EkuboExecutorTest is Test, Constants {
contract EkuboExecutorTest is Constants, TestUtils {
address constant EXECUTOR_ADDRESS =
0xcA4F73Fe97D0B987a0D12B39BBD562c779BAb6f6; // Same address as in swap_encoder.rs tests
EkuboExecutor executor;
@@ -154,8 +155,6 @@ contract EkuboExecutorTest is Test, Constants {
// Data is generated by test case in swap_encoder::tests::ekubo::test_encode_swap_multi
function testMultiHopSwapIntegration() public {
multiHopSwap(
hex"00ca4f73fe97d0b987a0d12b39bbd562c779bab6f60000000000000000000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4851d02a5948496a67827242eabc5725531342527c000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec700000000000000000000000000000000000000000001a36e2eb1c43200000032"
);
multiHopSwap(loadCallDataFromFile("test_ekubo_encode_swap_multi"));
}
}