Skip to content

Commit

Permalink
π’€­ 1.3.0 - Translator
Browse files Browse the repository at this point in the history
  • Loading branch information
z0r0z committed May 25, 2024
1 parent d474495 commit f14d701
Show file tree
Hide file tree
Showing 13 changed files with 325 additions and 80 deletions.
44 changes: 22 additions & 22 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
IETest:testCommandDepositETH() (gas: 155598)
IETest:testCommandSendETH() (gas: 75320)
IETest:testCommandSendETHRawAddr() (gas: 75755)
IETest:testCommandStakeETH() (gas: 147756)
IETest:testCommandSwapDAI() (gas: 138503)
IETest:testCommandSwapETH() (gas: 138209)
IETest:testCommandSwapForETH() (gas: 145404)
IETest:testCommandSwapUSDC() (gas: 171497)
IETest:testCommandSwapUSDCForWBTC() (gas: 196200)
IETest:testCommandUnstakeETH() (gas: 263506)
IETest:testCommandWithdrawETH() (gas: 266209)
IETest:testDeploy() (gas: 2563979)
IETest:testENSNameOwnership() (gas: 48424)
IETest:testIENameSetting() (gas: 11105)
IETest:testPreviewCommandSendDecimals() (gas: 108639)
IETest:testPreviewCommandSendUSDC() (gas: 67684)
IETest:testPreviewSend() (gas: 53800)
IETest:testPreviewSendCommand() (gas: 67248)
IETest:testPreviewSendCommandRawAddr() (gas: 67151)
IETest:testPreviewSendRawAddr() (gas: 30543)
NAMITest:testFailRegister() (gas: 9471)
NAMITest:testRegister() (gas: 58853)
IETest:testCommandDepositETH() (gas: 164220)
IETest:testCommandSendETH() (gas: 77505)
IETest:testCommandSendETHRawAddr() (gas: 75196)
IETest:testCommandStakeETH() (gas: 146991)
IETest:testCommandSwapDAI() (gas: 138570)
IETest:testCommandSwapETH() (gas: 233185)
IETest:testCommandSwapForETH() (gas: 145463)
IETest:testCommandSwapUSDC() (gas: 171664)
IETest:testCommandSwapUSDCForWBTC() (gas: 196531)
IETest:testCommandUnstakeETH() (gas: 297247)
IETest:testCommandWithdrawETH() (gas: 299993)
IETest:testDeploy() (gas: 3669933)
IETest:testENSNameOwnership() (gas: 50652)
IETest:testIENameSetting() (gas: 11118)
IETest:testPreviewCommandSendDecimals() (gas: 111274)
IETest:testPreviewCommandSendUSDC() (gas: 70021)
IETest:testPreviewSend() (gas: 55972)
IETest:testPreviewSendCommand() (gas: 69547)
IETest:testPreviewSendCommandRawAddr() (gas: 66729)
IETest:testPreviewSendRawAddr() (gas: 29973)
NAMITest:testFailRegister() (gas: 9532)
NAMITest:testRegister() (gas: 59011)
141 changes: 123 additions & 18 deletions docs/src/src/IE.sol/contract.IE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# IE
[Git Source](https://github.com/NaniDAO/ie/blob/f061f69f55a660146bbc3247dded252faef04a99/src/IE.sol)
[Git Source](https://github.com/NaniDAO/ie/blob/d47449524e79a44fee3444e5d49a8256f0cc4165/src/IE.sol)

**Author:**
nani.eth (https://github.com/NaniDAO/ie)
Expand Down Expand Up @@ -150,26 +150,35 @@ uint160 internal constant MAX_SQRT_RATIO_MINUS_ONE =
```


### NAMI
*The NAMI naming system on Arbitrum.*
### nami
========================== STORAGE ========================== ///

*DAO-governed NAMI naming system on Arbitrum.*


```solidity
INAMI internal constant NAMI = INAMI(0x000000006641B4C250AEA6B62A1e0067D300697a);
INAMI internal nami = INAMI(0x000000006641B4C250AEA6B62A1e0067D300697a);
```


### tokens
========================== STORAGE ========================== ///

*DAO-governed token address naming.*
*DAO-governed token name aliasing.*


```solidity
mapping(string name => address) public tokens;
```


### aliases
*DAO-governed token address name aliasing.*


```solidity
mapping(address token => string name) public aliases;
```


### pairs
*DAO-governed token swap pool routing on Uniswap V3.*

Expand Down Expand Up @@ -291,6 +300,19 @@ function _returnTokenConstants(bytes32 token)
returns (address _token, uint256 _decimals);
```

### _returnTokenAliasConstants

*Checks and returns the canonical token string constant for a matched address.*


```solidity
function _returnTokenAliasConstants(address token)
internal
pure
virtual
returns (string memory _token, uint256 _decimals);
```

### _returnPoolConstants

*Checks and returns popular pool pairs for WETH swaps.*
Expand Down Expand Up @@ -416,6 +438,44 @@ Only canonical WETH can call.*
receive() external payable virtual;
```

### translate

==================== COMMAND TRANSLATION ==================== ///

*Translates the `intent` for send action from the solution `callData` of a standard `execute()`.
note: The function selector technically doesn't need to be `execute()` but params should match.*


```solidity
function translate(bytes calldata callData) public view virtual returns (string memory intent);
```

### translateUserOp

*Translate ERC4337 userOp `callData` into readable send `intent`.*


```solidity
function translateUserOp(UserOperation calldata userOp)
public
view
virtual
returns (string memory intent);
```

### translatePackedUserOp

*Translate packed ERC4337 userOp `callData` into readable send `intent`.*


```solidity
function translatePackedUserOp(PackedUserOperation calldata userOp)
public
view
virtual
returns (string memory intent);
```

### whatIsTheBalanceOf

================== BALANCE & SUPPLY HELPERS ================== ///
Expand Down Expand Up @@ -459,24 +519,24 @@ function whatIsTheAddressOf(string memory name)
returns (address owner, address receiver, bytes32 node);
```

### setName
### setAlias

========================= GOVERNANCE ========================= ///

*Sets a public `name` tag for a given `token` address. Governed by DAO.*
*Sets a public alias tag for a given `token` address. Governed by DAO.*


```solidity
function setName(address token, string calldata name) public payable virtual;
function setAlias(address token, string calldata _alias) public payable virtual;
```

### setNameAndTicker
### setAliasAndTicker

*Sets a public name and ticker for a given `token` address.*
*Sets a public alias and ticker for a given `token` address.*


```solidity
function setNameAndTicker(address token) public payable virtual;
function setAliasAndTicker(address token) public payable virtual;
```

### setPair
Expand All @@ -488,6 +548,15 @@ function setNameAndTicker(address token) public payable virtual;
function setPair(address tokenA, address tokenB, address pair) public payable virtual;
```

### setNAMI

*Sets the Arbitrum naming singleton (NAMI). Governed by DAO.*


```solidity
function setNAMI(INAMI NAMI) public payable virtual;
```

### _lowercase

===================== STRING OPERATIONS ===================== ///
Expand Down Expand Up @@ -598,15 +667,43 @@ function _hexStringToAddress(string memory s) internal pure virtual returns (byt
function _fromHexChar(uint8 c) internal pure virtual returns (uint8 result);
```

### _toAsciiString

*Convert an address to an ASCII string representation.*


```solidity
function _toAsciiString(address x) internal pure virtual returns (string memory);
```

### _char

*Convert a single byte to a character in the ASCII string.*


```solidity
function _char(bytes1 b) internal pure virtual returns (bytes1 c);
```

### _toString

*Returns the base 10 decimal representation of `value`.
Modified from (https://github.com/Vectorized/solady/blob/main/src/utils/LibString.sol)*


```solidity
function _toString(uint256 value) internal pure virtual returns (string memory str);
```

## Events
### NameSet
### AliasSet
=========================== EVENTS =========================== ///

*Logs the registration of a token name.*
*Logs the registration of a token name alias.*


```solidity
event NameSet(address indexed token, string name);
event AliasSet(address indexed token, string name);
```

### PairSet
Expand All @@ -621,9 +718,9 @@ event PairSet(address indexed token0, address indexed token1, address pair);
### Overflow
======================= LIBRARY USAGE ======================= ///

*Metadata reader library.*
*Token transfer library.*

*Safe token transfer library.
*Token metadata reader library.
======================= CUSTOM ERRORS ======================= ///*

*Bad math.*
Expand Down Expand Up @@ -665,6 +762,14 @@ error InvalidCharacter();
error InsufficientSwap();
```

### InvalidSelector
*Invalid selector for the given asset spend.*


```solidity
error InvalidSelector();
```

## Structs
### UserOperation
========================== STRUCTS ========================== ///
Expand Down
2 changes: 1 addition & 1 deletion docs/src/src/IE.sol/interface.IExecutor.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# IExecutor
[Git Source](https://github.com/NaniDAO/ie/blob/f061f69f55a660146bbc3247dded252faef04a99/src/IE.sol)
[Git Source](https://github.com/NaniDAO/ie/blob/d47449524e79a44fee3444e5d49a8256f0cc4165/src/IE.sol)

Simple calldata executor interface.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/src/IE.sol/interface.INAMI.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# INAMI
[Git Source](https://github.com/NaniDAO/ie/blob/f061f69f55a660146bbc3247dded252faef04a99/src/IE.sol)
[Git Source](https://github.com/NaniDAO/ie/blob/d47449524e79a44fee3444e5d49a8256f0cc4165/src/IE.sol)

*Simple NAMI names interface for resolving L2 ENS ownership.*

Expand Down
2 changes: 1 addition & 1 deletion docs/src/src/IE.sol/interface.ISwapRouter.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ISwapRouter
[Git Source](https://github.com/NaniDAO/ie/blob/f061f69f55a660146bbc3247dded252faef04a99/src/IE.sol)
[Git Source](https://github.com/NaniDAO/ie/blob/d47449524e79a44fee3444e5d49a8256f0cc4165/src/IE.sol)

*Simple Uniswap V3 swapping interface.*

Expand Down
2 changes: 1 addition & 1 deletion docs/src/src/IE.sol/interface.IToken.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# IToken
[Git Source](https://github.com/NaniDAO/ie/blob/f061f69f55a660146bbc3247dded252faef04a99/src/IE.sol)
[Git Source](https://github.com/NaniDAO/ie/blob/d47449524e79a44fee3444e5d49a8256f0cc4165/src/IE.sol)

*Simple token transfer interface.*

Expand Down
2 changes: 1 addition & 1 deletion docs/src/src/NAMI.sol/contract.NAMI.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# NAMI
[Git Source](https://github.com/NaniDAO/ie/blob/f061f69f55a660146bbc3247dded252faef04a99/src/NAMI.sol)
[Git Source](https://github.com/NaniDAO/ie/blob/d47449524e79a44fee3444e5d49a8256f0cc4165/src/NAMI.sol)

**Author:**
nani.eth (https://github.com/NaniDAO/ie)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/src/NAMI.sol/interface.IToken.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# IToken
[Git Source](https://github.com/NaniDAO/ie/blob/f061f69f55a660146bbc3247dded252faef04a99/src/NAMI.sol)
[Git Source](https://github.com/NaniDAO/ie/blob/d47449524e79a44fee3444e5d49a8256f0cc4165/src/NAMI.sol)

*Simple token balance & supply interface.*

Expand Down
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[profile.default]
solc_version = "0.8.25"
solc_version = "0.8.26"
evm_version = "cancun"

optimizer = true
Expand Down
2 changes: 1 addition & 1 deletion lib/forge-std
2 changes: 1 addition & 1 deletion lib/solady
Submodule solady updated 58 files
+1,048 βˆ’990 .gas-snapshot
+1 βˆ’0 .github/workflows/ci-all-via-ir.yml
+10 βˆ’4 .github/workflows/ci.yml
+3 βˆ’0 .gitignore
+4 βˆ’1 README.md
+1 βˆ’1 foundry.toml
+1 βˆ’1 package.json
+11 βˆ’6 src/Milady.sol
+209 βˆ’51 src/accounts/ERC1271.sol
+28 βˆ’8 src/accounts/ERC4337.sol
+59 βˆ’19 src/accounts/ERC6551.sol
+1 βˆ’1 src/utils/CREATE3.sol
+28 βˆ’23 src/utils/DeploylessPredeployQueryer.sol
+754 βˆ’3 src/utils/DynamicBufferLib.sol
+630 βˆ’0 src/utils/EnumerableSetLib.sol
+112 βˆ’66 src/utils/FixedPointMathLib.sol
+9 βˆ’8 src/utils/LibBit.sol
+305 βˆ’1 src/utils/LibClone.sol
+191 βˆ’0 src/utils/LibPRNG.sol
+1 βˆ’1 src/utils/LibSort.sol
+3 βˆ’3 src/utils/LibString.sol
+97 βˆ’0 src/utils/P256.sol
+1 βˆ’1 src/utils/SSTORE2.sol
+284 βˆ’97 src/utils/SafeCastLib.sol
+1 βˆ’1 src/utils/UUPSUpgradeable.sol
+190 βˆ’0 src/utils/UpgradeableBeacon.sol
+47 βˆ’28 test/DeploylessPredeployQueryer.t.sol
+136 βˆ’0 test/DynamicBufferLib.t.sol
+315 βˆ’0 test/ERC1271.t.sol
+5 βˆ’1 test/ERC20.t.sol
+121 βˆ’60 test/ERC4337.t.sol
+177 βˆ’124 test/ERC4626.t.sol
+78 βˆ’53 test/ERC6551.t.sol
+647 βˆ’0 test/EnumerableSetLib.t.sol
+182 βˆ’12 test/FixedPointMathLib.t.sol
+156 βˆ’8 test/LibClone.t.sol
+0 βˆ’10 test/LibERC6551.t.sol
+245 βˆ’0 test/LibPRNG.t.sol
+25 βˆ’14 test/OwnableRoles.t.sol
+95 βˆ’0 test/P256.t.sol
+919 βˆ’199 test/SafeCastLib.t.sol
+0 βˆ’7 test/SafeTransferLib.t.sol
+197 βˆ’0 test/UpgradeableBeacon.t.sol
+184 βˆ’0 test/utils/Brutalizer.sol
+13 βˆ’160 test/utils/TestPlus.sol
+720 βˆ’93 test/utils/forge-std/Test.sol
+1,826 βˆ’366 test/utils/forge-std/Vm.sol
+0 βˆ’517 test/utils/forge-std/ds-test/test.sol
+2 βˆ’8 test/utils/mocks/MockERC1155.sol
+2 βˆ’8 test/utils/mocks/MockERC20.sol
+2 βˆ’15 test/utils/mocks/MockERC2981.sol
+2 βˆ’8 test/utils/mocks/MockERC4337.sol
+21 βˆ’8 test/utils/mocks/MockERC6551.sol
+2 βˆ’8 test/utils/mocks/MockERC6909.sol
+2 βˆ’15 test/utils/mocks/MockERC721.sol
+8 βˆ’20 test/utils/mocks/MockOwnable.sol
+14 βˆ’26 test/utils/mocks/MockOwnableRoles.sol
+2 βˆ’8 test/utils/mocks/MockUUPSImplementation.sol
Loading

0 comments on commit f14d701

Please sign in to comment.