IArbSys.sol 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity >=0.4.21 <0.9.0;
  3. /**
  4. * @title Precompiled contract that exists in every Arbitrum chain at address(100), 0x0000000000000000000000000000000000000064. Exposes a variety of system-level functionality.
  5. */
  6. interface IArbSys {
  7. /**
  8. * @notice Get internal version number identifying an ArbOS build
  9. * @return version number as int
  10. */
  11. function arbOSVersion() external pure returns (uint256);
  12. function arbChainID() external view returns (uint256);
  13. /**
  14. * @notice Get Arbitrum block number (distinct from L1 block number; Arbitrum genesis block has block number 0)
  15. * @return block number as int
  16. */
  17. function arbBlockNumber() external view returns (uint256);
  18. /**
  19. * @notice Send given amount of Eth to dest from sender.
  20. * This is a convenience function, which is equivalent to calling sendTxToL1 with empty calldataForL1.
  21. * @param destination recipient address on L1
  22. * @return unique identifier for this L2-to-L1 transaction.
  23. */
  24. function withdrawEth(address destination) external payable returns (uint256);
  25. /**
  26. * @notice Send a transaction to L1
  27. * @param destination recipient address on L1
  28. * @param calldataForL1 (optional) calldata for L1 contract call
  29. * @return a unique identifier for this L2-to-L1 transaction.
  30. */
  31. function sendTxToL1(address destination, bytes calldata calldataForL1) external payable returns (uint256);
  32. /**
  33. * @notice get the number of transactions issued by the given external account or the account sequence number of the given contract
  34. * @param account target account
  35. * @return the number of transactions issued by the given external account or the account sequence number of the given contract
  36. */
  37. function getTransactionCount(address account) external view returns (uint256);
  38. /**
  39. * @notice get the value of target L2 storage slot
  40. * This function is only callable from address 0 to prevent contracts from being able to call it
  41. * @param account target account
  42. * @param index target index of storage slot
  43. * @return stotage value for the given account at the given index
  44. */
  45. function getStorageAt(address account, uint256 index) external view returns (uint256);
  46. /**
  47. * @notice check if current call is coming from l1
  48. * @return true if the caller of this was called directly from L1
  49. */
  50. function isTopLevelCall() external view returns (bool);
  51. /**
  52. * @notice check if the caller (of this caller of this) is an aliased L1 contract address
  53. * @return true iff the caller's address is an alias for an L1 contract address
  54. */
  55. function wasMyCallersAddressAliased() external view returns (bool);
  56. /**
  57. * @notice return the address of the caller (of this caller of this), without applying L1 contract address aliasing
  58. * @return address of the caller's caller, without applying L1 contract address aliasing
  59. */
  60. function myCallersAddressWithoutAliasing() external view returns (address);
  61. /**
  62. * @notice map L1 sender contract address to its L2 alias
  63. * @param sender sender address
  64. * @param dest destination address
  65. * @return aliased sender address
  66. */
  67. function mapL1SenderContractAddressToL2Alias(address sender, address dest) external pure returns (address);
  68. /**
  69. * @notice get the caller's amount of available storage gas
  70. * @return amount of storage gas available to the caller
  71. */
  72. function getStorageGasAvailable() external view returns (uint256);
  73. event L2ToL1Transaction(
  74. address caller,
  75. address indexed destination,
  76. uint256 indexed uniqueId,
  77. uint256 indexed batchNumber,
  78. uint256 indexInBatch,
  79. uint256 arbBlockNum,
  80. uint256 ethBlockNum,
  81. uint256 timestamp,
  82. uint256 callvalue,
  83. bytes data
  84. );
  85. }