@arbitrum/nitro-contracts 3.0.0-alpha.2 → 3.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +3 -3
  3. package/build/contracts/@openzeppelin/contracts/access/Ownable.sol/Ownable.dbg.json +1 -1
  4. package/build/contracts/@openzeppelin/contracts/interfaces/draft-IERC1822.sol/IERC1822Proxiable.dbg.json +1 -1
  5. package/build/contracts/@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol/ERC1967Proxy.dbg.json +1 -1
  6. package/build/contracts/@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol/ERC1967Upgrade.dbg.json +1 -1
  7. package/build/contracts/@openzeppelin/contracts/proxy/Proxy.sol/Proxy.dbg.json +1 -1
  8. package/build/contracts/@openzeppelin/contracts/proxy/beacon/IBeacon.sol/IBeacon.dbg.json +1 -1
  9. package/build/contracts/@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol/UpgradeableBeacon.dbg.json +1 -1
  10. package/build/contracts/@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol/ProxyAdmin.dbg.json +1 -1
  11. package/build/contracts/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.dbg.json +1 -1
  12. package/build/contracts/@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol/UUPSUpgradeable.dbg.json +1 -1
  13. package/build/contracts/@openzeppelin/contracts/security/ReentrancyGuard.sol/ReentrancyGuard.dbg.json +1 -1
  14. package/build/contracts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json +1 -1
  15. package/build/contracts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json +1 -1
  16. package/build/contracts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.dbg.json +1 -1
  17. package/build/contracts/@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol/IERC20Permit.dbg.json +1 -1
  18. package/build/contracts/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol/SafeERC20.dbg.json +1 -1
  19. package/build/contracts/@openzeppelin/contracts/utils/Address.sol/Address.dbg.json +1 -1
  20. package/build/contracts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json +1 -1
  21. package/build/contracts/@openzeppelin/contracts/utils/Create2.sol/Create2.dbg.json +1 -1
  22. package/build/contracts/@openzeppelin/contracts/utils/StorageSlot.sol/StorageSlot.dbg.json +1 -1
  23. package/build/contracts/@openzeppelin/contracts/utils/Strings.sol/Strings.dbg.json +1 -1
  24. package/build/contracts/@openzeppelin/contracts/utils/cryptography/ECDSA.sol/ECDSA.dbg.json +4 -0
  25. package/build/contracts/@openzeppelin/contracts/utils/cryptography/ECDSA.sol/ECDSA.json +10 -0
  26. package/build/contracts/@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol/AccessControlEnumerableUpgradeable.dbg.json +4 -0
  27. package/build/contracts/@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol/AccessControlEnumerableUpgradeable.json +271 -0
  28. package/build/contracts/@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol/AccessControlUpgradeable.dbg.json +1 -1
  29. package/build/contracts/@openzeppelin/contracts-upgradeable/access/IAccessControlEnumerableUpgradeable.sol/IAccessControlEnumerableUpgradeable.dbg.json +4 -0
  30. package/build/contracts/@openzeppelin/contracts-upgradeable/access/IAccessControlEnumerableUpgradeable.sol/IAccessControlEnumerableUpgradeable.json +226 -0
  31. package/build/contracts/@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol/IAccessControlUpgradeable.dbg.json +1 -1
  32. package/build/contracts/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol/OwnableUpgradeable.dbg.json +1 -1
  33. package/build/contracts/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol/Initializable.dbg.json +1 -1
  34. package/build/contracts/@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol/PausableUpgradeable.dbg.json +1 -1
  35. package/build/contracts/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol/ERC20Upgradeable.dbg.json +4 -0
  36. package/build/contracts/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol/ERC20Upgradeable.json +294 -0
  37. package/build/contracts/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol/IERC20Upgradeable.dbg.json +4 -0
  38. package/build/contracts/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol/IERC20Upgradeable.json +194 -0
  39. package/build/contracts/@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol/ERC20BurnableUpgradeable.dbg.json +4 -0
  40. package/build/contracts/@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol/ERC20BurnableUpgradeable.json +325 -0
  41. package/build/contracts/@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol/IERC20MetadataUpgradeable.dbg.json +4 -0
  42. package/build/contracts/@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol/IERC20MetadataUpgradeable.json +233 -0
  43. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol/AddressUpgradeable.dbg.json +1 -1
  44. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol/ContextUpgradeable.dbg.json +1 -1
  45. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/Create2Upgradeable.sol/Create2Upgradeable.dbg.json +1 -1
  46. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol/StorageSlotUpgradeable.dbg.json +1 -1
  47. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol/StringsUpgradeable.dbg.json +1 -1
  48. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol/ECDSAUpgradeable.dbg.json +4 -0
  49. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol/ECDSAUpgradeable.json +10 -0
  50. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol/EIP712Upgradeable.dbg.json +4 -0
  51. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol/EIP712Upgradeable.json +24 -0
  52. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol/ERC165Upgradeable.dbg.json +1 -1
  53. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol/IERC165Upgradeable.dbg.json +1 -1
  54. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol/EnumerableSetUpgradeable.dbg.json +1 -1
  55. package/build/contracts/src/assertionStakingPool/AbsBoldStakingPool.sol/AbsBoldStakingPool.dbg.json +1 -1
  56. package/build/contracts/src/assertionStakingPool/AssertionStakingPool.sol/AssertionStakingPool.dbg.json +1 -1
  57. package/build/contracts/src/assertionStakingPool/AssertionStakingPoolCreator.sol/AssertionStakingPoolCreator.dbg.json +1 -1
  58. package/build/contracts/src/assertionStakingPool/EdgeStakingPool.sol/EdgeStakingPool.dbg.json +1 -1
  59. package/build/contracts/src/assertionStakingPool/EdgeStakingPoolCreator.sol/EdgeStakingPoolCreator.dbg.json +1 -1
  60. package/build/contracts/src/assertionStakingPool/StakingPoolCreatorUtils.sol/StakingPoolCreatorUtils.dbg.json +1 -1
  61. package/build/contracts/src/assertionStakingPool/interfaces/IAbsBoldStakingPool.sol/IAbsBoldStakingPool.dbg.json +1 -1
  62. package/build/contracts/src/assertionStakingPool/interfaces/IAssertionStakingPool.sol/IAssertionStakingPool.dbg.json +1 -1
  63. package/build/contracts/src/assertionStakingPool/interfaces/IAssertionStakingPoolCreator.sol/IAssertionStakingPoolCreator.dbg.json +1 -1
  64. package/build/contracts/src/assertionStakingPool/interfaces/IEdgeStakingPool.sol/IEdgeStakingPool.dbg.json +1 -1
  65. package/build/contracts/src/assertionStakingPool/interfaces/IEdgeStakingPoolCreator.sol/IEdgeStakingPoolCreator.dbg.json +1 -1
  66. package/build/contracts/src/bridge/AbsBridge.sol/AbsBridge.dbg.json +1 -1
  67. package/build/contracts/src/bridge/AbsInbox.sol/AbsInbox.dbg.json +1 -1
  68. package/build/contracts/src/bridge/AbsOutbox.sol/AbsOutbox.dbg.json +1 -1
  69. package/build/contracts/src/bridge/Bridge.sol/Bridge.dbg.json +1 -1
  70. package/build/contracts/src/bridge/Bridge.sol/Bridge.json +2 -2
  71. package/build/contracts/src/bridge/DelayBuffer.sol/DelayBuffer.dbg.json +1 -1
  72. package/build/contracts/src/bridge/ERC20Bridge.sol/ERC20Bridge.dbg.json +1 -1
  73. package/build/contracts/src/bridge/ERC20Bridge.sol/ERC20Bridge.json +2 -2
  74. package/build/contracts/src/bridge/ERC20Inbox.sol/ERC20Inbox.dbg.json +1 -1
  75. package/build/contracts/src/bridge/ERC20Outbox.sol/ERC20Outbox.dbg.json +1 -1
  76. package/build/contracts/src/bridge/GasRefunder.sol/GasRefunder.dbg.json +1 -1
  77. package/build/contracts/src/bridge/IBridge.sol/IBridge.dbg.json +1 -1
  78. package/build/contracts/src/bridge/IDelayedMessageProvider.sol/IDelayedMessageProvider.dbg.json +1 -1
  79. package/build/contracts/src/bridge/IERC20Bridge.sol/IERC20Bridge.dbg.json +1 -1
  80. package/build/contracts/src/bridge/IERC20Inbox.sol/IERC20Inbox.dbg.json +1 -1
  81. package/build/contracts/src/bridge/IEthBridge.sol/IEthBridge.dbg.json +1 -1
  82. package/build/contracts/src/bridge/IInbox.sol/IInbox.dbg.json +1 -1
  83. package/build/contracts/src/bridge/IInboxBase.sol/IInboxBase.dbg.json +1 -1
  84. package/build/contracts/src/bridge/IOutbox.sol/IOutbox.dbg.json +1 -1
  85. package/build/contracts/src/bridge/IOwnable.sol/IOwnable.dbg.json +1 -1
  86. package/build/contracts/src/bridge/ISequencerInbox.sol/ISequencerInbox.dbg.json +1 -1
  87. package/build/contracts/src/bridge/Inbox.sol/Inbox.dbg.json +1 -1
  88. package/build/contracts/src/bridge/Messages.sol/Messages.dbg.json +1 -1
  89. package/build/contracts/src/bridge/Outbox.sol/Outbox.dbg.json +1 -1
  90. package/build/contracts/src/bridge/SequencerInbox.sol/SequencerInbox.dbg.json +1 -1
  91. package/build/contracts/src/chain/CacheManager.sol/CacheManager.dbg.json +1 -1
  92. package/build/contracts/src/challengeV2/IAssertionChain.sol/IAssertionChain.dbg.json +1 -1
  93. package/build/contracts/src/challengeV2/IEdgeChallengeManager.sol/IEdgeChallengeManager.dbg.json +1 -1
  94. package/build/contracts/src/challengeV2/libraries/ArrayUtilsLib.sol/ArrayUtilsLib.dbg.json +1 -1
  95. package/build/contracts/src/challengeV2/libraries/ChallengeEdgeLib.sol/ChallengeEdgeLib.dbg.json +1 -1
  96. package/build/contracts/src/challengeV2/libraries/EdgeChallengeManagerLib.sol/EdgeChallengeManagerLib.dbg.json +1 -1
  97. package/build/contracts/src/challengeV2/libraries/MerkleTreeAccumulatorLib.sol/MerkleTreeAccumulatorLib.dbg.json +1 -1
  98. package/build/contracts/src/challengeV2/libraries/UintUtilsLib.sol/UintUtilsLib.dbg.json +1 -1
  99. package/build/contracts/src/express-lane-auction/Balance.sol/BalanceLib.dbg.json +4 -0
  100. package/build/contracts/src/express-lane-auction/Balance.sol/BalanceLib.json +10 -0
  101. package/build/contracts/src/express-lane-auction/Burner.sol/Burner.dbg.json +4 -0
  102. package/build/contracts/src/express-lane-auction/Burner.sol/Burner.json +47 -0
  103. package/build/contracts/src/express-lane-auction/ELCRound.sol/LatestELCRoundsLib.dbg.json +4 -0
  104. package/build/contracts/src/express-lane-auction/ELCRound.sol/LatestELCRoundsLib.json +10 -0
  105. package/build/contracts/src/express-lane-auction/ExpressLaneAuction.sol/ExpressLaneAuction.dbg.json +4 -0
  106. package/build/contracts/src/express-lane-auction/ExpressLaneAuction.sol/ExpressLaneAuction.json +1601 -0
  107. package/build/contracts/src/express-lane-auction/IExpressLaneAuction.sol/IExpressLaneAuction.dbg.json +4 -0
  108. package/build/contracts/src/express-lane-auction/IExpressLaneAuction.sol/IExpressLaneAuction.json +1296 -0
  109. package/build/contracts/src/express-lane-auction/RoundTimingInfo.sol/RoundTimingInfoLib.dbg.json +4 -0
  110. package/build/contracts/src/express-lane-auction/RoundTimingInfo.sol/RoundTimingInfoLib.json +10 -0
  111. package/build/contracts/src/libraries/AddressAliasHelper.sol/AddressAliasHelper.dbg.json +1 -1
  112. package/build/contracts/src/libraries/AdminFallbackProxy.sol/AdminFallbackProxy.dbg.json +1 -1
  113. package/build/contracts/src/libraries/AdminFallbackProxy.sol/DoubleLogicERC1967Upgrade.dbg.json +1 -1
  114. package/build/contracts/src/libraries/ArbitrumChecker.sol/ArbitrumChecker.dbg.json +1 -1
  115. package/build/contracts/src/libraries/CallerChecker.sol/CallerChecker.dbg.json +1 -1
  116. package/build/contracts/src/libraries/CryptographyPrimitives.sol/CryptographyPrimitives.dbg.json +1 -1
  117. package/build/contracts/src/libraries/DecimalsConverterHelper.sol/DecimalsConverterHelper.dbg.json +1 -1
  118. package/build/contracts/src/libraries/DelegateCallAware.sol/DelegateCallAware.dbg.json +1 -1
  119. package/build/contracts/src/libraries/DoubleLogicUUPSUpgradeable.sol/DoubleLogicUUPSUpgradeable.dbg.json +1 -1
  120. package/build/contracts/src/libraries/GasRefundEnabled.sol/GasRefundEnabled.dbg.json +1 -1
  121. package/build/contracts/src/libraries/IGasRefunder.sol/IGasRefunder.dbg.json +1 -1
  122. package/build/contracts/src/libraries/IReader4844.sol/IReader4844.dbg.json +1 -1
  123. package/build/contracts/src/libraries/MerkleLib.sol/MerkleLib.dbg.json +1 -1
  124. package/build/contracts/src/libraries/UUPSNotUpgradeable.sol/UUPSNotUpgradeable.dbg.json +1 -1
  125. package/build/contracts/src/mocks/Benchmarks.sol/Benchmarks.dbg.json +1 -1
  126. package/build/contracts/src/mocks/BridgeStub.sol/BridgeStub.dbg.json +1 -1
  127. package/build/contracts/src/mocks/BridgeUnproxied.sol/BridgeUnproxied.dbg.json +1 -1
  128. package/build/contracts/src/mocks/BridgeUnproxied.sol/BridgeUnproxied.json +2 -2
  129. package/build/contracts/src/mocks/CreateTest.sol/CreateTest.dbg.json +1 -1
  130. package/build/contracts/src/mocks/InboxStub.sol/InboxStub.dbg.json +1 -1
  131. package/build/contracts/src/mocks/MerkleTreeAccess.sol/MerkleTreeAccess.dbg.json +1 -1
  132. package/build/contracts/src/mocks/MockRollupEventInbox.sol/MockRollupEventInbox.dbg.json +1 -1
  133. package/build/contracts/src/mocks/MultiCallTest.sol/MultiCallTest.dbg.json +1 -1
  134. package/build/contracts/src/mocks/PendingBlkTimeAndNrAdvanceCheck.sol/PendingBlkTimeAndNrAdvanceCheck.dbg.json +1 -1
  135. package/build/contracts/src/mocks/Program.sol/ProgramTest.dbg.json +1 -1
  136. package/build/contracts/src/mocks/ProxyAdminForBinding.sol/ProxyAdminForBinding.dbg.json +1 -1
  137. package/build/contracts/src/mocks/SdkStorage.sol/SdkStorage.dbg.json +1 -1
  138. package/build/contracts/src/mocks/SequencerInboxBlobMock.sol/SequencerInboxBlobMock.dbg.json +1 -1
  139. package/build/contracts/src/mocks/SequencerInboxStub.sol/SequencerInboxStub.dbg.json +1 -1
  140. package/build/contracts/src/mocks/Simple.sol/Simple.dbg.json +1 -1
  141. package/build/contracts/src/mocks/SimpleCacheManager.sol/SimpleCacheManager.dbg.json +1 -1
  142. package/build/contracts/src/mocks/SimpleOneStepProofEntry.sol/SimpleOneStepProofEntry.dbg.json +1 -1
  143. package/build/contracts/src/mocks/SimpleProxy.sol/SimpleProxy.dbg.json +1 -1
  144. package/build/contracts/src/mocks/TestWETH9.sol/IWETH9.dbg.json +1 -1
  145. package/build/contracts/src/mocks/TestWETH9.sol/TestWETH9.dbg.json +1 -1
  146. package/build/contracts/src/mocks/UpgradeExecutorMock.sol/UpgradeExecutorMock.dbg.json +1 -1
  147. package/build/contracts/src/node-interface/NodeInterface.sol/NodeInterface.dbg.json +1 -1
  148. package/build/contracts/src/node-interface/NodeInterfaceDebug.sol/NodeInterfaceDebug.dbg.json +1 -1
  149. package/build/contracts/src/osp/HashProofHelper.sol/HashProofHelper.dbg.json +1 -1
  150. package/build/contracts/src/osp/IOneStepProofEntry.sol/IOneStepProofEntry.dbg.json +1 -1
  151. package/build/contracts/src/osp/IOneStepProofEntry.sol/OneStepProofEntryLib.dbg.json +1 -1
  152. package/build/contracts/src/osp/IOneStepProver.sol/IOneStepProver.dbg.json +1 -1
  153. package/build/contracts/src/osp/OneStepProofEntry.sol/OneStepProofEntry.dbg.json +1 -1
  154. package/build/contracts/src/osp/OneStepProver0.sol/OneStepProver0.dbg.json +1 -1
  155. package/build/contracts/src/osp/OneStepProverHostIo.sol/OneStepProverHostIo.dbg.json +1 -1
  156. package/build/contracts/src/osp/OneStepProverMath.sol/OneStepProverMath.dbg.json +1 -1
  157. package/build/contracts/src/osp/OneStepProverMemory.sol/OneStepProverMemory.dbg.json +1 -1
  158. package/build/contracts/src/precompiles/ArbAddressTable.sol/ArbAddressTable.dbg.json +1 -1
  159. package/build/contracts/src/precompiles/ArbAggregator.sol/ArbAggregator.dbg.json +1 -1
  160. package/build/contracts/src/precompiles/ArbBLS.sol/ArbBLS.dbg.json +1 -1
  161. package/build/contracts/src/precompiles/ArbDebug.sol/ArbDebug.dbg.json +1 -1
  162. package/build/contracts/src/precompiles/ArbFunctionTable.sol/ArbFunctionTable.dbg.json +1 -1
  163. package/build/contracts/src/precompiles/ArbGasInfo.sol/ArbGasInfo.dbg.json +1 -1
  164. package/build/contracts/src/precompiles/ArbInfo.sol/ArbInfo.dbg.json +1 -1
  165. package/build/contracts/src/precompiles/ArbOwner.sol/ArbOwner.dbg.json +1 -1
  166. package/build/contracts/src/precompiles/ArbOwnerPublic.sol/ArbOwnerPublic.dbg.json +1 -1
  167. package/build/contracts/src/precompiles/ArbRetryableTx.sol/ArbRetryableTx.dbg.json +1 -1
  168. package/build/contracts/src/precompiles/ArbStatistics.sol/ArbStatistics.dbg.json +1 -1
  169. package/build/contracts/src/precompiles/ArbSys.sol/ArbSys.dbg.json +1 -1
  170. package/build/contracts/src/precompiles/ArbWasm.sol/ArbWasm.dbg.json +1 -1
  171. package/build/contracts/src/precompiles/ArbWasmCache.sol/ArbWasmCache.dbg.json +1 -1
  172. package/build/contracts/src/precompiles/ArbosActs.sol/ArbosActs.dbg.json +1 -1
  173. package/build/contracts/src/precompiles/ArbosTest.sol/ArbosTest.dbg.json +1 -1
  174. package/build/contracts/src/rollup/AbsRollupEventInbox.sol/AbsRollupEventInbox.dbg.json +1 -1
  175. package/build/contracts/src/rollup/Assertion.sol/AssertionNodeLib.dbg.json +1 -1
  176. package/build/contracts/src/rollup/AssertionState.sol/AssertionStateLib.dbg.json +1 -1
  177. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/BOLDUpgradeAction.dbg.json +1 -1
  178. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/BOLDUpgradeAction.json +84 -32
  179. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/ConstantArrayStorage.dbg.json +1 -1
  180. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/ConstantArrayStorage.json +2 -2
  181. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/IOldRollup.dbg.json +1 -1
  182. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/IOldRollup.json +45 -0
  183. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/IOldRollupAdmin.dbg.json +1 -1
  184. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/ISeqInboxPostUpgradeInit.dbg.json +1 -1
  185. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/StateHashPreImageLookup.dbg.json +1 -1
  186. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/StateHashPreImageLookup.json +2 -2
  187. package/build/contracts/src/rollup/BridgeCreator.sol/BridgeCreator.dbg.json +1 -1
  188. package/build/contracts/src/rollup/BridgeCreator.sol/BridgeCreator.json +2 -2
  189. package/build/contracts/src/rollup/DeployHelper.sol/DeployHelper.dbg.json +1 -1
  190. package/build/contracts/src/rollup/ERC20RollupEventInbox.sol/ERC20RollupEventInbox.dbg.json +1 -1
  191. package/build/contracts/src/rollup/FactoryDeployerHelper.sol/FactoryDeployerHelper.dbg.json +1 -1
  192. package/build/contracts/src/rollup/FactoryDeployerHelper.sol/IDeployHelper.dbg.json +1 -1
  193. package/build/contracts/src/rollup/FactoryDeployerHelper.sol/IERC20.dbg.json +1 -1
  194. package/build/contracts/src/rollup/FactoryDeployerHelper.sol/IERC20Bridge.dbg.json +1 -1
  195. package/build/contracts/src/rollup/FactoryDeployerHelper.sol/IInboxBase.dbg.json +1 -1
  196. package/build/contracts/src/rollup/IRollupAdmin.sol/IRollupAdmin.dbg.json +1 -1
  197. package/build/contracts/src/rollup/IRollupAdmin.sol/IRollupAdmin.json +10 -0
  198. package/build/contracts/src/rollup/IRollupCore.sol/IRollupCore.dbg.json +1 -1
  199. package/build/contracts/src/rollup/IRollupEventInbox.sol/IRollupEventInbox.dbg.json +1 -1
  200. package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUser.dbg.json +1 -1
  201. package/build/contracts/src/rollup/RollupAdminLogic.sol/RollupAdminLogic.dbg.json +1 -1
  202. package/build/contracts/src/rollup/RollupAdminLogic.sol/RollupAdminLogic.json +12 -2
  203. package/build/contracts/src/rollup/RollupCore.sol/RollupCore.dbg.json +1 -1
  204. package/build/contracts/src/rollup/RollupCreator.sol/RollupCreator.dbg.json +1 -1
  205. package/build/contracts/src/rollup/RollupCreator.sol/RollupCreator.json +12 -2
  206. package/build/contracts/src/rollup/RollupEventInbox.sol/RollupEventInbox.dbg.json +1 -1
  207. package/build/contracts/src/rollup/RollupLib.sol/RollupLib.dbg.json +1 -1
  208. package/build/contracts/src/rollup/RollupProxy.sol/RollupProxy.dbg.json +1 -1
  209. package/build/contracts/src/rollup/RollupProxy.sol/RollupProxy.json +12 -2
  210. package/build/contracts/src/rollup/ValidatorWallet.sol/ValidatorWallet.dbg.json +1 -1
  211. package/build/contracts/src/rollup/ValidatorWalletCreator.sol/ValidatorWalletCreator.dbg.json +1 -1
  212. package/build/contracts/src/state/Deserialize.sol/Deserialize.dbg.json +1 -1
  213. package/build/contracts/src/state/GlobalState.sol/GlobalStateLib.dbg.json +1 -1
  214. package/build/contracts/src/state/Instructions.sol/Instructions.dbg.json +1 -1
  215. package/build/contracts/src/state/Machine.sol/MachineLib.dbg.json +1 -1
  216. package/build/contracts/src/state/MerkleProof.sol/MerkleProofLib.dbg.json +1 -1
  217. package/build/contracts/src/state/Module.sol/ModuleLib.dbg.json +1 -1
  218. package/build/contracts/src/state/ModuleMemory.sol/ModuleMemoryLib.dbg.json +1 -1
  219. package/build/contracts/src/state/ModuleMemoryCompact.sol/ModuleMemoryCompactLib.dbg.json +1 -1
  220. package/build/contracts/src/state/MultiStack.sol/MultiStackLib.dbg.json +1 -1
  221. package/build/contracts/src/state/PcArray.sol/PcArrayLib.dbg.json +1 -1
  222. package/build/contracts/src/state/StackFrame.sol/StackFrameLib.dbg.json +1 -1
  223. package/build/contracts/src/state/Value.sol/ValueLib.dbg.json +1 -1
  224. package/build/contracts/src/state/ValueArray.sol/ValueArrayLib.dbg.json +1 -1
  225. package/build/contracts/src/state/ValueStack.sol/ValueStackLib.dbg.json +1 -1
  226. package/build/contracts/src/test-helpers/BridgeTester.sol/BridgeTester.dbg.json +1 -1
  227. package/build/contracts/src/test-helpers/CryptographyPrimitivesTester.sol/CryptographyPrimitivesTester.dbg.json +1 -1
  228. package/build/contracts/src/test-helpers/EthVault.sol/EthVault.dbg.json +1 -1
  229. package/build/contracts/src/test-helpers/MessageTester.sol/MessageTester.dbg.json +1 -1
  230. package/build/contracts/src/test-helpers/OutboxWithoutOptTester.sol/OutboxWithoutOptTester.dbg.json +1 -1
  231. package/build/contracts/src/test-helpers/RollupMock.sol/RollupMock.dbg.json +1 -1
  232. package/build/contracts/src/test-helpers/TestToken.sol/TestToken.dbg.json +1 -1
  233. package/build/contracts/src/test-helpers/ValueArrayTester.sol/ValueArrayTester.dbg.json +1 -1
  234. package/package.json +2 -3
  235. package/src/bridge/AbsBridge.sol +2 -2
  236. package/src/bridge/ERC20Bridge.sol +6 -2
  237. package/src/express-lane-auction/Balance.sol +137 -0
  238. package/src/express-lane-auction/Burner.sol +26 -0
  239. package/src/express-lane-auction/ELCRound.sol +70 -0
  240. package/src/express-lane-auction/Errors.sol +31 -0
  241. package/src/express-lane-auction/ExpressLaneAuction.sol +567 -0
  242. package/src/express-lane-auction/IExpressLaneAuction.sol +441 -0
  243. package/src/express-lane-auction/RoundTimingInfo.sol +118 -0
  244. package/src/rollup/BOLDUpgradeAction.sol +53 -104
  245. package/src/rollup/BridgeCreator.sol +23 -5
  246. package/src/rollup/Config.sol +2 -0
  247. package/src/rollup/RollupAdminLogic.sol +4 -4
  248. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/RollupReader.dbg.json +0 -4
  249. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/RollupReader.json +0 -385
@@ -0,0 +1,567 @@
1
+ // SPDX-License-Identifier: BUSL-1.1
2
+ pragma solidity ^0.8.0;
3
+
4
+ import "./Errors.sol";
5
+ import {Balance, BalanceLib} from "./Balance.sol";
6
+ import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
7
+ import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
8
+ import {AccessControlEnumerableUpgradeable} from
9
+ "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol";
10
+ import {DelegateCallAware} from "../libraries/DelegateCallAware.sol";
11
+ import {IExpressLaneAuction, Bid, InitArgs, Transferor} from "./IExpressLaneAuction.sol";
12
+ import {ELCRound, LatestELCRoundsLib} from "./ELCRound.sol";
13
+ import {RoundTimingInfo, RoundTimingInfoLib} from "./RoundTimingInfo.sol";
14
+ import {EIP712Upgradeable} from
15
+ "@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol";
16
+
17
+ /// @title ExpressLaneAuction
18
+ /// @notice The express lane allows a controller to submit undelayed transactions to the sequencer
19
+ /// The right to be the express lane controller are auctioned off in rounds, by an offchain auctioneer.
20
+ /// The auctioneer then submits the winning bids to this control to deduct funds from the bidders and register the winner
21
+ contract ExpressLaneAuction is
22
+ IExpressLaneAuction,
23
+ AccessControlEnumerableUpgradeable,
24
+ DelegateCallAware,
25
+ EIP712Upgradeable
26
+ {
27
+ using SafeERC20 for IERC20;
28
+ using RoundTimingInfoLib for RoundTimingInfo;
29
+ using BalanceLib for Balance;
30
+ using ECDSA for bytes32;
31
+ using ECDSA for bytes;
32
+ using LatestELCRoundsLib for ELCRound[2];
33
+
34
+ /// @inheritdoc IExpressLaneAuction
35
+ bytes32 public constant AUCTIONEER_ROLE = keccak256("AUCTIONEER");
36
+ /// @inheritdoc IExpressLaneAuction
37
+ bytes32 public constant AUCTIONEER_ADMIN_ROLE = keccak256("AUCTIONEER_ADMIN");
38
+ /// @inheritdoc IExpressLaneAuction
39
+ bytes32 public constant MIN_RESERVE_SETTER_ROLE = keccak256("MIN_RESERVE_SETTER");
40
+ /// @inheritdoc IExpressLaneAuction
41
+ bytes32 public constant RESERVE_SETTER_ROLE = keccak256("RESERVE_SETTER");
42
+ /// @inheritdoc IExpressLaneAuction
43
+ bytes32 public constant RESERVE_SETTER_ADMIN_ROLE = keccak256("RESERVE_SETTER_ADMIN");
44
+ /// @inheritdoc IExpressLaneAuction
45
+ bytes32 public constant BENEFICIARY_SETTER_ROLE = keccak256("BENEFICIARY_SETTER");
46
+ /// @inheritdoc IExpressLaneAuction
47
+ bytes32 public constant ROUND_TIMING_SETTER_ROLE = keccak256("ROUND_TIMING_SETTER");
48
+
49
+ /// @notice The balances of each address
50
+ mapping(address => Balance) internal _balanceOf;
51
+
52
+ /// @dev Recently resolved round information. Contains the two most recently resolved rounds
53
+ ELCRound[2] internal latestResolvedRounds;
54
+
55
+ /// @inheritdoc IExpressLaneAuction
56
+ address public beneficiary;
57
+
58
+ /// @inheritdoc IExpressLaneAuction
59
+ IERC20 public biddingToken;
60
+
61
+ /// @inheritdoc IExpressLaneAuction
62
+ uint256 public reservePrice;
63
+
64
+ /// @inheritdoc IExpressLaneAuction
65
+ uint256 public minReservePrice;
66
+
67
+ /// @inheritdoc IExpressLaneAuction
68
+ RoundTimingInfo public roundTimingInfo;
69
+
70
+ /// @inheritdoc IExpressLaneAuction
71
+ uint256 public beneficiaryBalance;
72
+
73
+ /// @inheritdoc IExpressLaneAuction
74
+ mapping(address => Transferor) public transferorOf;
75
+
76
+ /// @inheritdoc IExpressLaneAuction
77
+ function initialize(
78
+ InitArgs calldata args
79
+ ) public initializer onlyDelegated {
80
+ __AccessControl_init();
81
+ __EIP712_init("ExpressLaneAuction", "1");
82
+
83
+ if (address(args._biddingToken) == address(0)) {
84
+ revert ZeroBiddingToken();
85
+ }
86
+ biddingToken = IERC20(args._biddingToken);
87
+
88
+ beneficiary = args._beneficiary;
89
+ emit SetBeneficiary(address(0), args._beneficiary);
90
+
91
+ minReservePrice = args._minReservePrice;
92
+ emit SetMinReservePrice(0, args._minReservePrice);
93
+
94
+ reservePrice = args._minReservePrice;
95
+ emit SetReservePrice(0, args._minReservePrice);
96
+
97
+ // the initial timestamp cannot be negative
98
+ if (args._roundTimingInfo.offsetTimestamp < 0) {
99
+ revert NegativeOffset();
100
+ }
101
+ setRoundTimingInfoInternal(args._roundTimingInfo);
102
+
103
+ // roles without a custom role admin set will have this as the admin
104
+ _grantRole(DEFAULT_ADMIN_ROLE, args._masterAdmin);
105
+ _grantRole(MIN_RESERVE_SETTER_ROLE, args._minReservePriceSetter);
106
+ _grantRole(BENEFICIARY_SETTER_ROLE, args._beneficiarySetter);
107
+
108
+ // the following roles are expected to be controlled by hot wallets, so we add
109
+ // additional custom admin role for each of them to allow for key rotation management
110
+ setRoleAndAdmin(
111
+ AUCTIONEER_ROLE, args._auctioneer, AUCTIONEER_ADMIN_ROLE, args._auctioneerAdmin
112
+ );
113
+ setRoleAndAdmin(
114
+ RESERVE_SETTER_ROLE,
115
+ args._reservePriceSetter,
116
+ RESERVE_SETTER_ADMIN_ROLE,
117
+ args._reservePriceSetterAdmin
118
+ );
119
+ _grantRole(ROUND_TIMING_SETTER_ROLE, args._roundTimingSetter);
120
+ }
121
+
122
+ /// @notice Set an address for a role, an admin role for the role, and an address for the admin role
123
+ function setRoleAndAdmin(
124
+ bytes32 role,
125
+ address roleAddr,
126
+ bytes32 adminRole,
127
+ address adminRoleAddr
128
+ ) internal {
129
+ _grantRole(role, roleAddr);
130
+ _grantRole(adminRole, adminRoleAddr);
131
+ _setRoleAdmin(role, adminRole);
132
+ }
133
+
134
+ /// @inheritdoc IExpressLaneAuction
135
+ function currentRound() external view returns (uint64) {
136
+ return roundTimingInfo.currentRound();
137
+ }
138
+
139
+ /// @inheritdoc IExpressLaneAuction
140
+ function isAuctionRoundClosed() external view returns (bool) {
141
+ return roundTimingInfo.isAuctionRoundClosed();
142
+ }
143
+
144
+ /// @inheritdoc IExpressLaneAuction
145
+ function isReserveBlackout() external view returns (bool) {
146
+ (ELCRound storage lastRoundResolved,) = latestResolvedRounds.latestELCRound();
147
+ return roundTimingInfo.isReserveBlackout(lastRoundResolved.round);
148
+ }
149
+
150
+ /// @inheritdoc IExpressLaneAuction
151
+ function roundTimestamps(
152
+ uint64 round
153
+ ) external view returns (uint64, uint64) {
154
+ return roundTimingInfo.roundTimestamps(round);
155
+ }
156
+
157
+ /// @inheritdoc IExpressLaneAuction
158
+ function setBeneficiary(
159
+ address newBeneficiary
160
+ ) external onlyRole(BENEFICIARY_SETTER_ROLE) {
161
+ emit SetBeneficiary(beneficiary, newBeneficiary);
162
+ beneficiary = newBeneficiary;
163
+ }
164
+
165
+ function _setReservePrice(
166
+ uint256 newReservePrice
167
+ ) private {
168
+ if (newReservePrice < minReservePrice) {
169
+ revert ReservePriceTooLow(newReservePrice, minReservePrice);
170
+ }
171
+
172
+ emit SetReservePrice(reservePrice, newReservePrice);
173
+ reservePrice = newReservePrice;
174
+ }
175
+
176
+ function setRoundTimingInfoInternal(
177
+ RoundTimingInfo calldata newRoundTimingInfo
178
+ ) internal {
179
+ // auction closing seconds of 0 wouldnt make sense as it would then be impossible to close the round
180
+ // due to the check below this also causes round duration > 0
181
+ if (newRoundTimingInfo.auctionClosingSeconds == 0) {
182
+ revert ZeroAuctionClosingSeconds();
183
+ }
184
+
185
+ // ensure that round duration cannot be too high, other wise this could be used to lock balances
186
+ // in the contract by setting round duration = uint.max
187
+ if (newRoundTimingInfo.roundDurationSeconds > 1 days) {
188
+ revert RoundTooLong(newRoundTimingInfo.roundDurationSeconds);
189
+ }
190
+
191
+ // the same check as in initialization - reserve submission and auction closing are non overlapping
192
+ // sub sections of a round, so must fit within it
193
+ if (
194
+ newRoundTimingInfo.reserveSubmissionSeconds + newRoundTimingInfo.auctionClosingSeconds
195
+ > newRoundTimingInfo.roundDurationSeconds
196
+ ) {
197
+ revert RoundDurationTooShort();
198
+ }
199
+
200
+ roundTimingInfo = newRoundTimingInfo;
201
+ emit SetRoundTimingInfo(
202
+ newRoundTimingInfo.currentRound(),
203
+ newRoundTimingInfo.offsetTimestamp,
204
+ newRoundTimingInfo.roundDurationSeconds,
205
+ newRoundTimingInfo.auctionClosingSeconds,
206
+ newRoundTimingInfo.reserveSubmissionSeconds
207
+ );
208
+ }
209
+
210
+ /// @inheritdoc IExpressLaneAuction
211
+ function setRoundTimingInfo(
212
+ RoundTimingInfo calldata newRoundTimingInfo
213
+ ) external onlyRole(ROUND_TIMING_SETTER_ROLE) {
214
+ RoundTimingInfo memory currentRoundTimingInfo = roundTimingInfo;
215
+ uint64 currentCurrentRound = currentRoundTimingInfo.currentRound();
216
+ uint64 newCurrentRound = newRoundTimingInfo.currentRound();
217
+ // updating round timing info needs to be synchronised
218
+ // so we ensure that the current round won't change
219
+ if (currentCurrentRound != newCurrentRound) {
220
+ revert InvalidNewRound(currentCurrentRound, newCurrentRound);
221
+ }
222
+
223
+ (uint64 currentStart,) = currentRoundTimingInfo.roundTimestamps(currentCurrentRound + 1);
224
+ (uint64 newStart,) = newRoundTimingInfo.roundTimestamps(newCurrentRound + 1);
225
+ // we also ensure that the current round end time/next round start time, will not change
226
+ if (currentStart != newStart) {
227
+ revert InvalidNewStart(currentStart, newStart);
228
+ }
229
+
230
+ setRoundTimingInfoInternal(newRoundTimingInfo);
231
+ }
232
+
233
+ /// @inheritdoc IExpressLaneAuction
234
+ function setMinReservePrice(
235
+ uint256 newMinReservePrice
236
+ ) external onlyRole(MIN_RESERVE_SETTER_ROLE) {
237
+ emit SetMinReservePrice(minReservePrice, newMinReservePrice);
238
+
239
+ minReservePrice = newMinReservePrice;
240
+
241
+ if (newMinReservePrice > reservePrice) {
242
+ _setReservePrice(newMinReservePrice);
243
+ }
244
+ }
245
+
246
+ /// @inheritdoc IExpressLaneAuction
247
+ function setReservePrice(
248
+ uint256 newReservePrice
249
+ ) external onlyRole(RESERVE_SETTER_ROLE) {
250
+ (ELCRound storage lastRoundResolved,) = latestResolvedRounds.latestELCRound();
251
+ if (roundTimingInfo.isReserveBlackout(lastRoundResolved.round)) {
252
+ revert ReserveBlackout();
253
+ }
254
+
255
+ _setReservePrice(newReservePrice);
256
+ }
257
+
258
+ /// @inheritdoc IExpressLaneAuction
259
+ function balanceOf(
260
+ address account
261
+ ) external view returns (uint256) {
262
+ return _balanceOf[account].balanceAtRound(roundTimingInfo.currentRound());
263
+ }
264
+
265
+ /// @inheritdoc IExpressLaneAuction
266
+ function balanceOfAtRound(address account, uint64 round) external view returns (uint256) {
267
+ if (round < roundTimingInfo.currentRound()) {
268
+ revert RoundTooOld(round, roundTimingInfo.currentRound());
269
+ }
270
+ return _balanceOf[account].balanceAtRound(round);
271
+ }
272
+
273
+ /// @inheritdoc IExpressLaneAuction
274
+ function withdrawableBalance(
275
+ address account
276
+ ) external view returns (uint256) {
277
+ return _balanceOf[account].withdrawableBalanceAtRound(roundTimingInfo.currentRound());
278
+ }
279
+
280
+ /// @inheritdoc IExpressLaneAuction
281
+ function withdrawableBalanceAtRound(
282
+ address account,
283
+ uint64 round
284
+ ) external view returns (uint256) {
285
+ if (round < roundTimingInfo.currentRound()) {
286
+ revert RoundTooOld(round, roundTimingInfo.currentRound());
287
+ }
288
+ return _balanceOf[account].withdrawableBalanceAtRound(round);
289
+ }
290
+
291
+ /// @inheritdoc IExpressLaneAuction
292
+ function deposit(
293
+ uint256 amount
294
+ ) external {
295
+ _balanceOf[msg.sender].increase(amount);
296
+ biddingToken.safeTransferFrom(msg.sender, address(this), amount);
297
+ emit Deposit(msg.sender, amount);
298
+ }
299
+
300
+ /// @inheritdoc IExpressLaneAuction
301
+ function initiateWithdrawal() external {
302
+ // The withdrawal can be finalized 2 rounds for now. We dont make it round + 1 in
303
+ // case the initiation were to occur right at the end of a round. Doing round + 2 ensures
304
+ // observers always have at least one full round to become aware of the future balance change.
305
+ uint64 withdrawalRound = roundTimingInfo.currentRound() + 2;
306
+ uint256 amount = _balanceOf[msg.sender].balance;
307
+ _balanceOf[msg.sender].initiateWithdrawal(withdrawalRound);
308
+ emit WithdrawalInitiated(msg.sender, amount, withdrawalRound);
309
+ }
310
+
311
+ /// @inheritdoc IExpressLaneAuction
312
+ function finalizeWithdrawal() external {
313
+ uint256 amountReduced =
314
+ _balanceOf[msg.sender].finalizeWithdrawal(roundTimingInfo.currentRound());
315
+ biddingToken.safeTransfer(msg.sender, amountReduced);
316
+ emit WithdrawalFinalized(msg.sender, amountReduced);
317
+ }
318
+
319
+ /// @inheritdoc IExpressLaneAuction
320
+ function flushBeneficiaryBalance() external {
321
+ uint256 bal = beneficiaryBalance;
322
+ if (bal == 0) {
323
+ revert ZeroAmount();
324
+ }
325
+ beneficiaryBalance = 0;
326
+ biddingToken.safeTransfer(beneficiary, bal);
327
+ }
328
+
329
+ /// @dev Update local state to resolve an auction
330
+ /// @param isMultiBid Where the auction should be resolved from multiple bids
331
+ /// @param firstPriceBid The winning bid
332
+ /// @param firstPriceBidder The winning bidder
333
+ /// @param priceToPay The price that needs to be paid by the winner
334
+ /// @param biddingInRound The round bidding is taking place in. This is not the round the bidding is taking place for, which is biddingInRound + 1
335
+ /// @param roundStart The timestamp at which the bidding for round starts
336
+ /// @param roundEnd The timestamp at which the bidding for round ends
337
+ function resolveAuction(
338
+ bool isMultiBid,
339
+ Bid calldata firstPriceBid,
340
+ address firstPriceBidder,
341
+ uint256 priceToPay,
342
+ uint64 biddingInRound,
343
+ uint64 roundStart,
344
+ uint64 roundEnd
345
+ ) internal {
346
+ // store that a round has been resolved
347
+ uint64 biddingForRound = biddingInRound + 1;
348
+ latestResolvedRounds.setResolvedRound(biddingForRound, firstPriceBid.expressLaneController);
349
+
350
+ // first price bidder pays the beneficiary
351
+ _balanceOf[firstPriceBidder].reduce(priceToPay, biddingInRound);
352
+ beneficiaryBalance += priceToPay;
353
+
354
+ // emit events so that the offchain sequencer knows a new express lane controller has been selected
355
+ emit SetExpressLaneController(
356
+ biddingForRound,
357
+ address(0),
358
+ firstPriceBid.expressLaneController,
359
+ address(0),
360
+ roundStart,
361
+ roundEnd
362
+ );
363
+ emit AuctionResolved(
364
+ isMultiBid,
365
+ biddingForRound,
366
+ firstPriceBidder,
367
+ firstPriceBid.expressLaneController,
368
+ firstPriceBid.amount,
369
+ priceToPay,
370
+ roundStart,
371
+ roundEnd
372
+ );
373
+ }
374
+
375
+ /// @inheritdoc IExpressLaneAuction
376
+ function domainSeparator() external view returns (bytes32) {
377
+ return _domainSeparatorV4();
378
+ }
379
+
380
+ /// @dev Internal bid domain hash
381
+ bytes32 private constant BID_DOMAIN =
382
+ keccak256("Bid(uint64 round,address expressLaneController,uint256 amount)");
383
+
384
+ /// @inheritdoc IExpressLaneAuction
385
+ function getBidHash(
386
+ uint64 round,
387
+ address expressLaneController,
388
+ uint256 amount
389
+ ) public view returns (bytes32) {
390
+ return _hashTypedDataV4(
391
+ keccak256(abi.encode(BID_DOMAIN, round, expressLaneController, amount))
392
+ );
393
+ }
394
+
395
+ /// @notice Recover the signing address of the provided bid, and check that that address has enough funds to fulfil that bid
396
+ /// Returns the signing address and the bid hash that was signed
397
+ /// @param bid The bid to recover the signing address of
398
+ /// @param biddingForRound The round the bid is for the control of
399
+ function recoverAndCheckBalance(
400
+ Bid memory bid,
401
+ uint64 biddingForRound
402
+ ) internal view returns (address, bytes32) {
403
+ bytes32 bidHash = getBidHash(biddingForRound, bid.expressLaneController, bid.amount);
404
+ address bidder = bidHash.recover(bid.signature);
405
+ // we are always bidding for in the current round for the next round
406
+ uint64 curRnd = biddingForRound - 1;
407
+ // always check that the bidder has as much as they're claiming
408
+ if (_balanceOf[bidder].balanceAtRound(curRnd) < bid.amount) {
409
+ revert InsufficientBalanceAcc(
410
+ bidder, bid.amount, _balanceOf[bidder].balanceAtRound(curRnd)
411
+ );
412
+ }
413
+
414
+ return (bidder, bidHash);
415
+ }
416
+
417
+ /// @inheritdoc IExpressLaneAuction
418
+ function resolveSingleBidAuction(
419
+ Bid calldata firstPriceBid
420
+ ) external onlyRole(AUCTIONEER_ROLE) {
421
+ RoundTimingInfo memory info = roundTimingInfo;
422
+ if (!info.isAuctionRoundClosed()) {
423
+ revert AuctionNotClosed();
424
+ }
425
+
426
+ if (firstPriceBid.amount < reservePrice) {
427
+ revert ReservePriceNotMet(firstPriceBid.amount, reservePrice);
428
+ }
429
+
430
+ uint64 biddingInRound = info.currentRound();
431
+ uint64 biddingForRound = biddingInRound + 1;
432
+ (address firstPriceBidder,) = recoverAndCheckBalance(firstPriceBid, biddingForRound);
433
+
434
+ (uint64 roundStart, uint64 roundEnd) = info.roundTimestamps(biddingForRound);
435
+ resolveAuction(
436
+ false,
437
+ firstPriceBid,
438
+ firstPriceBidder,
439
+ reservePrice,
440
+ biddingInRound,
441
+ roundStart,
442
+ roundEnd
443
+ );
444
+ }
445
+
446
+ /// @inheritdoc IExpressLaneAuction
447
+ function resolveMultiBidAuction(
448
+ Bid calldata firstPriceBid,
449
+ Bid calldata secondPriceBid
450
+ ) external onlyRole(AUCTIONEER_ROLE) {
451
+ RoundTimingInfo memory info = roundTimingInfo;
452
+ if (!info.isAuctionRoundClosed()) {
453
+ revert AuctionNotClosed();
454
+ }
455
+
456
+ if (firstPriceBid.amount < secondPriceBid.amount) {
457
+ revert BidsWrongOrder();
458
+ }
459
+
460
+ // second amount must be greater than or equal the reserve
461
+ if (secondPriceBid.amount < reservePrice) {
462
+ revert ReservePriceNotMet(secondPriceBid.amount, reservePrice);
463
+ }
464
+
465
+ uint64 biddingInRound = info.currentRound();
466
+ uint64 biddingForRound = biddingInRound + 1;
467
+ // check the signatures and balances of both bids
468
+ // even the second price bid must have the balance it's claiming
469
+ (address firstPriceBidder, bytes32 firstBidHash) =
470
+ recoverAndCheckBalance(firstPriceBid, biddingForRound);
471
+ (address secondPriceBidder, bytes32 secondBidHash) =
472
+ recoverAndCheckBalance(secondPriceBid, biddingForRound);
473
+
474
+ // The bidders must be different so that our balance check isnt fooled into thinking
475
+ // that the same balance is valid for both the first and second bid
476
+ if (firstPriceBidder == secondPriceBidder) {
477
+ revert SameBidder();
478
+ }
479
+
480
+ // when bids have the same amount we break ties based on the bid hash
481
+ // although we include equality in the check we know this isnt possible due
482
+ // to the check above that ensures the first price bidder and second price bidder are different
483
+ if (
484
+ firstPriceBid.amount == secondPriceBid.amount
485
+ && uint256(keccak256(abi.encodePacked(firstPriceBidder, firstBidHash)))
486
+ < uint256(keccak256(abi.encodePacked(secondPriceBidder, secondBidHash)))
487
+ ) {
488
+ revert TieBidsWrongOrder();
489
+ }
490
+
491
+ (uint64 roundStart, uint64 roundEnd) = info.roundTimestamps(biddingForRound);
492
+ resolveAuction(
493
+ true,
494
+ firstPriceBid,
495
+ firstPriceBidder,
496
+ secondPriceBid.amount,
497
+ biddingInRound,
498
+ roundStart,
499
+ roundEnd
500
+ );
501
+ }
502
+
503
+ /// @inheritdoc IExpressLaneAuction
504
+ function setTransferor(
505
+ Transferor calldata transferor
506
+ ) external {
507
+ // if a transferor has already been set, it may be fixed until a future round
508
+ Transferor storage currentTransferor = transferorOf[msg.sender];
509
+ if (
510
+ currentTransferor.addr != address(0)
511
+ && currentTransferor.fixedUntilRound > roundTimingInfo.currentRound()
512
+ ) {
513
+ revert FixedTransferor(currentTransferor.fixedUntilRound);
514
+ }
515
+
516
+ transferorOf[msg.sender] = transferor;
517
+
518
+ emit SetTransferor(msg.sender, transferor.addr, transferor.fixedUntilRound);
519
+ }
520
+
521
+ /// @inheritdoc IExpressLaneAuction
522
+ function transferExpressLaneController(
523
+ uint64 round,
524
+ address newExpressLaneController
525
+ ) external {
526
+ // past rounds cannot be transferred
527
+ RoundTimingInfo memory info = roundTimingInfo;
528
+ uint64 curRnd = info.currentRound();
529
+ if (round < curRnd) {
530
+ revert RoundTooOld(round, curRnd);
531
+ }
532
+
533
+ // only resolved rounds can be transferred
534
+ ELCRound storage resolvedRound = latestResolvedRounds.resolvedRound(round);
535
+
536
+ address resolvedELC = resolvedRound.expressLaneController;
537
+ address transferor = transferorOf[resolvedELC].addr;
538
+ // can only be the transferor if one has been set
539
+ // otherwise we default to the express lane controller to do the transfer
540
+ if (transferor != address(0)) {
541
+ if (transferor != msg.sender) {
542
+ revert NotTransferor(round, transferor, msg.sender);
543
+ }
544
+ } else if (resolvedELC != msg.sender) {
545
+ revert NotExpressLaneController(round, resolvedELC, msg.sender);
546
+ }
547
+
548
+ resolvedRound.expressLaneController = newExpressLaneController;
549
+
550
+ (uint64 start, uint64 end) = info.roundTimestamps(round);
551
+ emit SetExpressLaneController(
552
+ round,
553
+ resolvedELC,
554
+ newExpressLaneController,
555
+ transferor != address(0) ? transferor : resolvedELC,
556
+ start < uint64(block.timestamp) ? uint64(block.timestamp) : start,
557
+ end
558
+ );
559
+ }
560
+
561
+ /// @inheritdoc IExpressLaneAuction
562
+ function resolvedRounds() external view returns (ELCRound memory, ELCRound memory) {
563
+ return latestResolvedRounds[0].round > latestResolvedRounds[1].round
564
+ ? (latestResolvedRounds[0], latestResolvedRounds[1])
565
+ : (latestResolvedRounds[1], latestResolvedRounds[0]);
566
+ }
567
+ }