Skip to content

Commit

Permalink
🧹 Tests & nit transfer translation
Browse files Browse the repository at this point in the history
  • Loading branch information
z0r0z committed Jun 3, 2024
1 parent e6d1f10 commit c856f8a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 22 deletions.
41 changes: 21 additions & 20 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion lib/solady
2 changes: 1 addition & 1 deletion src/IE.sol
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ contract IE {
transfer ? "send " : "approve ",
_convertWeiToString(value, decimals),
" ",
token,
tokenAlias,
" to 0x",
_toAsciiString(target)
)
Expand Down
7 changes: 7 additions & 0 deletions test/IE.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c856f8a

Please sign in to comment.