From 0a8a34be035588d45e6b72a42f4dd691e3c98d2f Mon Sep 17 00:00:00 2001 From: TAMARA LIPOWSKI Date: Wed, 19 Mar 2025 14:27:34 -0400 Subject: [PATCH 1/7] feat: Support sushiswap v2 and pancakeswap v2 on ethereum - Needed to take pool code init hash as input param for executors - Added tests for ethereum. Will test base on-chain. --- foundry/scripts/deploy-executors.js | 33 +++++++++++++++++-- foundry/src/executors/UniswapV2Executor.sol | 15 +++++---- foundry/test/Constants.sol | 24 +++++++++++++- foundry/test/TychoRouterTestSetup.sol | 3 +- .../test/executors/UniswapV2Executor.t.sol | 24 ++++++++++++-- 5 files changed, 86 insertions(+), 13 deletions(-) diff --git a/foundry/scripts/deploy-executors.js b/foundry/scripts/deploy-executors.js index 00b28b7..a7ac3d6 100644 --- a/foundry/scripts/deploy-executors.js +++ b/foundry/scripts/deploy-executors.js @@ -5,13 +5,42 @@ const hre = require("hardhat"); // Comment out the executors you don't want to deploy const executors_to_deploy = { "ethereum":[ - {exchange: "UniswapV2Executor", args: ["0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f"]}, + // Factory, Pool Init Code Hash + {exchange: "UniswapV2Executor", args: [ + "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f", + "0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f" + ]}, + // Factory, Pool Init Code Hash + {exchange: "SushiSwapV2Executor", args: [ + "0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac", + "0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303" + ]}, + // Factory, Pool Init Code Hash + {exchange: "PancakeSwapV2Executor", args: [ + "0x1097053Fd2ea711dad45caCcc45EfF7548fCB362", + "0x57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d" + ]}, {exchange: "UniswapV3Executor", args: ["0x1F98431c8aD98523631AE4a59f267346ea31F984"]}, {exchange: "UniswapV4Executor", args: ["0x000000000004444c5dc75cB358380D2e3dE08A90"]}, {exchange: "BalancerV2Executor", args: []}, ], "base":[ - {exchange: "UniswapV2Executor", args: ["0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6"]}, + // Factory, Pool Init Code Hash + {exchange: "UniswapV2Executor", args: [ + "0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6", + "0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f" + ]}, + // Factory, Pool Init Code Hash + {exchange: "SushiSwapV2Executor", args: [ + "0x71524B4f93c58fcbF659783284E38825f0622859", + "0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303" + ]}, + // Factory, Pool Init Code Hash + {exchange: "PancakeSwapV2Executor", args: [ + "0x02a84c1b3BBD7401a5f7fa98a384EBC70bB5749E", + "0x57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d" + ]}, + // Factory, Pool Init Code Hash {exchange: "UniswapV3Executor", args: ["0x33128a8fC17869897dcE68Ed026d694621f6FDfD"]}, {exchange: "UniswapV4Executor", args: ["0x498581ff718922c3f8e6a244956af099b2652b2b"]}, {exchange: "BalancerV2Executor", args: []}, diff --git a/foundry/src/executors/UniswapV2Executor.sol b/foundry/src/executors/UniswapV2Executor.sol index 6707ce8..51a33e6 100644 --- a/foundry/src/executors/UniswapV2Executor.sol +++ b/foundry/src/executors/UniswapV2Executor.sol @@ -8,21 +8,24 @@ import "@uniswap-v2/contracts/interfaces/IUniswapV2Pair.sol"; error UniswapV2Executor__InvalidDataLength(); error UniswapV2Executor__InvalidTarget(); error UniswapV2Executor__InvalidFactory(); +error UniswapV2Executor__InvalidInitCode(); contract UniswapV2Executor is IExecutor { using SafeERC20 for IERC20; - bytes32 internal constant POOL_INIT_CODE_HASH = - 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f; - address public immutable factory; + bytes32 public immutable init_code; address private immutable self; - constructor(address _factory) { + constructor(address _factory, bytes32 _init_code) { if (_factory == address(0)) { revert UniswapV2Executor__InvalidFactory(); } + if (_init_code == bytes32(0)) { + revert UniswapV2Executor__InvalidInitCode(); + } factory = _factory; + init_code = _init_code; self = address(this); } @@ -102,9 +105,7 @@ contract UniswapV2Executor is IExecutor { uint160( uint256( keccak256( - abi.encodePacked( - hex"ff", factory, salt, POOL_INIT_CODE_HASH - ) + abi.encodePacked(hex"ff", factory, salt, init_code) ) ) ) diff --git a/foundry/test/Constants.sol b/foundry/test/Constants.sol index 9149dcf..d366db9 100644 --- a/foundry/test/Constants.sol +++ b/foundry/test/Constants.sol @@ -47,9 +47,23 @@ contract Constants is Test, BaseConstants { address USDC_WBTC_POOL = 0x004375Dff511095CC5A197A54140a24eFEF3A416; address USDC_WETH_USV2 = 0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc; - // Uniswap v3 + // Sushiswap v2 + address SUSHISWAP_WBTC_WETH_POOL = + 0xCEfF51756c56CeFFCA006cD410B03FFC46dd3a58; + + // Pancakeswap v2 + address PANCAKESWAP_WBTC_WETH_POOL = + 0x4AB6702B3Ed3877e9b1f203f90cbEF13d663B0e8; + + // Factories address USV3_FACTORY_ETHEREUM = 0x1F98431c8aD98523631AE4a59f267346ea31F984; address USV2_FACTORY_ETHEREUM = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f; + address SUSHISWAPV2_FACTORY_ETHEREUM = + 0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac; + address PANCAKESWAPV2_FACTORY_ETHEREUM = + 0x1097053Fd2ea711dad45caCcc45EfF7548fCB362; + + // Uniswap v3 address DAI_WETH_USV3 = 0xC2e9F25Be6257c210d7Adf0D4Cd6E3E881ba25f8; address USDC_WETH_USV3 = 0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640; // 0.05% fee address USDC_WETH_USV3_2 = 0x8ad599c3A0ff1De082011EFDDc58f1908eb6e6D8; // 0.3% fee @@ -60,6 +74,14 @@ contract Constants is Test, BaseConstants { // Permit2 address PERMIT2_ADDRESS = 0x000000000022D473030F116dDEE9F6B43aC78BA3; + // Pool Code Init Hashes + bytes32 USV2_POOL_CODE_INIT_HASH = + 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f; + bytes32 SUSHIV2_POOL_CODE_INIT_HASH = + 0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303; + bytes32 PANCAKEV2_POOL_CODE_INIT_HASH = + 0x57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d; + /** * @dev Deploys a dummy contract with non-empty bytecode */ diff --git a/foundry/test/TychoRouterTestSetup.sol b/foundry/test/TychoRouterTestSetup.sol index 634f814..dd4bc57 100644 --- a/foundry/test/TychoRouterTestSetup.sol +++ b/foundry/test/TychoRouterTestSetup.sol @@ -46,6 +46,7 @@ contract TychoRouterTestSetup is Test, Constants { vm.startPrank(ADMIN); address factoryV3 = USV3_FACTORY_ETHEREUM; address factoryV2 = USV2_FACTORY_ETHEREUM; + bytes32 initCodeV2 = USV2_POOL_CODE_INIT_HASH; address poolManagerAddress = 0x000000000004444c5dc75cB358380D2e3dE08A90; IPoolManager poolManager = IPoolManager(poolManagerAddress); tychoRouter = new TychoRouterExposed(PERMIT2_ADDRESS, WETH_ADDR); @@ -60,7 +61,7 @@ contract TychoRouterTestSetup is Test, Constants { deployDummyContract(); vm.stopPrank(); - usv2Executor = new UniswapV2Executor(factoryV2); + usv2Executor = new UniswapV2Executor(factoryV2, initCodeV2); usv3Executor = new UniswapV3Executor(factoryV3); usv4Executor = new UniswapV4Executor(poolManager); vm.startPrank(EXECUTOR_SETTER); diff --git a/foundry/test/executors/UniswapV2Executor.t.sol b/foundry/test/executors/UniswapV2Executor.t.sol index f9b15a4..99110ef 100644 --- a/foundry/test/executors/UniswapV2Executor.t.sol +++ b/foundry/test/executors/UniswapV2Executor.t.sol @@ -6,7 +6,9 @@ import {Test} from "../../lib/forge-std/src/Test.sol"; import {Constants} from "../Constants.sol"; contract UniswapV2ExecutorExposed is UniswapV2Executor { - constructor(address _factory) UniswapV2Executor(_factory) {} + constructor(address _factory, bytes32 _init_code) + UniswapV2Executor(_factory, _init_code) + {} function decodeParams(bytes calldata data) external @@ -48,13 +50,23 @@ contract UniswapV2ExecutorTest is Test, Constants { using SafeERC20 for IERC20; UniswapV2ExecutorExposed uniswapV2Exposed; + UniswapV2ExecutorExposed sushiswapV2Exposed; + UniswapV2ExecutorExposed pancakeswapV2Exposed; IERC20 WETH = IERC20(WETH_ADDR); IERC20 DAI = IERC20(DAI_ADDR); function setUp() public { uint256 forkBlock = 17323404; vm.createSelectFork(vm.rpcUrl("mainnet"), forkBlock); - uniswapV2Exposed = new UniswapV2ExecutorExposed(USV2_FACTORY_ETHEREUM); + uniswapV2Exposed = new UniswapV2ExecutorExposed( + USV2_FACTORY_ETHEREUM, USV2_POOL_CODE_INIT_HASH + ); + sushiswapV2Exposed = new UniswapV2ExecutorExposed( + SUSHISWAPV2_FACTORY_ETHEREUM, SUSHIV2_POOL_CODE_INIT_HASH + ); + pancakeswapV2Exposed = new UniswapV2ExecutorExposed( + PANCAKESWAPV2_FACTORY_ETHEREUM, PANCAKEV2_POOL_CODE_INIT_HASH + ); } function testDecodeParams() public view { @@ -82,6 +94,14 @@ contract UniswapV2ExecutorTest is Test, Constants { uniswapV2Exposed.verifyPairAddress(WETH_DAI_POOL); } + function testVerifyPairAddressSushi() public view { + sushiswapV2Exposed.verifyPairAddress(SUSHISWAP_WBTC_WETH_POOL); + } + + function testVerifyPairAddressPancake() public view { + pancakeswapV2Exposed.verifyPairAddress(PANCAKESWAP_WBTC_WETH_POOL); + } + function testInvalidTarget() public { address fakePool = address(new FakeUniswapV2Pool(WETH_ADDR, DAI_ADDR)); vm.expectRevert(UniswapV2Executor__InvalidTarget.selector); From 2a4ee88cad46dfeb068809bdd885e63094020bcd Mon Sep 17 00:00:00 2001 From: TAMARA LIPOWSKI Date: Wed, 19 Mar 2025 15:30:58 -0400 Subject: [PATCH 2/7] feat: Support Pancakeswap v3 on ethereum - Needed to take pool code init hash as input param for executors - Added tests for ethereum. Will test base on-chain. - Important note: Pancakeswap uses their deployer instead of their factory (this is a different address) for target verification. --- foundry/scripts/deploy-executors.js | 37 ++++++++++++++----- foundry/src/executors/UniswapV2Executor.sol | 10 ++--- foundry/src/executors/UniswapV3Executor.sol | 12 ++++-- foundry/test/Constants.sol | 20 ++++++++-- foundry/test/TychoRouterTestSetup.sol | 5 ++- .../test/executors/UniswapV2Executor.t.sol | 4 +- .../test/executors/UniswapV3Executor.t.sol | 18 ++++++++- 7 files changed, 78 insertions(+), 28 deletions(-) diff --git a/foundry/scripts/deploy-executors.js b/foundry/scripts/deploy-executors.js index a7ac3d6..0e0501d 100644 --- a/foundry/scripts/deploy-executors.js +++ b/foundry/scripts/deploy-executors.js @@ -5,43 +5,62 @@ const hre = require("hardhat"); // Comment out the executors you don't want to deploy const executors_to_deploy = { "ethereum":[ - // Factory, Pool Init Code Hash + // Args: Factory, Pool Init Code Hash {exchange: "UniswapV2Executor", args: [ "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f", "0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f" ]}, - // Factory, Pool Init Code Hash + // Args: Factory, Pool Init Code Hash {exchange: "SushiSwapV2Executor", args: [ "0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac", "0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303" ]}, - // Factory, Pool Init Code Hash + // Args: Factory, Pool Init Code Hash {exchange: "PancakeSwapV2Executor", args: [ "0x1097053Fd2ea711dad45caCcc45EfF7548fCB362", "0x57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d" ]}, - {exchange: "UniswapV3Executor", args: ["0x1F98431c8aD98523631AE4a59f267346ea31F984"]}, + // Args: Factory, Pool Init Code Hash + {exchange: "UniswapV3Executor", args: [ + "0x1F98431c8aD98523631AE4a59f267346ea31F984", + "0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54" + ]}, + // Args: Deployer, Pool Init Code Hash + {exchange: "PancakeSwapV3Executor", args: [ + "0x41ff9AA7e16B8B1a8a8dc4f0eFacd93D02d071c9 ", + "0x6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2" + ]}, + // Args: Pool manager {exchange: "UniswapV4Executor", args: ["0x000000000004444c5dc75cB358380D2e3dE08A90"]}, {exchange: "BalancerV2Executor", args: []}, ], "base":[ - // Factory, Pool Init Code Hash + // Args: Factory, Pool Init Code Hash {exchange: "UniswapV2Executor", args: [ "0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6", "0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f" ]}, - // Factory, Pool Init Code Hash + // Args: Factory, Pool Init Code Hash {exchange: "SushiSwapV2Executor", args: [ "0x71524B4f93c58fcbF659783284E38825f0622859", "0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303" ]}, - // Factory, Pool Init Code Hash + // Args: Factory, Pool Init Code Hash {exchange: "PancakeSwapV2Executor", args: [ "0x02a84c1b3BBD7401a5f7fa98a384EBC70bB5749E", "0x57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d" ]}, - // Factory, Pool Init Code Hash - {exchange: "UniswapV3Executor", args: ["0x33128a8fC17869897dcE68Ed026d694621f6FDfD"]}, + // Args: Factory, Pool Init Code Hash + {exchange: "UniswapV3Executor", args: [ + "0x33128a8fC17869897dcE68Ed026d694621f6FDfD", + "0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54" + ]}, + // Args: Deployer, Pool Init Code Hash + {exchange: "PancakeSwapV3Executor", args: [ + "0x41ff9AA7e16B8B1a8a8dc4f0eFacd93D02d071c9 ", + "0x6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2" + ]}, + // Args: Pool manager {exchange: "UniswapV4Executor", args: ["0x498581ff718922c3f8e6a244956af099b2652b2b"]}, {exchange: "BalancerV2Executor", args: []}, ], diff --git a/foundry/src/executors/UniswapV2Executor.sol b/foundry/src/executors/UniswapV2Executor.sol index 51a33e6..50fb056 100644 --- a/foundry/src/executors/UniswapV2Executor.sol +++ b/foundry/src/executors/UniswapV2Executor.sol @@ -14,18 +14,18 @@ contract UniswapV2Executor is IExecutor { using SafeERC20 for IERC20; address public immutable factory; - bytes32 public immutable init_code; + bytes32 public immutable initCode; address private immutable self; - constructor(address _factory, bytes32 _init_code) { + constructor(address _factory, bytes32 _initCode) { if (_factory == address(0)) { revert UniswapV2Executor__InvalidFactory(); } - if (_init_code == bytes32(0)) { + if (_initCode == bytes32(0)) { revert UniswapV2Executor__InvalidInitCode(); } factory = _factory; - init_code = _init_code; + initCode = _initCode; self = address(this); } @@ -105,7 +105,7 @@ contract UniswapV2Executor is IExecutor { uint160( uint256( keccak256( - abi.encodePacked(hex"ff", factory, salt, init_code) + abi.encodePacked(hex"ff", factory, salt, initCode) ) ) ) diff --git a/foundry/src/executors/UniswapV3Executor.sol b/foundry/src/executors/UniswapV3Executor.sol index c03b5d3..f5878a8 100644 --- a/foundry/src/executors/UniswapV3Executor.sol +++ b/foundry/src/executors/UniswapV3Executor.sol @@ -10,24 +10,28 @@ import "@interfaces/ICallback.sol"; error UniswapV3Executor__InvalidDataLength(); error UniswapV3Executor__InvalidFactory(); error UniswapV3Executor__InvalidTarget(); +error UniswapV3Executor__InvalidInitCode(); contract UniswapV3Executor is IExecutor, ICallback { using SafeERC20 for IERC20; - bytes32 internal constant POOL_INIT_CODE_HASH = - 0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54; uint160 private constant MIN_SQRT_RATIO = 4295128739; uint160 private constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342; address public immutable factory; + bytes32 public immutable initCode; address private immutable self; - constructor(address _factory) { + constructor(address _factory, bytes32 _initCode) { if (_factory == address(0)) { revert UniswapV3Executor__InvalidFactory(); } + if (_initCode == bytes32(0)) { + revert UniswapV3Executor__InvalidInitCode(); + } factory = _factory; + initCode = _initCode; self = address(this); } @@ -167,7 +171,7 @@ contract UniswapV3Executor is IExecutor, ICallback { hex"ff", factory, keccak256(abi.encode(token0, token1, fee)), - POOL_INIT_CODE_HASH + initCode ) ) ) diff --git a/foundry/test/Constants.sol b/foundry/test/Constants.sol index d366db9..1a1fff7 100644 --- a/foundry/test/Constants.sol +++ b/foundry/test/Constants.sol @@ -55,6 +55,15 @@ contract Constants is Test, BaseConstants { address PANCAKESWAP_WBTC_WETH_POOL = 0x4AB6702B3Ed3877e9b1f203f90cbEF13d663B0e8; + // Uniswap v3 + address DAI_WETH_USV3 = 0xC2e9F25Be6257c210d7Adf0D4Cd6E3E881ba25f8; + address USDC_WETH_USV3 = 0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640; // 0.05% fee + address USDC_WETH_USV3_2 = 0x8ad599c3A0ff1De082011EFDDc58f1908eb6e6D8; // 0.3% fee + + // Pancakeswap v3 + address PANCAKESWAPV3_WETH_USDT_POOL = + 0x6CA298D2983aB03Aa1dA7679389D955A4eFEE15C; + // Factories address USV3_FACTORY_ETHEREUM = 0x1F98431c8aD98523631AE4a59f267346ea31F984; address USV2_FACTORY_ETHEREUM = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f; @@ -63,10 +72,9 @@ contract Constants is Test, BaseConstants { address PANCAKESWAPV2_FACTORY_ETHEREUM = 0x1097053Fd2ea711dad45caCcc45EfF7548fCB362; - // Uniswap v3 - address DAI_WETH_USV3 = 0xC2e9F25Be6257c210d7Adf0D4Cd6E3E881ba25f8; - address USDC_WETH_USV3 = 0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640; // 0.05% fee - address USDC_WETH_USV3_2 = 0x8ad599c3A0ff1De082011EFDDc58f1908eb6e6D8; // 0.3% fee + // Pancakeswap uses their deployer instead of their factory for target verification + address PANCAKESWAPV3_DEPLOYER_ETHEREUM = + 0x41ff9AA7e16B8B1a8a8dc4f0eFacd93D02d071c9; // Uniswap universal router address UNIVERSAL_ROUTER = 0x66a9893cC07D91D95644AEDD05D03f95e1dBA8Af; @@ -77,10 +85,14 @@ contract Constants is Test, BaseConstants { // Pool Code Init Hashes bytes32 USV2_POOL_CODE_INIT_HASH = 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f; + bytes32 USV3_POOL_CODE_INIT_HASH = + 0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54; bytes32 SUSHIV2_POOL_CODE_INIT_HASH = 0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303; bytes32 PANCAKEV2_POOL_CODE_INIT_HASH = 0x57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d; + bytes32 PANCAKEV3_POOL_CODE_INIT_HASH = + 0x6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2; /** * @dev Deploys a dummy contract with non-empty bytecode diff --git a/foundry/test/TychoRouterTestSetup.sol b/foundry/test/TychoRouterTestSetup.sol index dd4bc57..f6eb0ef 100644 --- a/foundry/test/TychoRouterTestSetup.sol +++ b/foundry/test/TychoRouterTestSetup.sol @@ -44,9 +44,10 @@ contract TychoRouterTestSetup is Test, Constants { vm.createSelectFork(vm.rpcUrl("mainnet"), forkBlock); vm.startPrank(ADMIN); - address factoryV3 = USV3_FACTORY_ETHEREUM; address factoryV2 = USV2_FACTORY_ETHEREUM; + address factoryV3 = USV3_FACTORY_ETHEREUM; bytes32 initCodeV2 = USV2_POOL_CODE_INIT_HASH; + bytes32 initCodeV3 = USV3_POOL_CODE_INIT_HASH; address poolManagerAddress = 0x000000000004444c5dc75cB358380D2e3dE08A90; IPoolManager poolManager = IPoolManager(poolManagerAddress); tychoRouter = new TychoRouterExposed(PERMIT2_ADDRESS, WETH_ADDR); @@ -62,7 +63,7 @@ contract TychoRouterTestSetup is Test, Constants { vm.stopPrank(); usv2Executor = new UniswapV2Executor(factoryV2, initCodeV2); - usv3Executor = new UniswapV3Executor(factoryV3); + usv3Executor = new UniswapV3Executor(factoryV3, initCodeV3); usv4Executor = new UniswapV4Executor(poolManager); vm.startPrank(EXECUTOR_SETTER); address[] memory executors = new address[](3); diff --git a/foundry/test/executors/UniswapV2Executor.t.sol b/foundry/test/executors/UniswapV2Executor.t.sol index 99110ef..a26a9b7 100644 --- a/foundry/test/executors/UniswapV2Executor.t.sol +++ b/foundry/test/executors/UniswapV2Executor.t.sol @@ -6,8 +6,8 @@ import {Test} from "../../lib/forge-std/src/Test.sol"; import {Constants} from "../Constants.sol"; contract UniswapV2ExecutorExposed is UniswapV2Executor { - constructor(address _factory, bytes32 _init_code) - UniswapV2Executor(_factory, _init_code) + constructor(address _factory, bytes32 _initCode) + UniswapV2Executor(_factory, _initCode) {} function decodeParams(bytes calldata data) diff --git a/foundry/test/executors/UniswapV3Executor.t.sol b/foundry/test/executors/UniswapV3Executor.t.sol index 8928627..01f5d1c 100644 --- a/foundry/test/executors/UniswapV3Executor.t.sol +++ b/foundry/test/executors/UniswapV3Executor.t.sol @@ -6,7 +6,9 @@ import {Test} from "../../lib/forge-std/src/Test.sol"; import {Constants} from "../Constants.sol"; contract UniswapV3ExecutorExposed is UniswapV3Executor { - constructor(address _factory) UniswapV3Executor(_factory) {} + constructor(address _factory, bytes32 _initCode) + UniswapV3Executor(_factory, _initCode) + {} function decodeData(bytes calldata data) external @@ -37,6 +39,7 @@ contract UniswapV3ExecutorTest is Test, Constants { using SafeERC20 for IERC20; UniswapV3ExecutorExposed uniswapV3Exposed; + UniswapV3ExecutorExposed pancakeV3Exposed; IERC20 WETH = IERC20(WETH_ADDR); IERC20 DAI = IERC20(DAI_ADDR); @@ -44,7 +47,12 @@ contract UniswapV3ExecutorTest is Test, Constants { uint256 forkBlock = 17323404; vm.createSelectFork(vm.rpcUrl("mainnet"), forkBlock); - uniswapV3Exposed = new UniswapV3ExecutorExposed(USV3_FACTORY_ETHEREUM); + uniswapV3Exposed = new UniswapV3ExecutorExposed( + USV3_FACTORY_ETHEREUM, USV3_POOL_CODE_INIT_HASH + ); + pancakeV3Exposed = new UniswapV3ExecutorExposed( + PANCAKESWAPV3_DEPLOYER_ETHEREUM, PANCAKEV3_POOL_CODE_INIT_HASH + ); } function testDecodeParams() public view { @@ -84,6 +92,12 @@ contract UniswapV3ExecutorTest is Test, Constants { ); } + function testVerifyPairAddressPancake() public view { + pancakeV3Exposed.verifyPairAddress( + WETH_ADDR, USDT_ADDR, 500, PANCAKESWAPV3_WETH_USDT_POOL + ); + } + function testUSV3Callback() public { uint24 poolFee = 3000; uint256 amountOwed = 1000000000000000000; From 39bd9df4b6ca8db78bb4d6757c93b30cce29f360 Mon Sep 17 00:00:00 2001 From: TAMARA LIPOWSKI Date: Wed, 19 Mar 2025 23:13:18 -0400 Subject: [PATCH 3/7] fix: proper exchange name when deploying executors - Also update base executors in json --- config/executor_addresses.json | 3 +++ foundry/scripts/deploy-executors.js | 34 ++++++++++++++--------------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/config/executor_addresses.json b/config/executor_addresses.json index 02e98e6..d7c9d89 100644 --- a/config/executor_addresses.json +++ b/config/executor_addresses.json @@ -13,6 +13,9 @@ }, "base": { "uniswap_v2": "0x852389F3Cde47e7dab5a29Fdd3E58c7050f1a019", + "sushiswap_v2": "0xbAf4569234712233Ae2142A07Bf164f988bDf5B5", + "pancakeswap_v2": "0xd3d73f114CbB40AD17CEEfC046FB18ecDe08678D", + "pancakeswap_v3": "0x2Ab42fdc9cfB3BAc0Db6F0d180A5B03872AFc25B", "uniswap_v3": "0x447135F701A4650e4Bd19c2B2B99cb324f8942c3", "uniswap_v4": "0xc34689d354B42b2780Fbe0A785080d761E5C882b" }, diff --git a/foundry/scripts/deploy-executors.js b/foundry/scripts/deploy-executors.js index 0e0501d..8459123 100644 --- a/foundry/scripts/deploy-executors.js +++ b/foundry/scripts/deploy-executors.js @@ -5,32 +5,32 @@ const hre = require("hardhat"); // Comment out the executors you don't want to deploy const executors_to_deploy = { "ethereum":[ - // Args: Factory, Pool Init Code Hash + // USV2 - Args: Factory, Pool Init Code Hash {exchange: "UniswapV2Executor", args: [ "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f", "0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f" ]}, - // Args: Factory, Pool Init Code Hash - {exchange: "SushiSwapV2Executor", args: [ + // SUSHISWAP - Args: Factory, Pool Init Code Hash + {exchange: "UniswapV2Executor", args: [ "0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac", "0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303" ]}, - // Args: Factory, Pool Init Code Hash - {exchange: "PancakeSwapV2Executor", args: [ + // PANCAKESWAP V2 - Args: Factory, Pool Init Code Hash + {exchange: "UniswapV2Executor", args: [ "0x1097053Fd2ea711dad45caCcc45EfF7548fCB362", "0x57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d" ]}, - // Args: Factory, Pool Init Code Hash + // USV3 -Args: Factory, Pool Init Code Hash {exchange: "UniswapV3Executor", args: [ "0x1F98431c8aD98523631AE4a59f267346ea31F984", "0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54" ]}, - // Args: Deployer, Pool Init Code Hash - {exchange: "PancakeSwapV3Executor", args: [ + // PANCAKESWAP V3 - Args: Deployer, Pool Init Code Hash + {exchange: "UniswapV3Executor", args: [ "0x41ff9AA7e16B8B1a8a8dc4f0eFacd93D02d071c9 ", "0x6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2" ]}, - // Args: Pool manager + // Args: Pool manager {exchange: "UniswapV4Executor", args: ["0x000000000004444c5dc75cB358380D2e3dE08A90"]}, {exchange: "BalancerV2Executor", args: []}, ], @@ -40,24 +40,24 @@ const executors_to_deploy = { "0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6", "0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f" ]}, - // Args: Factory, Pool Init Code Hash - {exchange: "SushiSwapV2Executor", args: [ + // SUSHISWAP V2 - Args: Factory, Pool Init Code Hash + {exchange: "UniswapV2Executor", args: [ "0x71524B4f93c58fcbF659783284E38825f0622859", "0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303" ]}, - // Args: Factory, Pool Init Code Hash - {exchange: "PancakeSwapV2Executor", args: [ + // PANCAKESWAP V2 - Args: Factory, Pool Init Code Hash + {exchange: "UniswapV2Executor", args: [ "0x02a84c1b3BBD7401a5f7fa98a384EBC70bB5749E", "0x57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d" ]}, - // Args: Factory, Pool Init Code Hash + // USV3 - Args: Factory, Pool Init Code Hash {exchange: "UniswapV3Executor", args: [ "0x33128a8fC17869897dcE68Ed026d694621f6FDfD", "0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54" ]}, - // Args: Deployer, Pool Init Code Hash - {exchange: "PancakeSwapV3Executor", args: [ - "0x41ff9AA7e16B8B1a8a8dc4f0eFacd93D02d071c9 ", + // PANCAKESWAP V3 - Args: Deployer, Pool Init Code Hash + {exchange: "UniswapV3Executor", args: [ + "0x41ff9AA7e16B8B1a8a8dc4f0eFacd93D02d071c9", "0x6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2" ]}, // Args: Pool manager From 783712be5d8dae626c735193416ba03701d3a616 Mon Sep 17 00:00:00 2001 From: TAMARA LIPOWSKI Date: Thu, 20 Mar 2025 11:26:18 -0400 Subject: [PATCH 4/7] feat: Set v2/v3 executor addresses on ethereum - Also fix router address env name in readme --- config/executor_addresses.json | 3 +++ foundry/scripts/README.md | 2 +- foundry/scripts/deploy-executors.js | 2 +- src/encoding/evm/swap_encoder/builder.rs | 3 +++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/config/executor_addresses.json b/config/executor_addresses.json index d7c9d89..941ce27 100644 --- a/config/executor_addresses.json +++ b/config/executor_addresses.json @@ -1,7 +1,10 @@ { "ethereum": { "uniswap_v2": "0xf6c5be66FFf9DC69962d73da0A617a827c382329", + "sushiswap_v2": "0x8ABd4075cF54E0A9C52D18e6951b969AF3249cF9", + "pancakeswap_v2": "0x9fC9e63cCf5F773A8bC79DcfA38c581B0DEa1d11", "uniswap_v3": "0xdD8559c917393FC8DD2b4dD289c52Ff445fDE1B0", + "pancakeswap_v3": "0x455b57440465139482E9E0ED9DC308d7BA6A8515", "uniswap_v4": "0x042C0ebBEAb9d9987c2f64Ee05f2B3aeB86eAf70", "vm:balancer_v2": "0x00BE8EfAE40219Ff76287b0F9b9e497942f5BC91" }, diff --git a/foundry/scripts/README.md b/foundry/scripts/README.md index aba7fcb..15fb38d 100644 --- a/foundry/scripts/README.md +++ b/foundry/scripts/README.md @@ -38,7 +38,7 @@ For each of the following, you must select one of `tenderly_ethereum`, `tenderly 1. Deploy router: `npx hardhat run scripts/deploy-router.js --network NETWORK` 2. Define the accounts to grant roles to in `scripts/roles.json` -3. Export the router address to the environment variable `export ROUTER=` +3. Export the router address to the environment variable `export ROUTER_ADDRESS=` 4. Grant roles: `npx hardhat run scripts/set-roles.js --network NETWORK` 5. Set executors: `npx hardhat run scripts/set-executors.js --network NETWORK`. Make sure you change the DEPLOY_WALLET to the executor deployer wallet. If you need to deploy executors, follow the instructions below. diff --git a/foundry/scripts/deploy-executors.js b/foundry/scripts/deploy-executors.js index 8459123..83ec42e 100644 --- a/foundry/scripts/deploy-executors.js +++ b/foundry/scripts/deploy-executors.js @@ -27,7 +27,7 @@ const executors_to_deploy = { ]}, // PANCAKESWAP V3 - Args: Deployer, Pool Init Code Hash {exchange: "UniswapV3Executor", args: [ - "0x41ff9AA7e16B8B1a8a8dc4f0eFacd93D02d071c9 ", + "0x41ff9AA7e16B8B1a8a8dc4f0eFacd93D02d071c9", "0x6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2" ]}, // Args: Pool manager diff --git a/src/encoding/evm/swap_encoder/builder.rs b/src/encoding/evm/swap_encoder/builder.rs index 075dad0..f00d1e8 100644 --- a/src/encoding/evm/swap_encoder/builder.rs +++ b/src/encoding/evm/swap_encoder/builder.rs @@ -23,8 +23,11 @@ impl SwapEncoderBuilder { pub fn build(self) -> Result, EncodingError> { match self.protocol_system.as_str() { "uniswap_v2" => Ok(Box::new(UniswapV2SwapEncoder::new(self.executor_address))), + "sushiswap_v2" => Ok(Box::new(UniswapV2SwapEncoder::new(self.executor_address))), + "pancakeswap_v2" => Ok(Box::new(UniswapV2SwapEncoder::new(self.executor_address))), "vm:balancer_v2" => Ok(Box::new(BalancerV2SwapEncoder::new(self.executor_address))), "uniswap_v3" => Ok(Box::new(UniswapV3SwapEncoder::new(self.executor_address))), + "pancakeswap_v3" => Ok(Box::new(UniswapV2SwapEncoder::new(self.executor_address))), "uniswap_v4" => Ok(Box::new(UniswapV4SwapEncoder::new(self.executor_address))), _ => Err(EncodingError::FatalError(format!( "Unknown protocol system: {}", From 1ed149a9b8ffd41b9cc702c77e146fa234176af0 Mon Sep 17 00:00:00 2001 From: TAMARA LIPOWSKI Date: Thu, 20 Mar 2025 12:20:10 -0400 Subject: [PATCH 5/7] fix: Remove pancakeswap V3 from approved executor addresses - Our router does not properly support pancakeswap. --- config/executor_addresses.json | 2 -- foundry/scripts/deploy-executors.js | 10 ---------- src/encoding/evm/swap_encoder/builder.rs | 1 - 3 files changed, 13 deletions(-) diff --git a/config/executor_addresses.json b/config/executor_addresses.json index 941ce27..1ec0465 100644 --- a/config/executor_addresses.json +++ b/config/executor_addresses.json @@ -4,7 +4,6 @@ "sushiswap_v2": "0x8ABd4075cF54E0A9C52D18e6951b969AF3249cF9", "pancakeswap_v2": "0x9fC9e63cCf5F773A8bC79DcfA38c581B0DEa1d11", "uniswap_v3": "0xdD8559c917393FC8DD2b4dD289c52Ff445fDE1B0", - "pancakeswap_v3": "0x455b57440465139482E9E0ED9DC308d7BA6A8515", "uniswap_v4": "0x042C0ebBEAb9d9987c2f64Ee05f2B3aeB86eAf70", "vm:balancer_v2": "0x00BE8EfAE40219Ff76287b0F9b9e497942f5BC91" }, @@ -18,7 +17,6 @@ "uniswap_v2": "0x852389F3Cde47e7dab5a29Fdd3E58c7050f1a019", "sushiswap_v2": "0xbAf4569234712233Ae2142A07Bf164f988bDf5B5", "pancakeswap_v2": "0xd3d73f114CbB40AD17CEEfC046FB18ecDe08678D", - "pancakeswap_v3": "0x2Ab42fdc9cfB3BAc0Db6F0d180A5B03872AFc25B", "uniswap_v3": "0x447135F701A4650e4Bd19c2B2B99cb324f8942c3", "uniswap_v4": "0xc34689d354B42b2780Fbe0A785080d761E5C882b" }, diff --git a/foundry/scripts/deploy-executors.js b/foundry/scripts/deploy-executors.js index 83ec42e..77e9dbb 100644 --- a/foundry/scripts/deploy-executors.js +++ b/foundry/scripts/deploy-executors.js @@ -25,11 +25,6 @@ const executors_to_deploy = { "0x1F98431c8aD98523631AE4a59f267346ea31F984", "0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54" ]}, - // PANCAKESWAP V3 - Args: Deployer, Pool Init Code Hash - {exchange: "UniswapV3Executor", args: [ - "0x41ff9AA7e16B8B1a8a8dc4f0eFacd93D02d071c9", - "0x6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2" - ]}, // Args: Pool manager {exchange: "UniswapV4Executor", args: ["0x000000000004444c5dc75cB358380D2e3dE08A90"]}, {exchange: "BalancerV2Executor", args: []}, @@ -55,11 +50,6 @@ const executors_to_deploy = { "0x33128a8fC17869897dcE68Ed026d694621f6FDfD", "0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54" ]}, - // PANCAKESWAP V3 - Args: Deployer, Pool Init Code Hash - {exchange: "UniswapV3Executor", args: [ - "0x41ff9AA7e16B8B1a8a8dc4f0eFacd93D02d071c9", - "0x6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2" - ]}, // Args: Pool manager {exchange: "UniswapV4Executor", args: ["0x498581ff718922c3f8e6a244956af099b2652b2b"]}, {exchange: "BalancerV2Executor", args: []}, diff --git a/src/encoding/evm/swap_encoder/builder.rs b/src/encoding/evm/swap_encoder/builder.rs index f00d1e8..40ede0f 100644 --- a/src/encoding/evm/swap_encoder/builder.rs +++ b/src/encoding/evm/swap_encoder/builder.rs @@ -27,7 +27,6 @@ impl SwapEncoderBuilder { "pancakeswap_v2" => Ok(Box::new(UniswapV2SwapEncoder::new(self.executor_address))), "vm:balancer_v2" => Ok(Box::new(BalancerV2SwapEncoder::new(self.executor_address))), "uniswap_v3" => Ok(Box::new(UniswapV3SwapEncoder::new(self.executor_address))), - "pancakeswap_v3" => Ok(Box::new(UniswapV2SwapEncoder::new(self.executor_address))), "uniswap_v4" => Ok(Box::new(UniswapV4SwapEncoder::new(self.executor_address))), _ => Err(EncodingError::FatalError(format!( "Unknown protocol system: {}", From 9ba78cf2d07b99667ced1fb6d443cec180ff57d5 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 20 Mar 2025 19:52:27 +0000 Subject: [PATCH 6/7] chore(release): 0.67.0 [skip ci] ## [0.67.0](https://github.com/propeller-heads/tycho-execution/compare/0.66.1...0.67.0) (2025-03-20) ### Features * Set v2/v3 executor addresses on ethereum ([783712b](https://github.com/propeller-heads/tycho-execution/commit/783712be5d8dae626c735193416ba03701d3a616)) * Support Pancakeswap v3 on ethereum ([2a4ee88](https://github.com/propeller-heads/tycho-execution/commit/2a4ee88cad46dfeb068809bdd885e63094020bcd)) * Support sushiswap v2 and pancakeswap v2 on ethereum ([0a8a34b](https://github.com/propeller-heads/tycho-execution/commit/0a8a34be035588d45e6b72a42f4dd691e3c98d2f)) ### Bug Fixes * proper exchange name when deploying executors ([39bd9df](https://github.com/propeller-heads/tycho-execution/commit/39bd9df4b6ca8db78bb4d6757c93b30cce29f360)) * Remove pancakeswap V3 from approved executor addresses ([1ed149a](https://github.com/propeller-heads/tycho-execution/commit/1ed149a9b8ffd41b9cc702c77e146fa234176af0)) --- CHANGELOG.md | 15 +++++++++++++++ Cargo.lock | 2 +- Cargo.toml | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b46ceb1..6e0bd10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ +## [0.67.0](https://github.com/propeller-heads/tycho-execution/compare/0.66.1...0.67.0) (2025-03-20) + + +### Features + +* Set v2/v3 executor addresses on ethereum ([783712b](https://github.com/propeller-heads/tycho-execution/commit/783712be5d8dae626c735193416ba03701d3a616)) +* Support Pancakeswap v3 on ethereum ([2a4ee88](https://github.com/propeller-heads/tycho-execution/commit/2a4ee88cad46dfeb068809bdd885e63094020bcd)) +* Support sushiswap v2 and pancakeswap v2 on ethereum ([0a8a34b](https://github.com/propeller-heads/tycho-execution/commit/0a8a34be035588d45e6b72a42f4dd691e3c98d2f)) + + +### Bug Fixes + +* proper exchange name when deploying executors ([39bd9df](https://github.com/propeller-heads/tycho-execution/commit/39bd9df4b6ca8db78bb4d6757c93b30cce29f360)) +* Remove pancakeswap V3 from approved executor addresses ([1ed149a](https://github.com/propeller-heads/tycho-execution/commit/1ed149a9b8ffd41b9cc702c77e146fa234176af0)) + ## [0.66.1](https://github.com/propeller-heads/tycho-execution/compare/0.66.0...0.66.1) (2025-03-19) diff --git a/Cargo.lock b/Cargo.lock index a326a08..bdbcf8f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4340,7 +4340,7 @@ dependencies = [ [[package]] name = "tycho-execution" -version = "0.66.1" +version = "0.67.0" dependencies = [ "alloy", "alloy-primitives", diff --git a/Cargo.toml b/Cargo.toml index cc569cd..b3cd474 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tycho-execution" -version = "0.66.1" +version = "0.67.0" edition = "2021" [[bin]] From 15fed02348345ace75d3c0591131952f5fb35e60 Mon Sep 17 00:00:00 2001 From: Valentin Khramtsov Date: Tue, 25 Mar 2025 13:45:34 +0300 Subject: [PATCH 7/7] chore: updated ci test workflow --- .github/workflows/ci.yaml | 2 +- .../workflows/tests-and-lints-template.yaml | 24 +++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d8bce90..6da8e5b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,7 +1,7 @@ name: Continuous Integration on: - pull_request: + pull_request_target: permissions: id-token: write diff --git a/.github/workflows/tests-and-lints-template.yaml b/.github/workflows/tests-and-lints-template.yaml index 70f431b..12cd28a 100644 --- a/.github/workflows/tests-and-lints-template.yaml +++ b/.github/workflows/tests-and-lints-template.yaml @@ -39,7 +39,7 @@ jobs: steps: - name: Generate a token id: generate-token - uses: getsentry/action-github-app-token@v2 + uses: getsentry/action-github-app-token@d4b5da6c5e37703f8c3b3e43abb5705b46e159cc with: app_id: ${{ secrets.app_id }} private_key: ${{ secrets.app_private_key }} @@ -48,7 +48,9 @@ jobs: run: sudo apt update && sudo apt install -y git - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + with: + ref: ${{ github.event.pull_request.head.sha }} - name: Setup git to use https run: | @@ -57,17 +59,17 @@ jobs: git config --global url."https://x-access-token:${{ steps.generate-token.outputs.token }}@github.com".insteadOf ssh://github.com - name: Setup toolchain - uses: dtolnay/rust-toolchain@v1 + uses: dtolnay/rust-toolchain@888c2e1ea69ab0d4330cbf0af1ecc7b68f368cc1 with: toolchain: ${{ matrix.toolchain }} - name: Setup Rust Cache - uses: Swatinem/rust-cache@v2 + uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 with: cache-on-failure: true - name: Install latest nextest release - uses: taiki-e/install-action@nextest + uses: taiki-e/install-action@b239071b2aedda3db20530301c2d88cd538e90d3 - name: Test run: cargo nextest run --workspace --lib --all-targets && cargo test --doc @@ -79,7 +81,7 @@ jobs: steps: - name: Generate a token id: generate-token - uses: getsentry/action-github-app-token@v2 + uses: getsentry/action-github-app-token@d4b5da6c5e37703f8c3b3e43abb5705b46e159cc with: app_id: ${{ secrets.app_id }} private_key: ${{ secrets.app_private_key }} @@ -88,7 +90,9 @@ jobs: run: sudo apt update && sudo apt install -y git - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + with: + ref: ${{ github.head_ref }} - name: Setup git to use https run: | @@ -97,13 +101,13 @@ jobs: git config --global url."https://x-access-token:${{ steps.generate-token.outputs.token }}@github.com".insteadOf ssh://github.com - name: Setup clippy toolchain - stable - uses: dtolnay/rust-toolchain@v1 + uses: dtolnay/rust-toolchain@888c2e1ea69ab0d4330cbf0af1ecc7b68f368cc1 with: toolchain: stable components: clippy - name: Setup Rust Cache - uses: Swatinem/rust-cache@v2 + uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 with: cache-on-failure: true @@ -116,7 +120,7 @@ jobs: RUSTFLAGS: -Dwarnings - name: Setup rustfmt toolchain - nightly - uses: dtolnay/rust-toolchain@nightly + uses: dtolnay/rust-toolchain@a02741459ec5e501b9843ed30b535ca0a0376ae4 with: components: rustfmt