Skip to content

Commit

Permalink
📚 AKA
Browse files Browse the repository at this point in the history
  • Loading branch information
z0r0z committed Jun 3, 2024
1 parent c856f8a commit 6ef68a2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 20 deletions.
38 changes: 19 additions & 19 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -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)
8 changes: 8 additions & 0 deletions src/IE.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion test/IE.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 6ef68a2

Please sign in to comment.