|
| 1 | +pragma solidity ^0.7.0; |
| 2 | + |
| 3 | +/** @title Precompiled contract that exists in every Arbitrum chain at 0x0000000000000000000000000000000000000066. |
| 4 | +* Allows registering / retrieving addresses at uint indices, saving calldata. |
| 5 | +*/ |
| 6 | +interface ArbAddressTable { |
| 7 | + /** |
| 8 | + * @notice Register an address in the address table |
| 9 | + * @param addr address to register |
| 10 | + * @return index of the address (existing index, or newly created index if not already registered) |
| 11 | + */ |
| 12 | + function register(address addr) external returns(uint); |
| 13 | + |
| 14 | + /** |
| 15 | + * @param addr address to lookup |
| 16 | + * @return index of an address in the address table (revert if address isn't in the table) |
| 17 | + */ |
| 18 | + function lookup(address addr) external view returns(uint); |
| 19 | + |
| 20 | + /** |
| 21 | + * @notice Check whether an address exists in the address table |
| 22 | + * @param addr address to check for presence in table |
| 23 | + * @return true if address is in table |
| 24 | + */ |
| 25 | + function addressExists(address addr) external view returns(bool); |
| 26 | + |
| 27 | + /** |
| 28 | + * @return size of address table (= first unused index) |
| 29 | + */ |
| 30 | + function size() external view returns(uint); |
| 31 | + |
| 32 | + /** |
| 33 | + * @param index index to lookup address |
| 34 | + * @return address at a given index in address table (revert if index is beyond end of table) |
| 35 | + */ |
| 36 | + function lookupIndex(uint index) external view returns(address); |
| 37 | + |
| 38 | + /** |
| 39 | + * @notice read a compressed address from a bytes buffer |
| 40 | + * @param buf bytes buffer containing an address |
| 41 | + * @param offset offset of target address |
| 42 | + * @return resulting address and updated offset into the buffer (revert if buffer is too short) |
| 43 | + */ |
| 44 | + function decompress(bytes calldata buf, uint offset) external pure returns(address, uint); |
| 45 | + |
| 46 | + /** |
| 47 | + * @notice compress an address and return the result |
| 48 | + * @param addr address to comppress |
| 49 | + * @return compressed address bytes |
| 50 | + */ |
| 51 | + function compress(address addr) external returns(bytes memory); |
| 52 | +} |
| 53 | + |
0 commit comments