From 6ef68a2b1b107d6bd41812722498a697873f8c87 Mon Sep 17 00:00:00 2001 From: ross <92001561+z0r0z@users.noreply.github.com> Date: Mon, 3 Jun 2024 10:26:12 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9A=20AKA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gas-snapshot | 38 +++++++++++++++++++------------------- src/IE.sol | 8 ++++++++ test/IE.t.sol | 3 ++- 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/.gas-snapshot b/.gas-snapshot index 65544bd..13b29f8 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,28 +1,28 @@ 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: 129985) -IETest:testPreviewBalanceChangeETH() (gas: 70234) -IETest:testPreviewCommandSendDecimals() (gas: 111460) -IETest:testPreviewCommandSendUSDC() (gas: 70114) +IETest:testCommandStakeETH() (gas: 147244) +IETest:testCommandSwapDAI() (gas: 130115) +IETest:testCommandSwapETH() (gas: 155507) +IETest:testCommandSwapForETH() (gas: 137252) +IETest:testCommandSwapUSDC() (gas: 171791) +IETest:testCommandSwapUSDCForWBTC() (gas: 196722) +IETest:testDeploy() (gas: 4059106) +IETest:testENSNameOwnership() (gas: 50762) +IETest:testPreviewBalanceChangeDAI() (gas: 130029) +IETest:testPreviewBalanceChangeETH() (gas: 70256) +IETest:testPreviewCommandSendDecimals() (gas: 111504) +IETest:testPreviewCommandSendUSDC() (gas: 70136) IETest:testPreviewSend() (gas: 56082) -IETest:testPreviewSendCommand() (gas: 69684) -IETest:testPreviewSendCommandRawAddr() (gas: 66866) +IETest:testPreviewSendCommand() (gas: 69706) +IETest:testPreviewSendCommandRawAddr() (gas: 66888) IETest:testPreviewSendRawAddr() (gas: 30083) IETest:testTokenAliasSetting() (gas: 10964) IETest:testTranslateCommand() (gas: 10575) -IETest:testTranslateExecuteSend0_0_1ETH() (gas: 29172) -IETest:testTranslateExecuteSend0_1ETH() (gas: 28479) -IETest:testTranslateExecuteSend10USDC() (gas: 26901) -IETest:testTranslateExecuteSend1ETH() (gas: 30788) -IETest:testTranslateExecuteSend1Wei() (gas: 32508) +IETest:testTranslateExecuteSend0_0_1ETH() (gas: 29194) +IETest:testTranslateExecuteSend0_1ETH() (gas: 28501) +IETest:testTranslateExecuteSend10USDC() (gas: 26923) +IETest:testTranslateExecuteSend1ETH() (gas: 30810) +IETest:testTranslateExecuteSend1Wei() (gas: 32530) IETest:testTranslateTokenTransfer10USDC() (gas: 26667) NAMITest:testFailRegister() (gas: 9532) NAMITest:testRegister() (gas: 59011) \ No newline at end of file diff --git a/src/IE.sol b/src/IE.sol index 843bc96..14f10de 100644 --- a/src/IE.sol +++ b/src/IE.sol @@ -98,6 +98,9 @@ contract IE { /// @dev The governing DAO address. address internal constant DAO = 0xDa000000000000d2885F108500803dfBAaB2f2aA; + /// @dev The onchain akashic library. + address internal constant AKA = 0x000000000000394793B2Fe854281CeE09a98bdBC; + /// @dev The NANI token address. address internal constant NANI = 0x000000000000C6A645b0E51C9eCAA4CA580Ed8e8; @@ -544,6 +547,11 @@ contract IE { /// ==================== COMMAND TRANSLATION ==================== /// + /// @dev Returns the akashic library summary digest `about` a given `topic`. + function read(string calldata topic) public view virtual returns (string memory about) { + return IE(payable(AKA)).read(topic); + } + /// @dev Translates an `intent` from raw `command()` calldata. function translateCommand(bytes calldata callData) public diff --git a/test/IE.t.sol b/test/IE.t.sol index 01d28e8..307ecc6 100644 --- a/test/IE.t.sol +++ b/test/IE.t.sol @@ -234,7 +234,8 @@ contract IETest is Test { function testTranslateTokenTransfer10USDC() public payable { string memory intent = "send 10 USDC to 0x1c0aa8ccd568d90d61659f060d1bfb1e6f855a20"; - bytes memory tokenCalldata = abi.encodeWithSelector(IERC20.transfer.selector, Z0R0Z_DOT_ETH, 10000000); + bytes memory tokenCalldata = + abi.encodeWithSelector(IERC20.transfer.selector, Z0R0Z_DOT_ETH, 10000000); string memory ret = ie.translateTokenTransfer(USDC, tokenCalldata); assertEq(ret, intent); }