From c856f8ac70b00b46589eb6df16a428bb49b3546c Mon Sep 17 00:00:00 2001 From: ross <92001561+z0r0z@users.noreply.github.com> Date: Mon, 3 Jun 2024 07:42:07 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20Tests=20&=20nit=20transfer=20tra?= =?UTF-8?q?nslation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gas-snapshot | 41 +++++++++++++++++++++-------------------- lib/solady | 2 +- src/IE.sol | 2 +- test/IE.t.sol | 7 +++++++ 4 files changed, 30 insertions(+), 22 deletions(-) diff --git a/.gas-snapshot b/.gas-snapshot index 0f90c18..65544bd 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,27 +1,28 @@ -IETest:testCommandSendETH() (gas: 77527) -IETest:testCommandSendETHRawAddr() (gas: 75284) -IETest:testCommandStakeETH() (gas: 148215) -IETest:testCommandSwapDAI() (gas: 130008) -IETest:testCommandSwapETH() (gas: 155437) -IETest:testCommandSwapForETH() (gas: 137166) -IETest:testCommandSwapUSDC() (gas: 171664) -IETest:testCommandSwapUSDCForWBTC() (gas: 196641) -IETest:testDeploy() (gas: 4117277) +IETest:testCommandSendETH() (gas: 77576) +IETest:testCommandSendETHRawAddr() (gas: 75355) +IETest:testCommandStakeETH() (gas: 148184) +IETest:testCommandSwapDAI() (gas: 130107) +IETest:testCommandSwapETH() (gas: 154503) +IETest:testCommandSwapForETH() (gas: 137245) +IETest:testCommandSwapUSDC() (gas: 171759) +IETest:testCommandSwapUSDCForWBTC() (gas: 195650) +IETest:testDeploy() (gas: 3982479) IETest:testENSNameOwnership() (gas: 50740) -IETest:testPreviewBalanceChangeDAI() (gas: 129875) -IETest:testPreviewBalanceChangeETH() (gas: 70179) -IETest:testPreviewCommandSendDecimals() (gas: 111362) -IETest:testPreviewCommandSendUSDC() (gas: 70065) -IETest:testPreviewSend() (gas: 56060) -IETest:testPreviewSendCommand() (gas: 69635) -IETest:testPreviewSendCommandRawAddr() (gas: 66817) -IETest:testPreviewSendRawAddr() (gas: 30061) +IETest:testPreviewBalanceChangeDAI() (gas: 129985) +IETest:testPreviewBalanceChangeETH() (gas: 70234) +IETest:testPreviewCommandSendDecimals() (gas: 111460) +IETest:testPreviewCommandSendUSDC() (gas: 70114) +IETest:testPreviewSend() (gas: 56082) +IETest:testPreviewSendCommand() (gas: 69684) +IETest:testPreviewSendCommandRawAddr() (gas: 66866) +IETest:testPreviewSendRawAddr() (gas: 30083) IETest:testTokenAliasSetting() (gas: 10964) IETest:testTranslateCommand() (gas: 10575) -IETest:testTranslateExecuteSend0_0_1ETH() (gas: 29150) +IETest:testTranslateExecuteSend0_0_1ETH() (gas: 29172) IETest:testTranslateExecuteSend0_1ETH() (gas: 28479) -IETest:testTranslateExecuteSend10USDC() (gas: 26874) +IETest:testTranslateExecuteSend10USDC() (gas: 26901) IETest:testTranslateExecuteSend1ETH() (gas: 30788) -IETest:testTranslateExecuteSend1Wei() (gas: 32486) +IETest:testTranslateExecuteSend1Wei() (gas: 32508) +IETest:testTranslateTokenTransfer10USDC() (gas: 26667) NAMITest:testFailRegister() (gas: 9532) NAMITest:testRegister() (gas: 59011) \ No newline at end of file diff --git a/lib/solady b/lib/solady index bfff552..c55500d 160000 --- a/lib/solady +++ b/lib/solady @@ -1 +1 @@ -Subproject commit bfff552c0d282c15258cab9377a7d4c5247d0434 +Subproject commit c55500db941600053d149cc2a1d1696aa37c4294 diff --git a/src/IE.sol b/src/IE.sol index 939e7c5..843bc96 100644 --- a/src/IE.sol +++ b/src/IE.sol @@ -624,7 +624,7 @@ contract IE { transfer ? "send " : "approve ", _convertWeiToString(value, decimals), " ", - token, + tokenAlias, " to 0x", _toAsciiString(target) ) diff --git a/test/IE.t.sol b/test/IE.t.sol index 26b4664..01d28e8 100644 --- a/test/IE.t.sol +++ b/test/IE.t.sol @@ -232,6 +232,13 @@ contract IETest is Test { assertEq(ret, intent); } + function testTranslateTokenTransfer10USDC() public payable { + string memory intent = "send 10 USDC to 0x1c0aa8ccd568d90d61659f060d1bfb1e6f855a20"; + bytes memory tokenCalldata = abi.encodeWithSelector(IERC20.transfer.selector, Z0R0Z_DOT_ETH, 10000000); + string memory ret = ie.translateTokenTransfer(USDC, tokenCalldata); + assertEq(ret, intent); + } + function testPreviewBalanceChangeDAI() public payable { string memory intent = "send 1 DAI to 0x1c0aa8ccd568d90d61659f060d1bfb1e6f855a20"; uint256 percentageChange = ie.previewBalanceChange(SHIVANSHI_DOT_ETH, intent);