IArbSys.sol 3.9 KB

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