From 69bee53128704f401c3b591fde97aa15504f312f Mon Sep 17 00:00:00 2001 From: Guilherme Dantas Date: Sun, 19 Nov 2023 23:06:30 -0300 Subject: [PATCH] feat!: remove history factory --- .../.changeset/gorgeous-onions-count.md | 6 + .../contracts/history/HistoryFactory.sol | 50 ----- .../contracts/history/IHistoryFactory.sol | 46 ----- onchain/rollups/deploy/02_factory.ts | 1 - .../deployments/arbitrum/HistoryFactory.json | 183 ------------------ .../arbitrum_goerli/HistoryFactory.json | 183 ------------------ .../deployments/mainnet/HistoryFactory.json | 183 ------------------ .../deployments/optimism/HistoryFactory.json | 183 ------------------ .../optimism_goerli/HistoryFactory.json | 183 ------------------ .../deployments/sepolia/HistoryFactory.json | 183 ------------------ onchain/rollups/export/abi/arbitrum.json | 91 --------- .../rollups/export/abi/arbitrum_goerli.json | 91 --------- onchain/rollups/export/abi/mainnet.json | 91 --------- onchain/rollups/export/abi/optimism.json | 91 --------- .../rollups/export/abi/optimism_goerli.json | 91 --------- onchain/rollups/export/abi/sepolia.json | 91 --------- .../test/foundry/history/HistoryFactory.t.sol | 100 ---------- 17 files changed, 6 insertions(+), 1841 deletions(-) create mode 100644 onchain/rollups/.changeset/gorgeous-onions-count.md delete mode 100644 onchain/rollups/contracts/history/HistoryFactory.sol delete mode 100644 onchain/rollups/contracts/history/IHistoryFactory.sol delete mode 100644 onchain/rollups/deployments/arbitrum/HistoryFactory.json delete mode 100644 onchain/rollups/deployments/arbitrum_goerli/HistoryFactory.json delete mode 100644 onchain/rollups/deployments/mainnet/HistoryFactory.json delete mode 100644 onchain/rollups/deployments/optimism/HistoryFactory.json delete mode 100644 onchain/rollups/deployments/optimism_goerli/HistoryFactory.json delete mode 100644 onchain/rollups/deployments/sepolia/HistoryFactory.json delete mode 100644 onchain/rollups/test/foundry/history/HistoryFactory.t.sol diff --git a/onchain/rollups/.changeset/gorgeous-onions-count.md b/onchain/rollups/.changeset/gorgeous-onions-count.md new file mode 100644 index 00000000..7b087634 --- /dev/null +++ b/onchain/rollups/.changeset/gorgeous-onions-count.md @@ -0,0 +1,6 @@ +--- +"@cartesi/rollups": major +--- + +Removed `HistoryFactory` and `IHistoryFactory`. +These contracts is no longer be necessary for the new `Authority` contract. diff --git a/onchain/rollups/contracts/history/HistoryFactory.sol b/onchain/rollups/contracts/history/HistoryFactory.sol deleted file mode 100644 index 112f5a98..00000000 --- a/onchain/rollups/contracts/history/HistoryFactory.sol +++ /dev/null @@ -1,50 +0,0 @@ -// (c) Cartesi and individual authors (see AUTHORS) -// SPDX-License-Identifier: Apache-2.0 (see LICENSE) - -pragma solidity ^0.8.8; - -import {Create2} from "@openzeppelin/contracts/utils/Create2.sol"; - -import {IHistoryFactory} from "./IHistoryFactory.sol"; -import {History} from "./History.sol"; - -/// @title History Factory -/// @notice Allows anyone to reliably deploy a new `History` contract. -contract HistoryFactory is IHistoryFactory { - function newHistory( - address _historyOwner - ) external override returns (History) { - History history = new History(_historyOwner); - - emit HistoryCreated(_historyOwner, history); - - return history; - } - - function newHistory( - address _historyOwner, - bytes32 _salt - ) external override returns (History) { - History history = new History{salt: _salt}(_historyOwner); - - emit HistoryCreated(_historyOwner, history); - - return history; - } - - function calculateHistoryAddress( - address _historyOwner, - bytes32 _salt - ) external view override returns (address) { - return - Create2.computeAddress( - _salt, - keccak256( - abi.encodePacked( - type(History).creationCode, - abi.encode(_historyOwner) - ) - ) - ); - } -} diff --git a/onchain/rollups/contracts/history/IHistoryFactory.sol b/onchain/rollups/contracts/history/IHistoryFactory.sol deleted file mode 100644 index bbf6ea6b..00000000 --- a/onchain/rollups/contracts/history/IHistoryFactory.sol +++ /dev/null @@ -1,46 +0,0 @@ -// (c) Cartesi and individual authors (see AUTHORS) -// SPDX-License-Identifier: Apache-2.0 (see LICENSE) - -pragma solidity ^0.8.8; - -import {History} from "./History.sol"; - -/// @title History Factory interface -interface IHistoryFactory { - // Events - - /// @notice A new history was deployed. - /// @param historyOwner The initial history owner - /// @param history The history - /// @dev MUST be triggered on a successful call to `newHistory`. - event HistoryCreated(address historyOwner, History history); - - // Permissionless functions - - /// @notice Deploy a new history. - /// @param _historyOwner The initial history owner - /// @return The history - /// @dev On success, MUST emit a `HistoryCreated` event. - function newHistory(address _historyOwner) external returns (History); - - /// @notice Deploy a new history deterministically. - /// @param _historyOwner The initial history owner - /// @param _salt The salt used to deterministically generate the history address - /// @return The history - /// @dev On success, MUST emit a `HistoryCreated` event. - function newHistory( - address _historyOwner, - bytes32 _salt - ) external returns (History); - - /// @notice Calculate the address of a history to be deployed deterministically. - /// @param _historyOwner The initial history owner - /// @param _salt The salt used to deterministically generate the history address - /// @return The deterministic history address - /// @dev Beware that only the `newHistory` function with the `_salt` parameter - /// is able to deterministically deploy a history. - function calculateHistoryAddress( - address _historyOwner, - bytes32 _salt - ) external view returns (address); -} diff --git a/onchain/rollups/deploy/02_factory.ts b/onchain/rollups/deploy/02_factory.ts index 70a76999..4f66b2ee 100644 --- a/onchain/rollups/deploy/02_factory.ts +++ b/onchain/rollups/deploy/02_factory.ts @@ -24,7 +24,6 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { const { Bitmask, MerkleV2 } = await deployments.all(); await deployments.deploy("AuthorityFactory", opts); - await deployments.deploy("HistoryFactory", opts); await deployments.deploy("CartesiDAppFactory", { ...opts, diff --git a/onchain/rollups/deployments/arbitrum/HistoryFactory.json b/onchain/rollups/deployments/arbitrum/HistoryFactory.json deleted file mode 100644 index 1194a452..00000000 --- a/onchain/rollups/deployments/arbitrum/HistoryFactory.json +++ /dev/null @@ -1,183 +0,0 @@ -{ - "address": "0x1f158b5320BBf677FdA89F9a438df99BbE560A26", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "historyOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract History", - "name": "history", - "type": "address" - } - ], - "name": "HistoryCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateHistoryAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newHistory", - "outputs": [ - { - "internalType": "contract History", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - } - ], - "name": "newHistory", - "outputs": [ - { - "internalType": "contract History", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0xb2172b3d24e4434b34158b0aa60800137f434bf18ad73821aff7332b79db3cb3", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 4, - "gasUsed": "3731714", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xfe84d572011848dc40266dca7306d77beba81e6b057d92b0a4675b75e67ad590", - "transactionHash": "0xb2172b3d24e4434b34158b0aa60800137f434bf18ad73821aff7332b79db3cb3", - "logs": [], - "blockNumber": 137456733, - "cumulativeGasUsed": "5076811", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 1, - "solcInputHash": "b1bc2a879218740e83dfbb7046a3cc8c", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"historyOwner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract History\",\"name\":\"history\",\"type\":\"address\"}],\"name\":\"HistoryCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_historyOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"calculateHistoryAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_historyOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"newHistory\",\"outputs\":[{\"internalType\":\"contract History\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_historyOwner\",\"type\":\"address\"}],\"name\":\"newHistory\",\"outputs\":[{\"internalType\":\"contract History\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"HistoryCreated(address,address)\":{\"details\":\"MUST be triggered on a successful call to `newHistory`.\",\"params\":{\"history\":\"The history\",\"historyOwner\":\"The initial history owner\"}}},\"kind\":\"dev\",\"methods\":{\"calculateHistoryAddress(address,bytes32)\":{\"details\":\"Beware that only the `newHistory` function with the `_salt` parameter is able to deterministically deploy a history.\",\"params\":{\"_historyOwner\":\"The initial history owner\",\"_salt\":\"The salt used to deterministically generate the history address\"},\"returns\":{\"_0\":\"The deterministic history address\"}},\"newHistory(address)\":{\"details\":\"On success, MUST emit a `HistoryCreated` event.\",\"params\":{\"_historyOwner\":\"The initial history owner\"},\"returns\":{\"_0\":\"The history\"}},\"newHistory(address,bytes32)\":{\"details\":\"On success, MUST emit a `HistoryCreated` event.\",\"params\":{\"_historyOwner\":\"The initial history owner\",\"_salt\":\"The salt used to deterministically generate the history address\"},\"returns\":{\"_0\":\"The history\"}}},\"title\":\"History Factory\",\"version\":1},\"userdoc\":{\"events\":{\"HistoryCreated(address,address)\":{\"notice\":\"A new history was deployed.\"}},\"kind\":\"user\",\"methods\":{\"calculateHistoryAddress(address,bytes32)\":{\"notice\":\"Calculate the address of a history to be deployed deterministically.\"},\"newHistory(address)\":{\"notice\":\"Deploy a new history.\"},\"newHistory(address,bytes32)\":{\"notice\":\"Deploy a new history deterministically.\"}},\"notice\":\"Allows anyone to reliably deploy a new `History` contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/history/HistoryFactory.sol\":\"HistoryFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\\n require(address(this).balance >= amount, \\\"Create2: insufficient balance\\\");\\n require(bytecode.length != 0, \\\"Create2: bytecode length is zero\\\");\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n require(addr != address(0), \\\"Create2: Failed on deploy\\\");\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6e00f269073ffc4350e56b7e8153c9092d5f70bfba423299990514183101ef89\",\"license\":\"MIT\"},\"contracts/history/History.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\nimport {IHistory} from \\\"./IHistory.sol\\\";\\n\\n/// @title Simple History\\n///\\n/// @notice This contract stores claims for each DApp individually.\\n/// This means that, for each DApp, the contract stores an array of\\n/// `Claim` entries, where each `Claim` is composed of:\\n///\\n/// * An epoch hash (`bytes32`)\\n/// * A closed interval of input indices (`uint128`, `uint128`)\\n///\\n/// The contract guarantees that the first interval starts at index 0,\\n/// and that the following intervals don't have gaps or overlaps.\\n///\\n/// Furthermore, claims can only be submitted by the contract owner\\n/// through `submitClaim`, but can be retrieved by anyone with `getClaim`.\\n///\\n/// @dev This contract inherits OpenZeppelin's `Ownable` contract.\\n/// For more information on `Ownable`, please consult OpenZeppelin's official documentation.\\ncontract History is IHistory, Ownable {\\n struct Claim {\\n bytes32 epochHash;\\n uint128 firstIndex;\\n uint128 lastIndex;\\n }\\n\\n /// @notice Mapping from DApp address to number of claims.\\n mapping(address => uint256) internal numClaims;\\n\\n /// @notice Mapping from DApp address and claim index to claim.\\n /// @dev See the `getClaim` and `submitClaim` functions.\\n mapping(address => mapping(uint256 => Claim)) internal claims;\\n\\n /// @notice A new claim regarding a specific DApp was submitted.\\n /// @param dapp The address of the DApp\\n /// @param claim The newly-submitted claim\\n /// @dev MUST be triggered on a successful call to `submitClaim`.\\n event NewClaimToHistory(address indexed dapp, Claim claim);\\n\\n /// @notice Raised when one tries to submit a claim whose first input index\\n /// is not less than or equal to its last input index.\\n error InvalidInputIndices();\\n\\n /// @notice Raised when one tries to submit a claim that skips some input.\\n /// For example, when the 1st claim starts at index 5 (instead of 0)\\n /// or when the 1st claim ends at index 20 but the 2nd claim starts at\\n /// index 22 (instead of 21).\\n error UnclaimedInputs();\\n\\n /// @notice Raised when one tries to retrieve a claim with an invalid index.\\n error InvalidClaimIndex();\\n\\n /// @notice Creates a `History` contract.\\n /// @param _owner The initial owner\\n constructor(address _owner) {\\n // constructor in Ownable already called `transferOwnership(msg.sender)`, so\\n // we only need to call `transferOwnership(_owner)` if _owner != msg.sender\\n if (_owner != msg.sender) {\\n transferOwnership(_owner);\\n }\\n }\\n\\n /// @notice Submit a claim regarding a DApp.\\n /// There are several requirements for this function to be called successfully.\\n ///\\n /// * `_claimData` MUST be well-encoded. In Solidity, it can be constructed\\n /// as `abi.encode(dapp, claim)`, where `dapp` is the DApp address (type `address`)\\n /// and `claim` is the claim structure (type `Claim`).\\n ///\\n /// * `firstIndex` MUST be less than or equal to `lastIndex`.\\n /// As a result, every claim MUST encompass AT LEAST one input.\\n ///\\n /// * If this is the DApp's first claim, then `firstIndex` MUST be `0`.\\n /// Otherwise, `firstIndex` MUST be the `lastClaim.lastIndex + 1`.\\n /// In other words, claims MUST NOT skip inputs.\\n ///\\n /// @inheritdoc IHistory\\n /// @dev Emits a `NewClaimToHistory` event. Should have access control.\\n /// Incorrect claim input indices could raise two errors:\\n /// `InvalidInputIndices` if first index is posterior than last index or\\n /// `UnclaimedInputs` if first index is not the subsequent of previous claimed index or\\n /// if the first index of the first claim is not zero.\\n function submitClaim(\\n bytes calldata _claimData\\n ) external override onlyOwner {\\n (address dapp, Claim memory claim) = abi.decode(\\n _claimData,\\n (address, Claim)\\n );\\n\\n if (claim.firstIndex > claim.lastIndex) {\\n revert InvalidInputIndices();\\n }\\n\\n uint256 numDAppClaims = numClaims[dapp];\\n\\n if (\\n claim.firstIndex !=\\n (\\n (numDAppClaims == 0)\\n ? 0\\n : (claims[dapp][numDAppClaims - 1].lastIndex + 1)\\n )\\n ) {\\n revert UnclaimedInputs();\\n }\\n\\n claims[dapp][numDAppClaims] = claim;\\n numClaims[dapp] = numDAppClaims + 1;\\n\\n emit NewClaimToHistory(dapp, claim);\\n }\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// There are several requirements for this function to be called successfully.\\n ///\\n /// * `_proofContext` MUST be well-encoded. In Solidity, it can be constructed\\n /// as `abi.encode(claimIndex)`, where `claimIndex` is the claim index (type `uint256`).\\n ///\\n /// * `claimIndex` MUST be inside the interval `[0, n)` where `n` is the number of claims\\n /// that have been submitted to `_dapp` already.\\n ///\\n /// @inheritdoc IHistory\\n /// @dev If `claimIndex` is not inside the interval `[0, n)`, then\\n /// an `InvalidClaimIndex` error is raised.\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n ) external view override returns (bytes32, uint256, uint256) {\\n uint256 claimIndex = abi.decode(_proofContext, (uint256));\\n\\n uint256 numDAppClaims = numClaims[_dapp];\\n\\n if (claimIndex >= numDAppClaims) {\\n revert InvalidClaimIndex();\\n }\\n\\n Claim memory claim = claims[_dapp][claimIndex];\\n\\n return (claim.epochHash, claim.firstIndex, claim.lastIndex);\\n }\\n\\n /// @inheritdoc IHistory\\n /// @dev Emits an `OwnershipTransferred` event. Should have access control.\\n function migrateToConsensus(\\n address _consensus\\n ) external override onlyOwner {\\n transferOwnership(_consensus);\\n }\\n}\\n\",\"keccak256\":\"0x9fa2563961c1769c3bba2b6b27ec90eca8423dd7b5b5f47e3ef90451a31d66c8\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/history/HistoryFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Create2} from \\\"@openzeppelin/contracts/utils/Create2.sol\\\";\\n\\nimport {IHistoryFactory} from \\\"./IHistoryFactory.sol\\\";\\nimport {History} from \\\"./History.sol\\\";\\n\\n/// @title History Factory\\n/// @notice Allows anyone to reliably deploy a new `History` contract.\\ncontract HistoryFactory is IHistoryFactory {\\n function newHistory(\\n address _historyOwner\\n ) external override returns (History) {\\n History history = new History(_historyOwner);\\n\\n emit HistoryCreated(_historyOwner, history);\\n\\n return history;\\n }\\n\\n function newHistory(\\n address _historyOwner,\\n bytes32 _salt\\n ) external override returns (History) {\\n History history = new History{salt: _salt}(_historyOwner);\\n\\n emit HistoryCreated(_historyOwner, history);\\n\\n return history;\\n }\\n\\n function calculateHistoryAddress(\\n address _historyOwner,\\n bytes32 _salt\\n ) external view override returns (address) {\\n return\\n Create2.computeAddress(\\n _salt,\\n keccak256(\\n abi.encodePacked(\\n type(History).creationCode,\\n abi.encode(_historyOwner)\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x9cce9bafb6c8f3aa056f9109ff664d27f7f10160a3a856ade469598c31cfe9af\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/history/IHistory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @title History interface\\ninterface IHistory {\\n // Permissioned functions\\n\\n /// @notice Submit a claim.\\n /// The encoding of `_claimData` might vary\\n /// depending on the history implementation.\\n /// @param _claimData Data for submitting a claim\\n /// @dev Should have access control.\\n function submitClaim(bytes calldata _claimData) external;\\n\\n /// @notice Transfer ownership to another consensus.\\n /// @param _consensus The new consensus\\n /// @dev Should have access control.\\n function migrateToConsensus(address _consensus) external;\\n\\n // Permissionless functions\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// The encoding of `_proofContext` might vary\\n /// depending on the history implementation.\\n /// @param _dapp The DApp address\\n /// @param _proofContext Data for retrieving the desired claim\\n /// @return epochHash_ The claimed epoch hash\\n /// @return firstInputIndex_ The index of the first input of the epoch in the input box\\n /// @return lastInputIndex_ The index of the last input of the epoch in the input box\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n )\\n external\\n view\\n returns (\\n bytes32 epochHash_,\\n uint256 firstInputIndex_,\\n uint256 lastInputIndex_\\n );\\n}\\n\",\"keccak256\":\"0x1378cbc831833abae8e2a565b88899d6416ea1208aa9724bd4df28e74848ffcf\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/history/IHistoryFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {History} from \\\"./History.sol\\\";\\n\\n/// @title History Factory interface\\ninterface IHistoryFactory {\\n // Events\\n\\n /// @notice A new history was deployed.\\n /// @param historyOwner The initial history owner\\n /// @param history The history\\n /// @dev MUST be triggered on a successful call to `newHistory`.\\n event HistoryCreated(address historyOwner, History history);\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new history.\\n /// @param _historyOwner The initial history owner\\n /// @return The history\\n /// @dev On success, MUST emit a `HistoryCreated` event.\\n function newHistory(address _historyOwner) external returns (History);\\n\\n /// @notice Deploy a new history deterministically.\\n /// @param _historyOwner The initial history owner\\n /// @param _salt The salt used to deterministically generate the history address\\n /// @return The history\\n /// @dev On success, MUST emit a `HistoryCreated` event.\\n function newHistory(\\n address _historyOwner,\\n bytes32 _salt\\n ) external returns (History);\\n\\n /// @notice Calculate the address of a history to be deployed deterministically.\\n /// @param _historyOwner The initial history owner\\n /// @param _salt The salt used to deterministically generate the history address\\n /// @return The deterministic history address\\n /// @dev Beware that only the `newHistory` function with the `_salt` parameter\\n /// is able to deterministically deploy a history.\\n function calculateHistoryAddress(\\n address _historyOwner,\\n bytes32 _salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0xde2581bb8fc418b9ea6375c525c270cc49193269b90b0e46312df2fe28bee6b3\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50610c6f806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80632ab8b1151461004657806350f9c5ba1461007557806388d49a6214610088575b600080fd5b610059610054366004610289565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b610059610083366004610289565b61012a565b6100596100963660046102b3565b6101a5565b60008082846040516100ac90610260565b6001600160a01b0390911681526020018190604051809103906000f59050801580156100dc573d6000803e3d6000fd5b50604080516001600160a01b038088168252831660208201529192507f5b0ee1fb14fdb4a34ba9f0dda6790b059be11d8b3a954905dbad3c025c05c9c6910160405180910390a19392505050565b600061019e826040518060200161014090610260565b601f1982820381018352601f9091011660408181526001600160a01b03881660208301520160408051601f198184030181529082905261018392916020016102fe565b6040516020818303038152906040528051906020012061022e565b9392505050565b600080826040516101b590610260565b6001600160a01b039091168152602001604051809103906000f0801580156101e1573d6000803e3d6000fd5b50604080516001600160a01b038087168252831660208201529192507f5b0ee1fb14fdb4a34ba9f0dda6790b059be11d8b3a954905dbad3c025c05c9c6910160405180910390a192915050565b600061019e8383306000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b61091e8061031c83390190565b80356001600160a01b038116811461028457600080fd5b919050565b6000806040838503121561029c57600080fd5b6102a58361026d565b946020939093013593505050565b6000602082840312156102c557600080fd5b61019e8261026d565b6000815160005b818110156102ef57602081850181015186830152016102d5565b50600093019283525090919050565b600061031361030d83866102ce565b846102ce565b94935050505056fe608060405234801561001057600080fd5b5060405161091e38038061091e83398101604081905261002f91610181565b61003833610057565b6001600160a01b038116331461005157610051816100a7565b506101b1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6100af610125565b6001600160a01b0381166101195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61012281610057565b50565b6000546001600160a01b0316331461017f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610110565b565b60006020828403121561019357600080fd5b81516001600160a01b03811681146101aa57600080fd5b9392505050565b61075e806101c06000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c8063715018a6146100675780638da5cb5b14610071578063d79a824014610091578063ddfdfbb0146100bf578063f2fde38b146100d2578063fc411683146100e5575b600080fd5b61006f6100f8565b005b6000546040516001600160a01b0390911681526020015b60405180910390f35b6100a461009f366004610531565b61010c565b60408051938452602084019290925290820152606001610088565b61006f6100cd366004610586565b6101bf565b61006f6100e03660046105c8565b61039a565b61006f6100f33660046105c8565b610418565b610100610429565b61010a6000610483565b565b600080808061011d858701876105ec565b6001600160a01b038816600090815260016020526040902054909150808210610159576040516387332c0160e01b815260040160405180910390fd5b506001600160a01b0396909616600090815260026020908152604080832098835297815290879020875160608101895281548082526001909201546001600160801b03808216948301859052600160801b90910416980188905297909695509350505050565b6101c7610429565b6000806101d683850185610621565b9150915080604001516001600160801b031681602001516001600160801b031611156102155760405163123974fd60e01b815260040160405180910390fd5b6001600160a01b038216600090815260016020526040902054801561028e576001600160a01b0383166000908152600260205260408120906102586001846106d5565b815260200190815260200160002060010160109054906101000a90046001600160801b0316600161028991906106ee565b610291565b60005b6001600160801b031682602001516001600160801b0316146102c65760405163118b891b60e01b815260040160405180910390fd5b6001600160a01b03831660009081526002602090815260408083208484528252918290208451815590840151918401516001600160801b03908116600160801b0292169190911760019182015561031e908290610715565b6001600160a01b03841660008181526001602090815260409182902093909355805185518152858401516001600160801b03908116948201949094528582015190931690830152907fb71880d7a0c514d48c0296b2721b0a4f9641a45117960f2ca86b5b7873c4ab2f9060600160405180910390a25050505050565b6103a2610429565b6001600160a01b03811661040c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61041581610483565b50565b610420610429565b6104158161039a565b6000546001600160a01b0316331461010a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610403565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461041557600080fd5b60008083601f8401126104fa57600080fd5b50813567ffffffffffffffff81111561051257600080fd5b60208301915083602082850101111561052a57600080fd5b9250929050565b60008060006040848603121561054657600080fd5b8335610551816104d3565b9250602084013567ffffffffffffffff81111561056d57600080fd5b610579868287016104e8565b9497909650939450505050565b6000806020838503121561059957600080fd5b823567ffffffffffffffff8111156105b057600080fd5b6105bc858286016104e8565b90969095509350505050565b6000602082840312156105da57600080fd5b81356105e5816104d3565b9392505050565b6000602082840312156105fe57600080fd5b5035919050565b80356001600160801b038116811461061c57600080fd5b919050565b600080828403608081121561063557600080fd5b8335610640816104d3565b92506060601f198201121561065457600080fd5b506040516060810181811067ffffffffffffffff8211171561068657634e487b7160e01b600052604160045260246000fd5b80604052506020840135815261069e60408501610605565b60208201526106af60608501610605565b6040820152809150509250929050565b634e487b7160e01b600052601160045260246000fd5b818103818111156106e8576106e86106bf565b92915050565b6001600160801b0381811683821601908082111561070e5761070e6106bf565b5092915050565b808201808211156106e8576106e86106bf56fea2646970667358221220af04065c5d35d3460abc2711367000a2134970c84818233d66386f35794dfb5b64736f6c63430008130033a2646970667358221220022e94d4ec2e139486be793ccd0a8adc660dbcb526c820d52e52c49b3ca0a2c064736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80632ab8b1151461004657806350f9c5ba1461007557806388d49a6214610088575b600080fd5b610059610054366004610289565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b610059610083366004610289565b61012a565b6100596100963660046102b3565b6101a5565b60008082846040516100ac90610260565b6001600160a01b0390911681526020018190604051809103906000f59050801580156100dc573d6000803e3d6000fd5b50604080516001600160a01b038088168252831660208201529192507f5b0ee1fb14fdb4a34ba9f0dda6790b059be11d8b3a954905dbad3c025c05c9c6910160405180910390a19392505050565b600061019e826040518060200161014090610260565b601f1982820381018352601f9091011660408181526001600160a01b03881660208301520160408051601f198184030181529082905261018392916020016102fe565b6040516020818303038152906040528051906020012061022e565b9392505050565b600080826040516101b590610260565b6001600160a01b039091168152602001604051809103906000f0801580156101e1573d6000803e3d6000fd5b50604080516001600160a01b038087168252831660208201529192507f5b0ee1fb14fdb4a34ba9f0dda6790b059be11d8b3a954905dbad3c025c05c9c6910160405180910390a192915050565b600061019e8383306000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b61091e8061031c83390190565b80356001600160a01b038116811461028457600080fd5b919050565b6000806040838503121561029c57600080fd5b6102a58361026d565b946020939093013593505050565b6000602082840312156102c557600080fd5b61019e8261026d565b6000815160005b818110156102ef57602081850181015186830152016102d5565b50600093019283525090919050565b600061031361030d83866102ce565b846102ce565b94935050505056fe608060405234801561001057600080fd5b5060405161091e38038061091e83398101604081905261002f91610181565b61003833610057565b6001600160a01b038116331461005157610051816100a7565b506101b1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6100af610125565b6001600160a01b0381166101195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61012281610057565b50565b6000546001600160a01b0316331461017f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610110565b565b60006020828403121561019357600080fd5b81516001600160a01b03811681146101aa57600080fd5b9392505050565b61075e806101c06000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c8063715018a6146100675780638da5cb5b14610071578063d79a824014610091578063ddfdfbb0146100bf578063f2fde38b146100d2578063fc411683146100e5575b600080fd5b61006f6100f8565b005b6000546040516001600160a01b0390911681526020015b60405180910390f35b6100a461009f366004610531565b61010c565b60408051938452602084019290925290820152606001610088565b61006f6100cd366004610586565b6101bf565b61006f6100e03660046105c8565b61039a565b61006f6100f33660046105c8565b610418565b610100610429565b61010a6000610483565b565b600080808061011d858701876105ec565b6001600160a01b038816600090815260016020526040902054909150808210610159576040516387332c0160e01b815260040160405180910390fd5b506001600160a01b0396909616600090815260026020908152604080832098835297815290879020875160608101895281548082526001909201546001600160801b03808216948301859052600160801b90910416980188905297909695509350505050565b6101c7610429565b6000806101d683850185610621565b9150915080604001516001600160801b031681602001516001600160801b031611156102155760405163123974fd60e01b815260040160405180910390fd5b6001600160a01b038216600090815260016020526040902054801561028e576001600160a01b0383166000908152600260205260408120906102586001846106d5565b815260200190815260200160002060010160109054906101000a90046001600160801b0316600161028991906106ee565b610291565b60005b6001600160801b031682602001516001600160801b0316146102c65760405163118b891b60e01b815260040160405180910390fd5b6001600160a01b03831660009081526002602090815260408083208484528252918290208451815590840151918401516001600160801b03908116600160801b0292169190911760019182015561031e908290610715565b6001600160a01b03841660008181526001602090815260409182902093909355805185518152858401516001600160801b03908116948201949094528582015190931690830152907fb71880d7a0c514d48c0296b2721b0a4f9641a45117960f2ca86b5b7873c4ab2f9060600160405180910390a25050505050565b6103a2610429565b6001600160a01b03811661040c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61041581610483565b50565b610420610429565b6104158161039a565b6000546001600160a01b0316331461010a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610403565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461041557600080fd5b60008083601f8401126104fa57600080fd5b50813567ffffffffffffffff81111561051257600080fd5b60208301915083602082850101111561052a57600080fd5b9250929050565b60008060006040848603121561054657600080fd5b8335610551816104d3565b9250602084013567ffffffffffffffff81111561056d57600080fd5b610579868287016104e8565b9497909650939450505050565b6000806020838503121561059957600080fd5b823567ffffffffffffffff8111156105b057600080fd5b6105bc858286016104e8565b90969095509350505050565b6000602082840312156105da57600080fd5b81356105e5816104d3565b9392505050565b6000602082840312156105fe57600080fd5b5035919050565b80356001600160801b038116811461061c57600080fd5b919050565b600080828403608081121561063557600080fd5b8335610640816104d3565b92506060601f198201121561065457600080fd5b506040516060810181811067ffffffffffffffff8211171561068657634e487b7160e01b600052604160045260246000fd5b80604052506020840135815261069e60408501610605565b60208201526106af60608501610605565b6040820152809150509250929050565b634e487b7160e01b600052601160045260246000fd5b818103818111156106e8576106e86106bf565b92915050565b6001600160801b0381811683821601908082111561070e5761070e6106bf565b5092915050565b808201808211156106e8576106e86106bf56fea2646970667358221220af04065c5d35d3460abc2711367000a2134970c84818233d66386f35794dfb5b64736f6c63430008130033a2646970667358221220022e94d4ec2e139486be793ccd0a8adc660dbcb526c820d52e52c49b3ca0a2c064736f6c63430008130033", - "devdoc": { - "events": { - "HistoryCreated(address,address)": { - "details": "MUST be triggered on a successful call to `newHistory`.", - "params": { - "history": "The history", - "historyOwner": "The initial history owner" - } - } - }, - "kind": "dev", - "methods": { - "calculateHistoryAddress(address,bytes32)": { - "details": "Beware that only the `newHistory` function with the `_salt` parameter is able to deterministically deploy a history.", - "params": { - "_historyOwner": "The initial history owner", - "_salt": "The salt used to deterministically generate the history address" - }, - "returns": { - "_0": "The deterministic history address" - } - }, - "newHistory(address)": { - "details": "On success, MUST emit a `HistoryCreated` event.", - "params": { - "_historyOwner": "The initial history owner" - }, - "returns": { - "_0": "The history" - } - }, - "newHistory(address,bytes32)": { - "details": "On success, MUST emit a `HistoryCreated` event.", - "params": { - "_historyOwner": "The initial history owner", - "_salt": "The salt used to deterministically generate the history address" - }, - "returns": { - "_0": "The history" - } - } - }, - "title": "History Factory", - "version": 1 - }, - "userdoc": { - "events": { - "HistoryCreated(address,address)": { - "notice": "A new history was deployed." - } - }, - "kind": "user", - "methods": { - "calculateHistoryAddress(address,bytes32)": { - "notice": "Calculate the address of a history to be deployed deterministically." - }, - "newHistory(address)": { - "notice": "Deploy a new history." - }, - "newHistory(address,bytes32)": { - "notice": "Deploy a new history deterministically." - } - }, - "notice": "Allows anyone to reliably deploy a new `History` contract.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/onchain/rollups/deployments/arbitrum_goerli/HistoryFactory.json b/onchain/rollups/deployments/arbitrum_goerli/HistoryFactory.json deleted file mode 100644 index abbbdbb0..00000000 --- a/onchain/rollups/deployments/arbitrum_goerli/HistoryFactory.json +++ /dev/null @@ -1,183 +0,0 @@ -{ - "address": "0x1f158b5320BBf677FdA89F9a438df99BbE560A26", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "historyOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract History", - "name": "history", - "type": "address" - } - ], - "name": "HistoryCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateHistoryAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newHistory", - "outputs": [ - { - "internalType": "contract History", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - } - ], - "name": "newHistory", - "outputs": [ - { - "internalType": "contract History", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0x27dab981d2a2090f8554a95c6097720b344cd52fb3101d30e4afc5187585b76f", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", - "contractAddress": null, - "transactionIndex": 1, - "gasUsed": "741626", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xc9d187773324294c7c9884e20926e0833501694dc7b5a26c9c839283bfbe6c87", - "transactionHash": "0x27dab981d2a2090f8554a95c6097720b344cd52fb3101d30e4afc5187585b76f", - "logs": [], - "blockNumber": 45427548, - "cumulativeGasUsed": "741626", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 1, - "solcInputHash": "b1bc2a879218740e83dfbb7046a3cc8c", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"historyOwner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract History\",\"name\":\"history\",\"type\":\"address\"}],\"name\":\"HistoryCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_historyOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"calculateHistoryAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_historyOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"newHistory\",\"outputs\":[{\"internalType\":\"contract History\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_historyOwner\",\"type\":\"address\"}],\"name\":\"newHistory\",\"outputs\":[{\"internalType\":\"contract History\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"HistoryCreated(address,address)\":{\"details\":\"MUST be triggered on a successful call to `newHistory`.\",\"params\":{\"history\":\"The history\",\"historyOwner\":\"The initial history owner\"}}},\"kind\":\"dev\",\"methods\":{\"calculateHistoryAddress(address,bytes32)\":{\"details\":\"Beware that only the `newHistory` function with the `_salt` parameter is able to deterministically deploy a history.\",\"params\":{\"_historyOwner\":\"The initial history owner\",\"_salt\":\"The salt used to deterministically generate the history address\"},\"returns\":{\"_0\":\"The deterministic history address\"}},\"newHistory(address)\":{\"details\":\"On success, MUST emit a `HistoryCreated` event.\",\"params\":{\"_historyOwner\":\"The initial history owner\"},\"returns\":{\"_0\":\"The history\"}},\"newHistory(address,bytes32)\":{\"details\":\"On success, MUST emit a `HistoryCreated` event.\",\"params\":{\"_historyOwner\":\"The initial history owner\",\"_salt\":\"The salt used to deterministically generate the history address\"},\"returns\":{\"_0\":\"The history\"}}},\"title\":\"History Factory\",\"version\":1},\"userdoc\":{\"events\":{\"HistoryCreated(address,address)\":{\"notice\":\"A new history was deployed.\"}},\"kind\":\"user\",\"methods\":{\"calculateHistoryAddress(address,bytes32)\":{\"notice\":\"Calculate the address of a history to be deployed deterministically.\"},\"newHistory(address)\":{\"notice\":\"Deploy a new history.\"},\"newHistory(address,bytes32)\":{\"notice\":\"Deploy a new history deterministically.\"}},\"notice\":\"Allows anyone to reliably deploy a new `History` contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/history/HistoryFactory.sol\":\"HistoryFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\\n require(address(this).balance >= amount, \\\"Create2: insufficient balance\\\");\\n require(bytecode.length != 0, \\\"Create2: bytecode length is zero\\\");\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n require(addr != address(0), \\\"Create2: Failed on deploy\\\");\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6e00f269073ffc4350e56b7e8153c9092d5f70bfba423299990514183101ef89\",\"license\":\"MIT\"},\"contracts/history/History.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\nimport {IHistory} from \\\"./IHistory.sol\\\";\\n\\n/// @title Simple History\\n///\\n/// @notice This contract stores claims for each DApp individually.\\n/// This means that, for each DApp, the contract stores an array of\\n/// `Claim` entries, where each `Claim` is composed of:\\n///\\n/// * An epoch hash (`bytes32`)\\n/// * A closed interval of input indices (`uint128`, `uint128`)\\n///\\n/// The contract guarantees that the first interval starts at index 0,\\n/// and that the following intervals don't have gaps or overlaps.\\n///\\n/// Furthermore, claims can only be submitted by the contract owner\\n/// through `submitClaim`, but can be retrieved by anyone with `getClaim`.\\n///\\n/// @dev This contract inherits OpenZeppelin's `Ownable` contract.\\n/// For more information on `Ownable`, please consult OpenZeppelin's official documentation.\\ncontract History is IHistory, Ownable {\\n struct Claim {\\n bytes32 epochHash;\\n uint128 firstIndex;\\n uint128 lastIndex;\\n }\\n\\n /// @notice Mapping from DApp address to number of claims.\\n mapping(address => uint256) internal numClaims;\\n\\n /// @notice Mapping from DApp address and claim index to claim.\\n /// @dev See the `getClaim` and `submitClaim` functions.\\n mapping(address => mapping(uint256 => Claim)) internal claims;\\n\\n /// @notice A new claim regarding a specific DApp was submitted.\\n /// @param dapp The address of the DApp\\n /// @param claim The newly-submitted claim\\n /// @dev MUST be triggered on a successful call to `submitClaim`.\\n event NewClaimToHistory(address indexed dapp, Claim claim);\\n\\n /// @notice Raised when one tries to submit a claim whose first input index\\n /// is not less than or equal to its last input index.\\n error InvalidInputIndices();\\n\\n /// @notice Raised when one tries to submit a claim that skips some input.\\n /// For example, when the 1st claim starts at index 5 (instead of 0)\\n /// or when the 1st claim ends at index 20 but the 2nd claim starts at\\n /// index 22 (instead of 21).\\n error UnclaimedInputs();\\n\\n /// @notice Raised when one tries to retrieve a claim with an invalid index.\\n error InvalidClaimIndex();\\n\\n /// @notice Creates a `History` contract.\\n /// @param _owner The initial owner\\n constructor(address _owner) {\\n // constructor in Ownable already called `transferOwnership(msg.sender)`, so\\n // we only need to call `transferOwnership(_owner)` if _owner != msg.sender\\n if (_owner != msg.sender) {\\n transferOwnership(_owner);\\n }\\n }\\n\\n /// @notice Submit a claim regarding a DApp.\\n /// There are several requirements for this function to be called successfully.\\n ///\\n /// * `_claimData` MUST be well-encoded. In Solidity, it can be constructed\\n /// as `abi.encode(dapp, claim)`, where `dapp` is the DApp address (type `address`)\\n /// and `claim` is the claim structure (type `Claim`).\\n ///\\n /// * `firstIndex` MUST be less than or equal to `lastIndex`.\\n /// As a result, every claim MUST encompass AT LEAST one input.\\n ///\\n /// * If this is the DApp's first claim, then `firstIndex` MUST be `0`.\\n /// Otherwise, `firstIndex` MUST be the `lastClaim.lastIndex + 1`.\\n /// In other words, claims MUST NOT skip inputs.\\n ///\\n /// @inheritdoc IHistory\\n /// @dev Emits a `NewClaimToHistory` event. Should have access control.\\n /// Incorrect claim input indices could raise two errors:\\n /// `InvalidInputIndices` if first index is posterior than last index or\\n /// `UnclaimedInputs` if first index is not the subsequent of previous claimed index or\\n /// if the first index of the first claim is not zero.\\n function submitClaim(\\n bytes calldata _claimData\\n ) external override onlyOwner {\\n (address dapp, Claim memory claim) = abi.decode(\\n _claimData,\\n (address, Claim)\\n );\\n\\n if (claim.firstIndex > claim.lastIndex) {\\n revert InvalidInputIndices();\\n }\\n\\n uint256 numDAppClaims = numClaims[dapp];\\n\\n if (\\n claim.firstIndex !=\\n (\\n (numDAppClaims == 0)\\n ? 0\\n : (claims[dapp][numDAppClaims - 1].lastIndex + 1)\\n )\\n ) {\\n revert UnclaimedInputs();\\n }\\n\\n claims[dapp][numDAppClaims] = claim;\\n numClaims[dapp] = numDAppClaims + 1;\\n\\n emit NewClaimToHistory(dapp, claim);\\n }\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// There are several requirements for this function to be called successfully.\\n ///\\n /// * `_proofContext` MUST be well-encoded. In Solidity, it can be constructed\\n /// as `abi.encode(claimIndex)`, where `claimIndex` is the claim index (type `uint256`).\\n ///\\n /// * `claimIndex` MUST be inside the interval `[0, n)` where `n` is the number of claims\\n /// that have been submitted to `_dapp` already.\\n ///\\n /// @inheritdoc IHistory\\n /// @dev If `claimIndex` is not inside the interval `[0, n)`, then\\n /// an `InvalidClaimIndex` error is raised.\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n ) external view override returns (bytes32, uint256, uint256) {\\n uint256 claimIndex = abi.decode(_proofContext, (uint256));\\n\\n uint256 numDAppClaims = numClaims[_dapp];\\n\\n if (claimIndex >= numDAppClaims) {\\n revert InvalidClaimIndex();\\n }\\n\\n Claim memory claim = claims[_dapp][claimIndex];\\n\\n return (claim.epochHash, claim.firstIndex, claim.lastIndex);\\n }\\n\\n /// @inheritdoc IHistory\\n /// @dev Emits an `OwnershipTransferred` event. Should have access control.\\n function migrateToConsensus(\\n address _consensus\\n ) external override onlyOwner {\\n transferOwnership(_consensus);\\n }\\n}\\n\",\"keccak256\":\"0x9fa2563961c1769c3bba2b6b27ec90eca8423dd7b5b5f47e3ef90451a31d66c8\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/history/HistoryFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Create2} from \\\"@openzeppelin/contracts/utils/Create2.sol\\\";\\n\\nimport {IHistoryFactory} from \\\"./IHistoryFactory.sol\\\";\\nimport {History} from \\\"./History.sol\\\";\\n\\n/// @title History Factory\\n/// @notice Allows anyone to reliably deploy a new `History` contract.\\ncontract HistoryFactory is IHistoryFactory {\\n function newHistory(\\n address _historyOwner\\n ) external override returns (History) {\\n History history = new History(_historyOwner);\\n\\n emit HistoryCreated(_historyOwner, history);\\n\\n return history;\\n }\\n\\n function newHistory(\\n address _historyOwner,\\n bytes32 _salt\\n ) external override returns (History) {\\n History history = new History{salt: _salt}(_historyOwner);\\n\\n emit HistoryCreated(_historyOwner, history);\\n\\n return history;\\n }\\n\\n function calculateHistoryAddress(\\n address _historyOwner,\\n bytes32 _salt\\n ) external view override returns (address) {\\n return\\n Create2.computeAddress(\\n _salt,\\n keccak256(\\n abi.encodePacked(\\n type(History).creationCode,\\n abi.encode(_historyOwner)\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x9cce9bafb6c8f3aa056f9109ff664d27f7f10160a3a856ade469598c31cfe9af\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/history/IHistory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @title History interface\\ninterface IHistory {\\n // Permissioned functions\\n\\n /// @notice Submit a claim.\\n /// The encoding of `_claimData` might vary\\n /// depending on the history implementation.\\n /// @param _claimData Data for submitting a claim\\n /// @dev Should have access control.\\n function submitClaim(bytes calldata _claimData) external;\\n\\n /// @notice Transfer ownership to another consensus.\\n /// @param _consensus The new consensus\\n /// @dev Should have access control.\\n function migrateToConsensus(address _consensus) external;\\n\\n // Permissionless functions\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// The encoding of `_proofContext` might vary\\n /// depending on the history implementation.\\n /// @param _dapp The DApp address\\n /// @param _proofContext Data for retrieving the desired claim\\n /// @return epochHash_ The claimed epoch hash\\n /// @return firstInputIndex_ The index of the first input of the epoch in the input box\\n /// @return lastInputIndex_ The index of the last input of the epoch in the input box\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n )\\n external\\n view\\n returns (\\n bytes32 epochHash_,\\n uint256 firstInputIndex_,\\n uint256 lastInputIndex_\\n );\\n}\\n\",\"keccak256\":\"0x1378cbc831833abae8e2a565b88899d6416ea1208aa9724bd4df28e74848ffcf\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/history/IHistoryFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {History} from \\\"./History.sol\\\";\\n\\n/// @title History Factory interface\\ninterface IHistoryFactory {\\n // Events\\n\\n /// @notice A new history was deployed.\\n /// @param historyOwner The initial history owner\\n /// @param history The history\\n /// @dev MUST be triggered on a successful call to `newHistory`.\\n event HistoryCreated(address historyOwner, History history);\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new history.\\n /// @param _historyOwner The initial history owner\\n /// @return The history\\n /// @dev On success, MUST emit a `HistoryCreated` event.\\n function newHistory(address _historyOwner) external returns (History);\\n\\n /// @notice Deploy a new history deterministically.\\n /// @param _historyOwner The initial history owner\\n /// @param _salt The salt used to deterministically generate the history address\\n /// @return The history\\n /// @dev On success, MUST emit a `HistoryCreated` event.\\n function newHistory(\\n address _historyOwner,\\n bytes32 _salt\\n ) external returns (History);\\n\\n /// @notice Calculate the address of a history to be deployed deterministically.\\n /// @param _historyOwner The initial history owner\\n /// @param _salt The salt used to deterministically generate the history address\\n /// @return The deterministic history address\\n /// @dev Beware that only the `newHistory` function with the `_salt` parameter\\n /// is able to deterministically deploy a history.\\n function calculateHistoryAddress(\\n address _historyOwner,\\n bytes32 _salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0xde2581bb8fc418b9ea6375c525c270cc49193269b90b0e46312df2fe28bee6b3\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50610c6f806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80632ab8b1151461004657806350f9c5ba1461007557806388d49a6214610088575b600080fd5b610059610054366004610289565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b610059610083366004610289565b61012a565b6100596100963660046102b3565b6101a5565b60008082846040516100ac90610260565b6001600160a01b0390911681526020018190604051809103906000f59050801580156100dc573d6000803e3d6000fd5b50604080516001600160a01b038088168252831660208201529192507f5b0ee1fb14fdb4a34ba9f0dda6790b059be11d8b3a954905dbad3c025c05c9c6910160405180910390a19392505050565b600061019e826040518060200161014090610260565b601f1982820381018352601f9091011660408181526001600160a01b03881660208301520160408051601f198184030181529082905261018392916020016102fe565b6040516020818303038152906040528051906020012061022e565b9392505050565b600080826040516101b590610260565b6001600160a01b039091168152602001604051809103906000f0801580156101e1573d6000803e3d6000fd5b50604080516001600160a01b038087168252831660208201529192507f5b0ee1fb14fdb4a34ba9f0dda6790b059be11d8b3a954905dbad3c025c05c9c6910160405180910390a192915050565b600061019e8383306000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b61091e8061031c83390190565b80356001600160a01b038116811461028457600080fd5b919050565b6000806040838503121561029c57600080fd5b6102a58361026d565b946020939093013593505050565b6000602082840312156102c557600080fd5b61019e8261026d565b6000815160005b818110156102ef57602081850181015186830152016102d5565b50600093019283525090919050565b600061031361030d83866102ce565b846102ce565b94935050505056fe608060405234801561001057600080fd5b5060405161091e38038061091e83398101604081905261002f91610181565b61003833610057565b6001600160a01b038116331461005157610051816100a7565b506101b1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6100af610125565b6001600160a01b0381166101195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61012281610057565b50565b6000546001600160a01b0316331461017f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610110565b565b60006020828403121561019357600080fd5b81516001600160a01b03811681146101aa57600080fd5b9392505050565b61075e806101c06000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c8063715018a6146100675780638da5cb5b14610071578063d79a824014610091578063ddfdfbb0146100bf578063f2fde38b146100d2578063fc411683146100e5575b600080fd5b61006f6100f8565b005b6000546040516001600160a01b0390911681526020015b60405180910390f35b6100a461009f366004610531565b61010c565b60408051938452602084019290925290820152606001610088565b61006f6100cd366004610586565b6101bf565b61006f6100e03660046105c8565b61039a565b61006f6100f33660046105c8565b610418565b610100610429565b61010a6000610483565b565b600080808061011d858701876105ec565b6001600160a01b038816600090815260016020526040902054909150808210610159576040516387332c0160e01b815260040160405180910390fd5b506001600160a01b0396909616600090815260026020908152604080832098835297815290879020875160608101895281548082526001909201546001600160801b03808216948301859052600160801b90910416980188905297909695509350505050565b6101c7610429565b6000806101d683850185610621565b9150915080604001516001600160801b031681602001516001600160801b031611156102155760405163123974fd60e01b815260040160405180910390fd5b6001600160a01b038216600090815260016020526040902054801561028e576001600160a01b0383166000908152600260205260408120906102586001846106d5565b815260200190815260200160002060010160109054906101000a90046001600160801b0316600161028991906106ee565b610291565b60005b6001600160801b031682602001516001600160801b0316146102c65760405163118b891b60e01b815260040160405180910390fd5b6001600160a01b03831660009081526002602090815260408083208484528252918290208451815590840151918401516001600160801b03908116600160801b0292169190911760019182015561031e908290610715565b6001600160a01b03841660008181526001602090815260409182902093909355805185518152858401516001600160801b03908116948201949094528582015190931690830152907fb71880d7a0c514d48c0296b2721b0a4f9641a45117960f2ca86b5b7873c4ab2f9060600160405180910390a25050505050565b6103a2610429565b6001600160a01b03811661040c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61041581610483565b50565b610420610429565b6104158161039a565b6000546001600160a01b0316331461010a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610403565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461041557600080fd5b60008083601f8401126104fa57600080fd5b50813567ffffffffffffffff81111561051257600080fd5b60208301915083602082850101111561052a57600080fd5b9250929050565b60008060006040848603121561054657600080fd5b8335610551816104d3565b9250602084013567ffffffffffffffff81111561056d57600080fd5b610579868287016104e8565b9497909650939450505050565b6000806020838503121561059957600080fd5b823567ffffffffffffffff8111156105b057600080fd5b6105bc858286016104e8565b90969095509350505050565b6000602082840312156105da57600080fd5b81356105e5816104d3565b9392505050565b6000602082840312156105fe57600080fd5b5035919050565b80356001600160801b038116811461061c57600080fd5b919050565b600080828403608081121561063557600080fd5b8335610640816104d3565b92506060601f198201121561065457600080fd5b506040516060810181811067ffffffffffffffff8211171561068657634e487b7160e01b600052604160045260246000fd5b80604052506020840135815261069e60408501610605565b60208201526106af60608501610605565b6040820152809150509250929050565b634e487b7160e01b600052601160045260246000fd5b818103818111156106e8576106e86106bf565b92915050565b6001600160801b0381811683821601908082111561070e5761070e6106bf565b5092915050565b808201808211156106e8576106e86106bf56fea2646970667358221220af04065c5d35d3460abc2711367000a2134970c84818233d66386f35794dfb5b64736f6c63430008130033a2646970667358221220022e94d4ec2e139486be793ccd0a8adc660dbcb526c820d52e52c49b3ca0a2c064736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80632ab8b1151461004657806350f9c5ba1461007557806388d49a6214610088575b600080fd5b610059610054366004610289565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b610059610083366004610289565b61012a565b6100596100963660046102b3565b6101a5565b60008082846040516100ac90610260565b6001600160a01b0390911681526020018190604051809103906000f59050801580156100dc573d6000803e3d6000fd5b50604080516001600160a01b038088168252831660208201529192507f5b0ee1fb14fdb4a34ba9f0dda6790b059be11d8b3a954905dbad3c025c05c9c6910160405180910390a19392505050565b600061019e826040518060200161014090610260565b601f1982820381018352601f9091011660408181526001600160a01b03881660208301520160408051601f198184030181529082905261018392916020016102fe565b6040516020818303038152906040528051906020012061022e565b9392505050565b600080826040516101b590610260565b6001600160a01b039091168152602001604051809103906000f0801580156101e1573d6000803e3d6000fd5b50604080516001600160a01b038087168252831660208201529192507f5b0ee1fb14fdb4a34ba9f0dda6790b059be11d8b3a954905dbad3c025c05c9c6910160405180910390a192915050565b600061019e8383306000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b61091e8061031c83390190565b80356001600160a01b038116811461028457600080fd5b919050565b6000806040838503121561029c57600080fd5b6102a58361026d565b946020939093013593505050565b6000602082840312156102c557600080fd5b61019e8261026d565b6000815160005b818110156102ef57602081850181015186830152016102d5565b50600093019283525090919050565b600061031361030d83866102ce565b846102ce565b94935050505056fe608060405234801561001057600080fd5b5060405161091e38038061091e83398101604081905261002f91610181565b61003833610057565b6001600160a01b038116331461005157610051816100a7565b506101b1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6100af610125565b6001600160a01b0381166101195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61012281610057565b50565b6000546001600160a01b0316331461017f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610110565b565b60006020828403121561019357600080fd5b81516001600160a01b03811681146101aa57600080fd5b9392505050565b61075e806101c06000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c8063715018a6146100675780638da5cb5b14610071578063d79a824014610091578063ddfdfbb0146100bf578063f2fde38b146100d2578063fc411683146100e5575b600080fd5b61006f6100f8565b005b6000546040516001600160a01b0390911681526020015b60405180910390f35b6100a461009f366004610531565b61010c565b60408051938452602084019290925290820152606001610088565b61006f6100cd366004610586565b6101bf565b61006f6100e03660046105c8565b61039a565b61006f6100f33660046105c8565b610418565b610100610429565b61010a6000610483565b565b600080808061011d858701876105ec565b6001600160a01b038816600090815260016020526040902054909150808210610159576040516387332c0160e01b815260040160405180910390fd5b506001600160a01b0396909616600090815260026020908152604080832098835297815290879020875160608101895281548082526001909201546001600160801b03808216948301859052600160801b90910416980188905297909695509350505050565b6101c7610429565b6000806101d683850185610621565b9150915080604001516001600160801b031681602001516001600160801b031611156102155760405163123974fd60e01b815260040160405180910390fd5b6001600160a01b038216600090815260016020526040902054801561028e576001600160a01b0383166000908152600260205260408120906102586001846106d5565b815260200190815260200160002060010160109054906101000a90046001600160801b0316600161028991906106ee565b610291565b60005b6001600160801b031682602001516001600160801b0316146102c65760405163118b891b60e01b815260040160405180910390fd5b6001600160a01b03831660009081526002602090815260408083208484528252918290208451815590840151918401516001600160801b03908116600160801b0292169190911760019182015561031e908290610715565b6001600160a01b03841660008181526001602090815260409182902093909355805185518152858401516001600160801b03908116948201949094528582015190931690830152907fb71880d7a0c514d48c0296b2721b0a4f9641a45117960f2ca86b5b7873c4ab2f9060600160405180910390a25050505050565b6103a2610429565b6001600160a01b03811661040c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61041581610483565b50565b610420610429565b6104158161039a565b6000546001600160a01b0316331461010a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610403565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461041557600080fd5b60008083601f8401126104fa57600080fd5b50813567ffffffffffffffff81111561051257600080fd5b60208301915083602082850101111561052a57600080fd5b9250929050565b60008060006040848603121561054657600080fd5b8335610551816104d3565b9250602084013567ffffffffffffffff81111561056d57600080fd5b610579868287016104e8565b9497909650939450505050565b6000806020838503121561059957600080fd5b823567ffffffffffffffff8111156105b057600080fd5b6105bc858286016104e8565b90969095509350505050565b6000602082840312156105da57600080fd5b81356105e5816104d3565b9392505050565b6000602082840312156105fe57600080fd5b5035919050565b80356001600160801b038116811461061c57600080fd5b919050565b600080828403608081121561063557600080fd5b8335610640816104d3565b92506060601f198201121561065457600080fd5b506040516060810181811067ffffffffffffffff8211171561068657634e487b7160e01b600052604160045260246000fd5b80604052506020840135815261069e60408501610605565b60208201526106af60608501610605565b6040820152809150509250929050565b634e487b7160e01b600052601160045260246000fd5b818103818111156106e8576106e86106bf565b92915050565b6001600160801b0381811683821601908082111561070e5761070e6106bf565b5092915050565b808201808211156106e8576106e86106bf56fea2646970667358221220af04065c5d35d3460abc2711367000a2134970c84818233d66386f35794dfb5b64736f6c63430008130033a2646970667358221220022e94d4ec2e139486be793ccd0a8adc660dbcb526c820d52e52c49b3ca0a2c064736f6c63430008130033", - "devdoc": { - "events": { - "HistoryCreated(address,address)": { - "details": "MUST be triggered on a successful call to `newHistory`.", - "params": { - "history": "The history", - "historyOwner": "The initial history owner" - } - } - }, - "kind": "dev", - "methods": { - "calculateHistoryAddress(address,bytes32)": { - "details": "Beware that only the `newHistory` function with the `_salt` parameter is able to deterministically deploy a history.", - "params": { - "_historyOwner": "The initial history owner", - "_salt": "The salt used to deterministically generate the history address" - }, - "returns": { - "_0": "The deterministic history address" - } - }, - "newHistory(address)": { - "details": "On success, MUST emit a `HistoryCreated` event.", - "params": { - "_historyOwner": "The initial history owner" - }, - "returns": { - "_0": "The history" - } - }, - "newHistory(address,bytes32)": { - "details": "On success, MUST emit a `HistoryCreated` event.", - "params": { - "_historyOwner": "The initial history owner", - "_salt": "The salt used to deterministically generate the history address" - }, - "returns": { - "_0": "The history" - } - } - }, - "title": "History Factory", - "version": 1 - }, - "userdoc": { - "events": { - "HistoryCreated(address,address)": { - "notice": "A new history was deployed." - } - }, - "kind": "user", - "methods": { - "calculateHistoryAddress(address,bytes32)": { - "notice": "Calculate the address of a history to be deployed deterministically." - }, - "newHistory(address)": { - "notice": "Deploy a new history." - }, - "newHistory(address,bytes32)": { - "notice": "Deploy a new history deterministically." - } - }, - "notice": "Allows anyone to reliably deploy a new `History` contract.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/onchain/rollups/deployments/mainnet/HistoryFactory.json b/onchain/rollups/deployments/mainnet/HistoryFactory.json deleted file mode 100644 index a41f88d1..00000000 --- a/onchain/rollups/deployments/mainnet/HistoryFactory.json +++ /dev/null @@ -1,183 +0,0 @@ -{ - "address": "0x1f158b5320BBf677FdA89F9a438df99BbE560A26", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "historyOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract History", - "name": "history", - "type": "address" - } - ], - "name": "HistoryCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateHistoryAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newHistory", - "outputs": [ - { - "internalType": "contract History", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - } - ], - "name": "newHistory", - "outputs": [ - { - "internalType": "contract History", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0xb5e968ea6828c6010ebd0703a7fadcd5129a9a70db69264ce4229dc113d2aeea", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 139, - "gasUsed": "741828", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x3b1d337c06ccb9d75411848543386ed2d2c82eda9e1d1dd59d1d0878d86772ae", - "transactionHash": "0xb5e968ea6828c6010ebd0703a7fadcd5129a9a70db69264ce4229dc113d2aeea", - "logs": [], - "blockNumber": 18277838, - "cumulativeGasUsed": "9533738", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 1, - "solcInputHash": "b1bc2a879218740e83dfbb7046a3cc8c", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"historyOwner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract History\",\"name\":\"history\",\"type\":\"address\"}],\"name\":\"HistoryCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_historyOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"calculateHistoryAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_historyOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"newHistory\",\"outputs\":[{\"internalType\":\"contract History\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_historyOwner\",\"type\":\"address\"}],\"name\":\"newHistory\",\"outputs\":[{\"internalType\":\"contract History\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"HistoryCreated(address,address)\":{\"details\":\"MUST be triggered on a successful call to `newHistory`.\",\"params\":{\"history\":\"The history\",\"historyOwner\":\"The initial history owner\"}}},\"kind\":\"dev\",\"methods\":{\"calculateHistoryAddress(address,bytes32)\":{\"details\":\"Beware that only the `newHistory` function with the `_salt` parameter is able to deterministically deploy a history.\",\"params\":{\"_historyOwner\":\"The initial history owner\",\"_salt\":\"The salt used to deterministically generate the history address\"},\"returns\":{\"_0\":\"The deterministic history address\"}},\"newHistory(address)\":{\"details\":\"On success, MUST emit a `HistoryCreated` event.\",\"params\":{\"_historyOwner\":\"The initial history owner\"},\"returns\":{\"_0\":\"The history\"}},\"newHistory(address,bytes32)\":{\"details\":\"On success, MUST emit a `HistoryCreated` event.\",\"params\":{\"_historyOwner\":\"The initial history owner\",\"_salt\":\"The salt used to deterministically generate the history address\"},\"returns\":{\"_0\":\"The history\"}}},\"title\":\"History Factory\",\"version\":1},\"userdoc\":{\"events\":{\"HistoryCreated(address,address)\":{\"notice\":\"A new history was deployed.\"}},\"kind\":\"user\",\"methods\":{\"calculateHistoryAddress(address,bytes32)\":{\"notice\":\"Calculate the address of a history to be deployed deterministically.\"},\"newHistory(address)\":{\"notice\":\"Deploy a new history.\"},\"newHistory(address,bytes32)\":{\"notice\":\"Deploy a new history deterministically.\"}},\"notice\":\"Allows anyone to reliably deploy a new `History` contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/history/HistoryFactory.sol\":\"HistoryFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\\n require(address(this).balance >= amount, \\\"Create2: insufficient balance\\\");\\n require(bytecode.length != 0, \\\"Create2: bytecode length is zero\\\");\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n require(addr != address(0), \\\"Create2: Failed on deploy\\\");\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6e00f269073ffc4350e56b7e8153c9092d5f70bfba423299990514183101ef89\",\"license\":\"MIT\"},\"contracts/history/History.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\nimport {IHistory} from \\\"./IHistory.sol\\\";\\n\\n/// @title Simple History\\n///\\n/// @notice This contract stores claims for each DApp individually.\\n/// This means that, for each DApp, the contract stores an array of\\n/// `Claim` entries, where each `Claim` is composed of:\\n///\\n/// * An epoch hash (`bytes32`)\\n/// * A closed interval of input indices (`uint128`, `uint128`)\\n///\\n/// The contract guarantees that the first interval starts at index 0,\\n/// and that the following intervals don't have gaps or overlaps.\\n///\\n/// Furthermore, claims can only be submitted by the contract owner\\n/// through `submitClaim`, but can be retrieved by anyone with `getClaim`.\\n///\\n/// @dev This contract inherits OpenZeppelin's `Ownable` contract.\\n/// For more information on `Ownable`, please consult OpenZeppelin's official documentation.\\ncontract History is IHistory, Ownable {\\n struct Claim {\\n bytes32 epochHash;\\n uint128 firstIndex;\\n uint128 lastIndex;\\n }\\n\\n /// @notice Mapping from DApp address to number of claims.\\n mapping(address => uint256) internal numClaims;\\n\\n /// @notice Mapping from DApp address and claim index to claim.\\n /// @dev See the `getClaim` and `submitClaim` functions.\\n mapping(address => mapping(uint256 => Claim)) internal claims;\\n\\n /// @notice A new claim regarding a specific DApp was submitted.\\n /// @param dapp The address of the DApp\\n /// @param claim The newly-submitted claim\\n /// @dev MUST be triggered on a successful call to `submitClaim`.\\n event NewClaimToHistory(address indexed dapp, Claim claim);\\n\\n /// @notice Raised when one tries to submit a claim whose first input index\\n /// is not less than or equal to its last input index.\\n error InvalidInputIndices();\\n\\n /// @notice Raised when one tries to submit a claim that skips some input.\\n /// For example, when the 1st claim starts at index 5 (instead of 0)\\n /// or when the 1st claim ends at index 20 but the 2nd claim starts at\\n /// index 22 (instead of 21).\\n error UnclaimedInputs();\\n\\n /// @notice Raised when one tries to retrieve a claim with an invalid index.\\n error InvalidClaimIndex();\\n\\n /// @notice Creates a `History` contract.\\n /// @param _owner The initial owner\\n constructor(address _owner) {\\n // constructor in Ownable already called `transferOwnership(msg.sender)`, so\\n // we only need to call `transferOwnership(_owner)` if _owner != msg.sender\\n if (_owner != msg.sender) {\\n transferOwnership(_owner);\\n }\\n }\\n\\n /// @notice Submit a claim regarding a DApp.\\n /// There are several requirements for this function to be called successfully.\\n ///\\n /// * `_claimData` MUST be well-encoded. In Solidity, it can be constructed\\n /// as `abi.encode(dapp, claim)`, where `dapp` is the DApp address (type `address`)\\n /// and `claim` is the claim structure (type `Claim`).\\n ///\\n /// * `firstIndex` MUST be less than or equal to `lastIndex`.\\n /// As a result, every claim MUST encompass AT LEAST one input.\\n ///\\n /// * If this is the DApp's first claim, then `firstIndex` MUST be `0`.\\n /// Otherwise, `firstIndex` MUST be the `lastClaim.lastIndex + 1`.\\n /// In other words, claims MUST NOT skip inputs.\\n ///\\n /// @inheritdoc IHistory\\n /// @dev Emits a `NewClaimToHistory` event. Should have access control.\\n /// Incorrect claim input indices could raise two errors:\\n /// `InvalidInputIndices` if first index is posterior than last index or\\n /// `UnclaimedInputs` if first index is not the subsequent of previous claimed index or\\n /// if the first index of the first claim is not zero.\\n function submitClaim(\\n bytes calldata _claimData\\n ) external override onlyOwner {\\n (address dapp, Claim memory claim) = abi.decode(\\n _claimData,\\n (address, Claim)\\n );\\n\\n if (claim.firstIndex > claim.lastIndex) {\\n revert InvalidInputIndices();\\n }\\n\\n uint256 numDAppClaims = numClaims[dapp];\\n\\n if (\\n claim.firstIndex !=\\n (\\n (numDAppClaims == 0)\\n ? 0\\n : (claims[dapp][numDAppClaims - 1].lastIndex + 1)\\n )\\n ) {\\n revert UnclaimedInputs();\\n }\\n\\n claims[dapp][numDAppClaims] = claim;\\n numClaims[dapp] = numDAppClaims + 1;\\n\\n emit NewClaimToHistory(dapp, claim);\\n }\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// There are several requirements for this function to be called successfully.\\n ///\\n /// * `_proofContext` MUST be well-encoded. In Solidity, it can be constructed\\n /// as `abi.encode(claimIndex)`, where `claimIndex` is the claim index (type `uint256`).\\n ///\\n /// * `claimIndex` MUST be inside the interval `[0, n)` where `n` is the number of claims\\n /// that have been submitted to `_dapp` already.\\n ///\\n /// @inheritdoc IHistory\\n /// @dev If `claimIndex` is not inside the interval `[0, n)`, then\\n /// an `InvalidClaimIndex` error is raised.\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n ) external view override returns (bytes32, uint256, uint256) {\\n uint256 claimIndex = abi.decode(_proofContext, (uint256));\\n\\n uint256 numDAppClaims = numClaims[_dapp];\\n\\n if (claimIndex >= numDAppClaims) {\\n revert InvalidClaimIndex();\\n }\\n\\n Claim memory claim = claims[_dapp][claimIndex];\\n\\n return (claim.epochHash, claim.firstIndex, claim.lastIndex);\\n }\\n\\n /// @inheritdoc IHistory\\n /// @dev Emits an `OwnershipTransferred` event. Should have access control.\\n function migrateToConsensus(\\n address _consensus\\n ) external override onlyOwner {\\n transferOwnership(_consensus);\\n }\\n}\\n\",\"keccak256\":\"0x9fa2563961c1769c3bba2b6b27ec90eca8423dd7b5b5f47e3ef90451a31d66c8\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/history/HistoryFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Create2} from \\\"@openzeppelin/contracts/utils/Create2.sol\\\";\\n\\nimport {IHistoryFactory} from \\\"./IHistoryFactory.sol\\\";\\nimport {History} from \\\"./History.sol\\\";\\n\\n/// @title History Factory\\n/// @notice Allows anyone to reliably deploy a new `History` contract.\\ncontract HistoryFactory is IHistoryFactory {\\n function newHistory(\\n address _historyOwner\\n ) external override returns (History) {\\n History history = new History(_historyOwner);\\n\\n emit HistoryCreated(_historyOwner, history);\\n\\n return history;\\n }\\n\\n function newHistory(\\n address _historyOwner,\\n bytes32 _salt\\n ) external override returns (History) {\\n History history = new History{salt: _salt}(_historyOwner);\\n\\n emit HistoryCreated(_historyOwner, history);\\n\\n return history;\\n }\\n\\n function calculateHistoryAddress(\\n address _historyOwner,\\n bytes32 _salt\\n ) external view override returns (address) {\\n return\\n Create2.computeAddress(\\n _salt,\\n keccak256(\\n abi.encodePacked(\\n type(History).creationCode,\\n abi.encode(_historyOwner)\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x9cce9bafb6c8f3aa056f9109ff664d27f7f10160a3a856ade469598c31cfe9af\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/history/IHistory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @title History interface\\ninterface IHistory {\\n // Permissioned functions\\n\\n /// @notice Submit a claim.\\n /// The encoding of `_claimData` might vary\\n /// depending on the history implementation.\\n /// @param _claimData Data for submitting a claim\\n /// @dev Should have access control.\\n function submitClaim(bytes calldata _claimData) external;\\n\\n /// @notice Transfer ownership to another consensus.\\n /// @param _consensus The new consensus\\n /// @dev Should have access control.\\n function migrateToConsensus(address _consensus) external;\\n\\n // Permissionless functions\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// The encoding of `_proofContext` might vary\\n /// depending on the history implementation.\\n /// @param _dapp The DApp address\\n /// @param _proofContext Data for retrieving the desired claim\\n /// @return epochHash_ The claimed epoch hash\\n /// @return firstInputIndex_ The index of the first input of the epoch in the input box\\n /// @return lastInputIndex_ The index of the last input of the epoch in the input box\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n )\\n external\\n view\\n returns (\\n bytes32 epochHash_,\\n uint256 firstInputIndex_,\\n uint256 lastInputIndex_\\n );\\n}\\n\",\"keccak256\":\"0x1378cbc831833abae8e2a565b88899d6416ea1208aa9724bd4df28e74848ffcf\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/history/IHistoryFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {History} from \\\"./History.sol\\\";\\n\\n/// @title History Factory interface\\ninterface IHistoryFactory {\\n // Events\\n\\n /// @notice A new history was deployed.\\n /// @param historyOwner The initial history owner\\n /// @param history The history\\n /// @dev MUST be triggered on a successful call to `newHistory`.\\n event HistoryCreated(address historyOwner, History history);\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new history.\\n /// @param _historyOwner The initial history owner\\n /// @return The history\\n /// @dev On success, MUST emit a `HistoryCreated` event.\\n function newHistory(address _historyOwner) external returns (History);\\n\\n /// @notice Deploy a new history deterministically.\\n /// @param _historyOwner The initial history owner\\n /// @param _salt The salt used to deterministically generate the history address\\n /// @return The history\\n /// @dev On success, MUST emit a `HistoryCreated` event.\\n function newHistory(\\n address _historyOwner,\\n bytes32 _salt\\n ) external returns (History);\\n\\n /// @notice Calculate the address of a history to be deployed deterministically.\\n /// @param _historyOwner The initial history owner\\n /// @param _salt The salt used to deterministically generate the history address\\n /// @return The deterministic history address\\n /// @dev Beware that only the `newHistory` function with the `_salt` parameter\\n /// is able to deterministically deploy a history.\\n function calculateHistoryAddress(\\n address _historyOwner,\\n bytes32 _salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0xde2581bb8fc418b9ea6375c525c270cc49193269b90b0e46312df2fe28bee6b3\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50610c6f806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80632ab8b1151461004657806350f9c5ba1461007557806388d49a6214610088575b600080fd5b610059610054366004610289565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b610059610083366004610289565b61012a565b6100596100963660046102b3565b6101a5565b60008082846040516100ac90610260565b6001600160a01b0390911681526020018190604051809103906000f59050801580156100dc573d6000803e3d6000fd5b50604080516001600160a01b038088168252831660208201529192507f5b0ee1fb14fdb4a34ba9f0dda6790b059be11d8b3a954905dbad3c025c05c9c6910160405180910390a19392505050565b600061019e826040518060200161014090610260565b601f1982820381018352601f9091011660408181526001600160a01b03881660208301520160408051601f198184030181529082905261018392916020016102fe565b6040516020818303038152906040528051906020012061022e565b9392505050565b600080826040516101b590610260565b6001600160a01b039091168152602001604051809103906000f0801580156101e1573d6000803e3d6000fd5b50604080516001600160a01b038087168252831660208201529192507f5b0ee1fb14fdb4a34ba9f0dda6790b059be11d8b3a954905dbad3c025c05c9c6910160405180910390a192915050565b600061019e8383306000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b61091e8061031c83390190565b80356001600160a01b038116811461028457600080fd5b919050565b6000806040838503121561029c57600080fd5b6102a58361026d565b946020939093013593505050565b6000602082840312156102c557600080fd5b61019e8261026d565b6000815160005b818110156102ef57602081850181015186830152016102d5565b50600093019283525090919050565b600061031361030d83866102ce565b846102ce565b94935050505056fe608060405234801561001057600080fd5b5060405161091e38038061091e83398101604081905261002f91610181565b61003833610057565b6001600160a01b038116331461005157610051816100a7565b506101b1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6100af610125565b6001600160a01b0381166101195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61012281610057565b50565b6000546001600160a01b0316331461017f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610110565b565b60006020828403121561019357600080fd5b81516001600160a01b03811681146101aa57600080fd5b9392505050565b61075e806101c06000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c8063715018a6146100675780638da5cb5b14610071578063d79a824014610091578063ddfdfbb0146100bf578063f2fde38b146100d2578063fc411683146100e5575b600080fd5b61006f6100f8565b005b6000546040516001600160a01b0390911681526020015b60405180910390f35b6100a461009f366004610531565b61010c565b60408051938452602084019290925290820152606001610088565b61006f6100cd366004610586565b6101bf565b61006f6100e03660046105c8565b61039a565b61006f6100f33660046105c8565b610418565b610100610429565b61010a6000610483565b565b600080808061011d858701876105ec565b6001600160a01b038816600090815260016020526040902054909150808210610159576040516387332c0160e01b815260040160405180910390fd5b506001600160a01b0396909616600090815260026020908152604080832098835297815290879020875160608101895281548082526001909201546001600160801b03808216948301859052600160801b90910416980188905297909695509350505050565b6101c7610429565b6000806101d683850185610621565b9150915080604001516001600160801b031681602001516001600160801b031611156102155760405163123974fd60e01b815260040160405180910390fd5b6001600160a01b038216600090815260016020526040902054801561028e576001600160a01b0383166000908152600260205260408120906102586001846106d5565b815260200190815260200160002060010160109054906101000a90046001600160801b0316600161028991906106ee565b610291565b60005b6001600160801b031682602001516001600160801b0316146102c65760405163118b891b60e01b815260040160405180910390fd5b6001600160a01b03831660009081526002602090815260408083208484528252918290208451815590840151918401516001600160801b03908116600160801b0292169190911760019182015561031e908290610715565b6001600160a01b03841660008181526001602090815260409182902093909355805185518152858401516001600160801b03908116948201949094528582015190931690830152907fb71880d7a0c514d48c0296b2721b0a4f9641a45117960f2ca86b5b7873c4ab2f9060600160405180910390a25050505050565b6103a2610429565b6001600160a01b03811661040c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61041581610483565b50565b610420610429565b6104158161039a565b6000546001600160a01b0316331461010a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610403565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461041557600080fd5b60008083601f8401126104fa57600080fd5b50813567ffffffffffffffff81111561051257600080fd5b60208301915083602082850101111561052a57600080fd5b9250929050565b60008060006040848603121561054657600080fd5b8335610551816104d3565b9250602084013567ffffffffffffffff81111561056d57600080fd5b610579868287016104e8565b9497909650939450505050565b6000806020838503121561059957600080fd5b823567ffffffffffffffff8111156105b057600080fd5b6105bc858286016104e8565b90969095509350505050565b6000602082840312156105da57600080fd5b81356105e5816104d3565b9392505050565b6000602082840312156105fe57600080fd5b5035919050565b80356001600160801b038116811461061c57600080fd5b919050565b600080828403608081121561063557600080fd5b8335610640816104d3565b92506060601f198201121561065457600080fd5b506040516060810181811067ffffffffffffffff8211171561068657634e487b7160e01b600052604160045260246000fd5b80604052506020840135815261069e60408501610605565b60208201526106af60608501610605565b6040820152809150509250929050565b634e487b7160e01b600052601160045260246000fd5b818103818111156106e8576106e86106bf565b92915050565b6001600160801b0381811683821601908082111561070e5761070e6106bf565b5092915050565b808201808211156106e8576106e86106bf56fea2646970667358221220af04065c5d35d3460abc2711367000a2134970c84818233d66386f35794dfb5b64736f6c63430008130033a2646970667358221220022e94d4ec2e139486be793ccd0a8adc660dbcb526c820d52e52c49b3ca0a2c064736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80632ab8b1151461004657806350f9c5ba1461007557806388d49a6214610088575b600080fd5b610059610054366004610289565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b610059610083366004610289565b61012a565b6100596100963660046102b3565b6101a5565b60008082846040516100ac90610260565b6001600160a01b0390911681526020018190604051809103906000f59050801580156100dc573d6000803e3d6000fd5b50604080516001600160a01b038088168252831660208201529192507f5b0ee1fb14fdb4a34ba9f0dda6790b059be11d8b3a954905dbad3c025c05c9c6910160405180910390a19392505050565b600061019e826040518060200161014090610260565b601f1982820381018352601f9091011660408181526001600160a01b03881660208301520160408051601f198184030181529082905261018392916020016102fe565b6040516020818303038152906040528051906020012061022e565b9392505050565b600080826040516101b590610260565b6001600160a01b039091168152602001604051809103906000f0801580156101e1573d6000803e3d6000fd5b50604080516001600160a01b038087168252831660208201529192507f5b0ee1fb14fdb4a34ba9f0dda6790b059be11d8b3a954905dbad3c025c05c9c6910160405180910390a192915050565b600061019e8383306000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b61091e8061031c83390190565b80356001600160a01b038116811461028457600080fd5b919050565b6000806040838503121561029c57600080fd5b6102a58361026d565b946020939093013593505050565b6000602082840312156102c557600080fd5b61019e8261026d565b6000815160005b818110156102ef57602081850181015186830152016102d5565b50600093019283525090919050565b600061031361030d83866102ce565b846102ce565b94935050505056fe608060405234801561001057600080fd5b5060405161091e38038061091e83398101604081905261002f91610181565b61003833610057565b6001600160a01b038116331461005157610051816100a7565b506101b1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6100af610125565b6001600160a01b0381166101195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61012281610057565b50565b6000546001600160a01b0316331461017f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610110565b565b60006020828403121561019357600080fd5b81516001600160a01b03811681146101aa57600080fd5b9392505050565b61075e806101c06000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c8063715018a6146100675780638da5cb5b14610071578063d79a824014610091578063ddfdfbb0146100bf578063f2fde38b146100d2578063fc411683146100e5575b600080fd5b61006f6100f8565b005b6000546040516001600160a01b0390911681526020015b60405180910390f35b6100a461009f366004610531565b61010c565b60408051938452602084019290925290820152606001610088565b61006f6100cd366004610586565b6101bf565b61006f6100e03660046105c8565b61039a565b61006f6100f33660046105c8565b610418565b610100610429565b61010a6000610483565b565b600080808061011d858701876105ec565b6001600160a01b038816600090815260016020526040902054909150808210610159576040516387332c0160e01b815260040160405180910390fd5b506001600160a01b0396909616600090815260026020908152604080832098835297815290879020875160608101895281548082526001909201546001600160801b03808216948301859052600160801b90910416980188905297909695509350505050565b6101c7610429565b6000806101d683850185610621565b9150915080604001516001600160801b031681602001516001600160801b031611156102155760405163123974fd60e01b815260040160405180910390fd5b6001600160a01b038216600090815260016020526040902054801561028e576001600160a01b0383166000908152600260205260408120906102586001846106d5565b815260200190815260200160002060010160109054906101000a90046001600160801b0316600161028991906106ee565b610291565b60005b6001600160801b031682602001516001600160801b0316146102c65760405163118b891b60e01b815260040160405180910390fd5b6001600160a01b03831660009081526002602090815260408083208484528252918290208451815590840151918401516001600160801b03908116600160801b0292169190911760019182015561031e908290610715565b6001600160a01b03841660008181526001602090815260409182902093909355805185518152858401516001600160801b03908116948201949094528582015190931690830152907fb71880d7a0c514d48c0296b2721b0a4f9641a45117960f2ca86b5b7873c4ab2f9060600160405180910390a25050505050565b6103a2610429565b6001600160a01b03811661040c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61041581610483565b50565b610420610429565b6104158161039a565b6000546001600160a01b0316331461010a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610403565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461041557600080fd5b60008083601f8401126104fa57600080fd5b50813567ffffffffffffffff81111561051257600080fd5b60208301915083602082850101111561052a57600080fd5b9250929050565b60008060006040848603121561054657600080fd5b8335610551816104d3565b9250602084013567ffffffffffffffff81111561056d57600080fd5b610579868287016104e8565b9497909650939450505050565b6000806020838503121561059957600080fd5b823567ffffffffffffffff8111156105b057600080fd5b6105bc858286016104e8565b90969095509350505050565b6000602082840312156105da57600080fd5b81356105e5816104d3565b9392505050565b6000602082840312156105fe57600080fd5b5035919050565b80356001600160801b038116811461061c57600080fd5b919050565b600080828403608081121561063557600080fd5b8335610640816104d3565b92506060601f198201121561065457600080fd5b506040516060810181811067ffffffffffffffff8211171561068657634e487b7160e01b600052604160045260246000fd5b80604052506020840135815261069e60408501610605565b60208201526106af60608501610605565b6040820152809150509250929050565b634e487b7160e01b600052601160045260246000fd5b818103818111156106e8576106e86106bf565b92915050565b6001600160801b0381811683821601908082111561070e5761070e6106bf565b5092915050565b808201808211156106e8576106e86106bf56fea2646970667358221220af04065c5d35d3460abc2711367000a2134970c84818233d66386f35794dfb5b64736f6c63430008130033a2646970667358221220022e94d4ec2e139486be793ccd0a8adc660dbcb526c820d52e52c49b3ca0a2c064736f6c63430008130033", - "devdoc": { - "events": { - "HistoryCreated(address,address)": { - "details": "MUST be triggered on a successful call to `newHistory`.", - "params": { - "history": "The history", - "historyOwner": "The initial history owner" - } - } - }, - "kind": "dev", - "methods": { - "calculateHistoryAddress(address,bytes32)": { - "details": "Beware that only the `newHistory` function with the `_salt` parameter is able to deterministically deploy a history.", - "params": { - "_historyOwner": "The initial history owner", - "_salt": "The salt used to deterministically generate the history address" - }, - "returns": { - "_0": "The deterministic history address" - } - }, - "newHistory(address)": { - "details": "On success, MUST emit a `HistoryCreated` event.", - "params": { - "_historyOwner": "The initial history owner" - }, - "returns": { - "_0": "The history" - } - }, - "newHistory(address,bytes32)": { - "details": "On success, MUST emit a `HistoryCreated` event.", - "params": { - "_historyOwner": "The initial history owner", - "_salt": "The salt used to deterministically generate the history address" - }, - "returns": { - "_0": "The history" - } - } - }, - "title": "History Factory", - "version": 1 - }, - "userdoc": { - "events": { - "HistoryCreated(address,address)": { - "notice": "A new history was deployed." - } - }, - "kind": "user", - "methods": { - "calculateHistoryAddress(address,bytes32)": { - "notice": "Calculate the address of a history to be deployed deterministically." - }, - "newHistory(address)": { - "notice": "Deploy a new history." - }, - "newHistory(address,bytes32)": { - "notice": "Deploy a new history deterministically." - } - }, - "notice": "Allows anyone to reliably deploy a new `History` contract.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/onchain/rollups/deployments/optimism/HistoryFactory.json b/onchain/rollups/deployments/optimism/HistoryFactory.json deleted file mode 100644 index 2ae236dc..00000000 --- a/onchain/rollups/deployments/optimism/HistoryFactory.json +++ /dev/null @@ -1,183 +0,0 @@ -{ - "address": "0x1f158b5320BBf677FdA89F9a438df99BbE560A26", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "historyOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract History", - "name": "history", - "type": "address" - } - ], - "name": "HistoryCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateHistoryAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newHistory", - "outputs": [ - { - "internalType": "contract History", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - } - ], - "name": "newHistory", - "outputs": [ - { - "internalType": "contract History", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0xe545f2ce457763bf299aaa4ffeba578fb8d39d7188eb1ae5ae2ec504bad00fec", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 9, - "gasUsed": "741626", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xda11e82ee691b811bf06df747b6972fe67e509c7c25d8f63807e2a862e51395e", - "transactionHash": "0xe545f2ce457763bf299aaa4ffeba578fb8d39d7188eb1ae5ae2ec504bad00fec", - "logs": [], - "blockNumber": 110416001, - "cumulativeGasUsed": "2426395", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 1, - "solcInputHash": "b1bc2a879218740e83dfbb7046a3cc8c", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"historyOwner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract History\",\"name\":\"history\",\"type\":\"address\"}],\"name\":\"HistoryCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_historyOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"calculateHistoryAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_historyOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"newHistory\",\"outputs\":[{\"internalType\":\"contract History\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_historyOwner\",\"type\":\"address\"}],\"name\":\"newHistory\",\"outputs\":[{\"internalType\":\"contract History\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"HistoryCreated(address,address)\":{\"details\":\"MUST be triggered on a successful call to `newHistory`.\",\"params\":{\"history\":\"The history\",\"historyOwner\":\"The initial history owner\"}}},\"kind\":\"dev\",\"methods\":{\"calculateHistoryAddress(address,bytes32)\":{\"details\":\"Beware that only the `newHistory` function with the `_salt` parameter is able to deterministically deploy a history.\",\"params\":{\"_historyOwner\":\"The initial history owner\",\"_salt\":\"The salt used to deterministically generate the history address\"},\"returns\":{\"_0\":\"The deterministic history address\"}},\"newHistory(address)\":{\"details\":\"On success, MUST emit a `HistoryCreated` event.\",\"params\":{\"_historyOwner\":\"The initial history owner\"},\"returns\":{\"_0\":\"The history\"}},\"newHistory(address,bytes32)\":{\"details\":\"On success, MUST emit a `HistoryCreated` event.\",\"params\":{\"_historyOwner\":\"The initial history owner\",\"_salt\":\"The salt used to deterministically generate the history address\"},\"returns\":{\"_0\":\"The history\"}}},\"title\":\"History Factory\",\"version\":1},\"userdoc\":{\"events\":{\"HistoryCreated(address,address)\":{\"notice\":\"A new history was deployed.\"}},\"kind\":\"user\",\"methods\":{\"calculateHistoryAddress(address,bytes32)\":{\"notice\":\"Calculate the address of a history to be deployed deterministically.\"},\"newHistory(address)\":{\"notice\":\"Deploy a new history.\"},\"newHistory(address,bytes32)\":{\"notice\":\"Deploy a new history deterministically.\"}},\"notice\":\"Allows anyone to reliably deploy a new `History` contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/history/HistoryFactory.sol\":\"HistoryFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\\n require(address(this).balance >= amount, \\\"Create2: insufficient balance\\\");\\n require(bytecode.length != 0, \\\"Create2: bytecode length is zero\\\");\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n require(addr != address(0), \\\"Create2: Failed on deploy\\\");\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6e00f269073ffc4350e56b7e8153c9092d5f70bfba423299990514183101ef89\",\"license\":\"MIT\"},\"contracts/history/History.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\nimport {IHistory} from \\\"./IHistory.sol\\\";\\n\\n/// @title Simple History\\n///\\n/// @notice This contract stores claims for each DApp individually.\\n/// This means that, for each DApp, the contract stores an array of\\n/// `Claim` entries, where each `Claim` is composed of:\\n///\\n/// * An epoch hash (`bytes32`)\\n/// * A closed interval of input indices (`uint128`, `uint128`)\\n///\\n/// The contract guarantees that the first interval starts at index 0,\\n/// and that the following intervals don't have gaps or overlaps.\\n///\\n/// Furthermore, claims can only be submitted by the contract owner\\n/// through `submitClaim`, but can be retrieved by anyone with `getClaim`.\\n///\\n/// @dev This contract inherits OpenZeppelin's `Ownable` contract.\\n/// For more information on `Ownable`, please consult OpenZeppelin's official documentation.\\ncontract History is IHistory, Ownable {\\n struct Claim {\\n bytes32 epochHash;\\n uint128 firstIndex;\\n uint128 lastIndex;\\n }\\n\\n /// @notice Mapping from DApp address to number of claims.\\n mapping(address => uint256) internal numClaims;\\n\\n /// @notice Mapping from DApp address and claim index to claim.\\n /// @dev See the `getClaim` and `submitClaim` functions.\\n mapping(address => mapping(uint256 => Claim)) internal claims;\\n\\n /// @notice A new claim regarding a specific DApp was submitted.\\n /// @param dapp The address of the DApp\\n /// @param claim The newly-submitted claim\\n /// @dev MUST be triggered on a successful call to `submitClaim`.\\n event NewClaimToHistory(address indexed dapp, Claim claim);\\n\\n /// @notice Raised when one tries to submit a claim whose first input index\\n /// is not less than or equal to its last input index.\\n error InvalidInputIndices();\\n\\n /// @notice Raised when one tries to submit a claim that skips some input.\\n /// For example, when the 1st claim starts at index 5 (instead of 0)\\n /// or when the 1st claim ends at index 20 but the 2nd claim starts at\\n /// index 22 (instead of 21).\\n error UnclaimedInputs();\\n\\n /// @notice Raised when one tries to retrieve a claim with an invalid index.\\n error InvalidClaimIndex();\\n\\n /// @notice Creates a `History` contract.\\n /// @param _owner The initial owner\\n constructor(address _owner) {\\n // constructor in Ownable already called `transferOwnership(msg.sender)`, so\\n // we only need to call `transferOwnership(_owner)` if _owner != msg.sender\\n if (_owner != msg.sender) {\\n transferOwnership(_owner);\\n }\\n }\\n\\n /// @notice Submit a claim regarding a DApp.\\n /// There are several requirements for this function to be called successfully.\\n ///\\n /// * `_claimData` MUST be well-encoded. In Solidity, it can be constructed\\n /// as `abi.encode(dapp, claim)`, where `dapp` is the DApp address (type `address`)\\n /// and `claim` is the claim structure (type `Claim`).\\n ///\\n /// * `firstIndex` MUST be less than or equal to `lastIndex`.\\n /// As a result, every claim MUST encompass AT LEAST one input.\\n ///\\n /// * If this is the DApp's first claim, then `firstIndex` MUST be `0`.\\n /// Otherwise, `firstIndex` MUST be the `lastClaim.lastIndex + 1`.\\n /// In other words, claims MUST NOT skip inputs.\\n ///\\n /// @inheritdoc IHistory\\n /// @dev Emits a `NewClaimToHistory` event. Should have access control.\\n /// Incorrect claim input indices could raise two errors:\\n /// `InvalidInputIndices` if first index is posterior than last index or\\n /// `UnclaimedInputs` if first index is not the subsequent of previous claimed index or\\n /// if the first index of the first claim is not zero.\\n function submitClaim(\\n bytes calldata _claimData\\n ) external override onlyOwner {\\n (address dapp, Claim memory claim) = abi.decode(\\n _claimData,\\n (address, Claim)\\n );\\n\\n if (claim.firstIndex > claim.lastIndex) {\\n revert InvalidInputIndices();\\n }\\n\\n uint256 numDAppClaims = numClaims[dapp];\\n\\n if (\\n claim.firstIndex !=\\n (\\n (numDAppClaims == 0)\\n ? 0\\n : (claims[dapp][numDAppClaims - 1].lastIndex + 1)\\n )\\n ) {\\n revert UnclaimedInputs();\\n }\\n\\n claims[dapp][numDAppClaims] = claim;\\n numClaims[dapp] = numDAppClaims + 1;\\n\\n emit NewClaimToHistory(dapp, claim);\\n }\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// There are several requirements for this function to be called successfully.\\n ///\\n /// * `_proofContext` MUST be well-encoded. In Solidity, it can be constructed\\n /// as `abi.encode(claimIndex)`, where `claimIndex` is the claim index (type `uint256`).\\n ///\\n /// * `claimIndex` MUST be inside the interval `[0, n)` where `n` is the number of claims\\n /// that have been submitted to `_dapp` already.\\n ///\\n /// @inheritdoc IHistory\\n /// @dev If `claimIndex` is not inside the interval `[0, n)`, then\\n /// an `InvalidClaimIndex` error is raised.\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n ) external view override returns (bytes32, uint256, uint256) {\\n uint256 claimIndex = abi.decode(_proofContext, (uint256));\\n\\n uint256 numDAppClaims = numClaims[_dapp];\\n\\n if (claimIndex >= numDAppClaims) {\\n revert InvalidClaimIndex();\\n }\\n\\n Claim memory claim = claims[_dapp][claimIndex];\\n\\n return (claim.epochHash, claim.firstIndex, claim.lastIndex);\\n }\\n\\n /// @inheritdoc IHistory\\n /// @dev Emits an `OwnershipTransferred` event. Should have access control.\\n function migrateToConsensus(\\n address _consensus\\n ) external override onlyOwner {\\n transferOwnership(_consensus);\\n }\\n}\\n\",\"keccak256\":\"0x9fa2563961c1769c3bba2b6b27ec90eca8423dd7b5b5f47e3ef90451a31d66c8\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/history/HistoryFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Create2} from \\\"@openzeppelin/contracts/utils/Create2.sol\\\";\\n\\nimport {IHistoryFactory} from \\\"./IHistoryFactory.sol\\\";\\nimport {History} from \\\"./History.sol\\\";\\n\\n/// @title History Factory\\n/// @notice Allows anyone to reliably deploy a new `History` contract.\\ncontract HistoryFactory is IHistoryFactory {\\n function newHistory(\\n address _historyOwner\\n ) external override returns (History) {\\n History history = new History(_historyOwner);\\n\\n emit HistoryCreated(_historyOwner, history);\\n\\n return history;\\n }\\n\\n function newHistory(\\n address _historyOwner,\\n bytes32 _salt\\n ) external override returns (History) {\\n History history = new History{salt: _salt}(_historyOwner);\\n\\n emit HistoryCreated(_historyOwner, history);\\n\\n return history;\\n }\\n\\n function calculateHistoryAddress(\\n address _historyOwner,\\n bytes32 _salt\\n ) external view override returns (address) {\\n return\\n Create2.computeAddress(\\n _salt,\\n keccak256(\\n abi.encodePacked(\\n type(History).creationCode,\\n abi.encode(_historyOwner)\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x9cce9bafb6c8f3aa056f9109ff664d27f7f10160a3a856ade469598c31cfe9af\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/history/IHistory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @title History interface\\ninterface IHistory {\\n // Permissioned functions\\n\\n /// @notice Submit a claim.\\n /// The encoding of `_claimData` might vary\\n /// depending on the history implementation.\\n /// @param _claimData Data for submitting a claim\\n /// @dev Should have access control.\\n function submitClaim(bytes calldata _claimData) external;\\n\\n /// @notice Transfer ownership to another consensus.\\n /// @param _consensus The new consensus\\n /// @dev Should have access control.\\n function migrateToConsensus(address _consensus) external;\\n\\n // Permissionless functions\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// The encoding of `_proofContext` might vary\\n /// depending on the history implementation.\\n /// @param _dapp The DApp address\\n /// @param _proofContext Data for retrieving the desired claim\\n /// @return epochHash_ The claimed epoch hash\\n /// @return firstInputIndex_ The index of the first input of the epoch in the input box\\n /// @return lastInputIndex_ The index of the last input of the epoch in the input box\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n )\\n external\\n view\\n returns (\\n bytes32 epochHash_,\\n uint256 firstInputIndex_,\\n uint256 lastInputIndex_\\n );\\n}\\n\",\"keccak256\":\"0x1378cbc831833abae8e2a565b88899d6416ea1208aa9724bd4df28e74848ffcf\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/history/IHistoryFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {History} from \\\"./History.sol\\\";\\n\\n/// @title History Factory interface\\ninterface IHistoryFactory {\\n // Events\\n\\n /// @notice A new history was deployed.\\n /// @param historyOwner The initial history owner\\n /// @param history The history\\n /// @dev MUST be triggered on a successful call to `newHistory`.\\n event HistoryCreated(address historyOwner, History history);\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new history.\\n /// @param _historyOwner The initial history owner\\n /// @return The history\\n /// @dev On success, MUST emit a `HistoryCreated` event.\\n function newHistory(address _historyOwner) external returns (History);\\n\\n /// @notice Deploy a new history deterministically.\\n /// @param _historyOwner The initial history owner\\n /// @param _salt The salt used to deterministically generate the history address\\n /// @return The history\\n /// @dev On success, MUST emit a `HistoryCreated` event.\\n function newHistory(\\n address _historyOwner,\\n bytes32 _salt\\n ) external returns (History);\\n\\n /// @notice Calculate the address of a history to be deployed deterministically.\\n /// @param _historyOwner The initial history owner\\n /// @param _salt The salt used to deterministically generate the history address\\n /// @return The deterministic history address\\n /// @dev Beware that only the `newHistory` function with the `_salt` parameter\\n /// is able to deterministically deploy a history.\\n function calculateHistoryAddress(\\n address _historyOwner,\\n bytes32 _salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0xde2581bb8fc418b9ea6375c525c270cc49193269b90b0e46312df2fe28bee6b3\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50610c6f806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80632ab8b1151461004657806350f9c5ba1461007557806388d49a6214610088575b600080fd5b610059610054366004610289565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b610059610083366004610289565b61012a565b6100596100963660046102b3565b6101a5565b60008082846040516100ac90610260565b6001600160a01b0390911681526020018190604051809103906000f59050801580156100dc573d6000803e3d6000fd5b50604080516001600160a01b038088168252831660208201529192507f5b0ee1fb14fdb4a34ba9f0dda6790b059be11d8b3a954905dbad3c025c05c9c6910160405180910390a19392505050565b600061019e826040518060200161014090610260565b601f1982820381018352601f9091011660408181526001600160a01b03881660208301520160408051601f198184030181529082905261018392916020016102fe565b6040516020818303038152906040528051906020012061022e565b9392505050565b600080826040516101b590610260565b6001600160a01b039091168152602001604051809103906000f0801580156101e1573d6000803e3d6000fd5b50604080516001600160a01b038087168252831660208201529192507f5b0ee1fb14fdb4a34ba9f0dda6790b059be11d8b3a954905dbad3c025c05c9c6910160405180910390a192915050565b600061019e8383306000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b61091e8061031c83390190565b80356001600160a01b038116811461028457600080fd5b919050565b6000806040838503121561029c57600080fd5b6102a58361026d565b946020939093013593505050565b6000602082840312156102c557600080fd5b61019e8261026d565b6000815160005b818110156102ef57602081850181015186830152016102d5565b50600093019283525090919050565b600061031361030d83866102ce565b846102ce565b94935050505056fe608060405234801561001057600080fd5b5060405161091e38038061091e83398101604081905261002f91610181565b61003833610057565b6001600160a01b038116331461005157610051816100a7565b506101b1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6100af610125565b6001600160a01b0381166101195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61012281610057565b50565b6000546001600160a01b0316331461017f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610110565b565b60006020828403121561019357600080fd5b81516001600160a01b03811681146101aa57600080fd5b9392505050565b61075e806101c06000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c8063715018a6146100675780638da5cb5b14610071578063d79a824014610091578063ddfdfbb0146100bf578063f2fde38b146100d2578063fc411683146100e5575b600080fd5b61006f6100f8565b005b6000546040516001600160a01b0390911681526020015b60405180910390f35b6100a461009f366004610531565b61010c565b60408051938452602084019290925290820152606001610088565b61006f6100cd366004610586565b6101bf565b61006f6100e03660046105c8565b61039a565b61006f6100f33660046105c8565b610418565b610100610429565b61010a6000610483565b565b600080808061011d858701876105ec565b6001600160a01b038816600090815260016020526040902054909150808210610159576040516387332c0160e01b815260040160405180910390fd5b506001600160a01b0396909616600090815260026020908152604080832098835297815290879020875160608101895281548082526001909201546001600160801b03808216948301859052600160801b90910416980188905297909695509350505050565b6101c7610429565b6000806101d683850185610621565b9150915080604001516001600160801b031681602001516001600160801b031611156102155760405163123974fd60e01b815260040160405180910390fd5b6001600160a01b038216600090815260016020526040902054801561028e576001600160a01b0383166000908152600260205260408120906102586001846106d5565b815260200190815260200160002060010160109054906101000a90046001600160801b0316600161028991906106ee565b610291565b60005b6001600160801b031682602001516001600160801b0316146102c65760405163118b891b60e01b815260040160405180910390fd5b6001600160a01b03831660009081526002602090815260408083208484528252918290208451815590840151918401516001600160801b03908116600160801b0292169190911760019182015561031e908290610715565b6001600160a01b03841660008181526001602090815260409182902093909355805185518152858401516001600160801b03908116948201949094528582015190931690830152907fb71880d7a0c514d48c0296b2721b0a4f9641a45117960f2ca86b5b7873c4ab2f9060600160405180910390a25050505050565b6103a2610429565b6001600160a01b03811661040c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61041581610483565b50565b610420610429565b6104158161039a565b6000546001600160a01b0316331461010a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610403565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461041557600080fd5b60008083601f8401126104fa57600080fd5b50813567ffffffffffffffff81111561051257600080fd5b60208301915083602082850101111561052a57600080fd5b9250929050565b60008060006040848603121561054657600080fd5b8335610551816104d3565b9250602084013567ffffffffffffffff81111561056d57600080fd5b610579868287016104e8565b9497909650939450505050565b6000806020838503121561059957600080fd5b823567ffffffffffffffff8111156105b057600080fd5b6105bc858286016104e8565b90969095509350505050565b6000602082840312156105da57600080fd5b81356105e5816104d3565b9392505050565b6000602082840312156105fe57600080fd5b5035919050565b80356001600160801b038116811461061c57600080fd5b919050565b600080828403608081121561063557600080fd5b8335610640816104d3565b92506060601f198201121561065457600080fd5b506040516060810181811067ffffffffffffffff8211171561068657634e487b7160e01b600052604160045260246000fd5b80604052506020840135815261069e60408501610605565b60208201526106af60608501610605565b6040820152809150509250929050565b634e487b7160e01b600052601160045260246000fd5b818103818111156106e8576106e86106bf565b92915050565b6001600160801b0381811683821601908082111561070e5761070e6106bf565b5092915050565b808201808211156106e8576106e86106bf56fea2646970667358221220af04065c5d35d3460abc2711367000a2134970c84818233d66386f35794dfb5b64736f6c63430008130033a2646970667358221220022e94d4ec2e139486be793ccd0a8adc660dbcb526c820d52e52c49b3ca0a2c064736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80632ab8b1151461004657806350f9c5ba1461007557806388d49a6214610088575b600080fd5b610059610054366004610289565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b610059610083366004610289565b61012a565b6100596100963660046102b3565b6101a5565b60008082846040516100ac90610260565b6001600160a01b0390911681526020018190604051809103906000f59050801580156100dc573d6000803e3d6000fd5b50604080516001600160a01b038088168252831660208201529192507f5b0ee1fb14fdb4a34ba9f0dda6790b059be11d8b3a954905dbad3c025c05c9c6910160405180910390a19392505050565b600061019e826040518060200161014090610260565b601f1982820381018352601f9091011660408181526001600160a01b03881660208301520160408051601f198184030181529082905261018392916020016102fe565b6040516020818303038152906040528051906020012061022e565b9392505050565b600080826040516101b590610260565b6001600160a01b039091168152602001604051809103906000f0801580156101e1573d6000803e3d6000fd5b50604080516001600160a01b038087168252831660208201529192507f5b0ee1fb14fdb4a34ba9f0dda6790b059be11d8b3a954905dbad3c025c05c9c6910160405180910390a192915050565b600061019e8383306000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b61091e8061031c83390190565b80356001600160a01b038116811461028457600080fd5b919050565b6000806040838503121561029c57600080fd5b6102a58361026d565b946020939093013593505050565b6000602082840312156102c557600080fd5b61019e8261026d565b6000815160005b818110156102ef57602081850181015186830152016102d5565b50600093019283525090919050565b600061031361030d83866102ce565b846102ce565b94935050505056fe608060405234801561001057600080fd5b5060405161091e38038061091e83398101604081905261002f91610181565b61003833610057565b6001600160a01b038116331461005157610051816100a7565b506101b1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6100af610125565b6001600160a01b0381166101195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61012281610057565b50565b6000546001600160a01b0316331461017f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610110565b565b60006020828403121561019357600080fd5b81516001600160a01b03811681146101aa57600080fd5b9392505050565b61075e806101c06000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c8063715018a6146100675780638da5cb5b14610071578063d79a824014610091578063ddfdfbb0146100bf578063f2fde38b146100d2578063fc411683146100e5575b600080fd5b61006f6100f8565b005b6000546040516001600160a01b0390911681526020015b60405180910390f35b6100a461009f366004610531565b61010c565b60408051938452602084019290925290820152606001610088565b61006f6100cd366004610586565b6101bf565b61006f6100e03660046105c8565b61039a565b61006f6100f33660046105c8565b610418565b610100610429565b61010a6000610483565b565b600080808061011d858701876105ec565b6001600160a01b038816600090815260016020526040902054909150808210610159576040516387332c0160e01b815260040160405180910390fd5b506001600160a01b0396909616600090815260026020908152604080832098835297815290879020875160608101895281548082526001909201546001600160801b03808216948301859052600160801b90910416980188905297909695509350505050565b6101c7610429565b6000806101d683850185610621565b9150915080604001516001600160801b031681602001516001600160801b031611156102155760405163123974fd60e01b815260040160405180910390fd5b6001600160a01b038216600090815260016020526040902054801561028e576001600160a01b0383166000908152600260205260408120906102586001846106d5565b815260200190815260200160002060010160109054906101000a90046001600160801b0316600161028991906106ee565b610291565b60005b6001600160801b031682602001516001600160801b0316146102c65760405163118b891b60e01b815260040160405180910390fd5b6001600160a01b03831660009081526002602090815260408083208484528252918290208451815590840151918401516001600160801b03908116600160801b0292169190911760019182015561031e908290610715565b6001600160a01b03841660008181526001602090815260409182902093909355805185518152858401516001600160801b03908116948201949094528582015190931690830152907fb71880d7a0c514d48c0296b2721b0a4f9641a45117960f2ca86b5b7873c4ab2f9060600160405180910390a25050505050565b6103a2610429565b6001600160a01b03811661040c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61041581610483565b50565b610420610429565b6104158161039a565b6000546001600160a01b0316331461010a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610403565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461041557600080fd5b60008083601f8401126104fa57600080fd5b50813567ffffffffffffffff81111561051257600080fd5b60208301915083602082850101111561052a57600080fd5b9250929050565b60008060006040848603121561054657600080fd5b8335610551816104d3565b9250602084013567ffffffffffffffff81111561056d57600080fd5b610579868287016104e8565b9497909650939450505050565b6000806020838503121561059957600080fd5b823567ffffffffffffffff8111156105b057600080fd5b6105bc858286016104e8565b90969095509350505050565b6000602082840312156105da57600080fd5b81356105e5816104d3565b9392505050565b6000602082840312156105fe57600080fd5b5035919050565b80356001600160801b038116811461061c57600080fd5b919050565b600080828403608081121561063557600080fd5b8335610640816104d3565b92506060601f198201121561065457600080fd5b506040516060810181811067ffffffffffffffff8211171561068657634e487b7160e01b600052604160045260246000fd5b80604052506020840135815261069e60408501610605565b60208201526106af60608501610605565b6040820152809150509250929050565b634e487b7160e01b600052601160045260246000fd5b818103818111156106e8576106e86106bf565b92915050565b6001600160801b0381811683821601908082111561070e5761070e6106bf565b5092915050565b808201808211156106e8576106e86106bf56fea2646970667358221220af04065c5d35d3460abc2711367000a2134970c84818233d66386f35794dfb5b64736f6c63430008130033a2646970667358221220022e94d4ec2e139486be793ccd0a8adc660dbcb526c820d52e52c49b3ca0a2c064736f6c63430008130033", - "devdoc": { - "events": { - "HistoryCreated(address,address)": { - "details": "MUST be triggered on a successful call to `newHistory`.", - "params": { - "history": "The history", - "historyOwner": "The initial history owner" - } - } - }, - "kind": "dev", - "methods": { - "calculateHistoryAddress(address,bytes32)": { - "details": "Beware that only the `newHistory` function with the `_salt` parameter is able to deterministically deploy a history.", - "params": { - "_historyOwner": "The initial history owner", - "_salt": "The salt used to deterministically generate the history address" - }, - "returns": { - "_0": "The deterministic history address" - } - }, - "newHistory(address)": { - "details": "On success, MUST emit a `HistoryCreated` event.", - "params": { - "_historyOwner": "The initial history owner" - }, - "returns": { - "_0": "The history" - } - }, - "newHistory(address,bytes32)": { - "details": "On success, MUST emit a `HistoryCreated` event.", - "params": { - "_historyOwner": "The initial history owner", - "_salt": "The salt used to deterministically generate the history address" - }, - "returns": { - "_0": "The history" - } - } - }, - "title": "History Factory", - "version": 1 - }, - "userdoc": { - "events": { - "HistoryCreated(address,address)": { - "notice": "A new history was deployed." - } - }, - "kind": "user", - "methods": { - "calculateHistoryAddress(address,bytes32)": { - "notice": "Calculate the address of a history to be deployed deterministically." - }, - "newHistory(address)": { - "notice": "Deploy a new history." - }, - "newHistory(address,bytes32)": { - "notice": "Deploy a new history deterministically." - } - }, - "notice": "Allows anyone to reliably deploy a new `History` contract.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/onchain/rollups/deployments/optimism_goerli/HistoryFactory.json b/onchain/rollups/deployments/optimism_goerli/HistoryFactory.json deleted file mode 100644 index 4fc7de36..00000000 --- a/onchain/rollups/deployments/optimism_goerli/HistoryFactory.json +++ /dev/null @@ -1,183 +0,0 @@ -{ - "address": "0x1f158b5320BBf677FdA89F9a438df99BbE560A26", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "historyOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract History", - "name": "history", - "type": "address" - } - ], - "name": "HistoryCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateHistoryAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newHistory", - "outputs": [ - { - "internalType": "contract History", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - } - ], - "name": "newHistory", - "outputs": [ - { - "internalType": "contract History", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0xdb7c30d7a6aa27489ff5568976c5523c9a75739dcc8cd9cf0f69cba318563288", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", - "contractAddress": null, - "transactionIndex": 1, - "gasUsed": "741626", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xfb480603866fda7ddd219e3ef636ee12f8ee0f591f84d41dffdc7dfbfc1af395", - "transactionHash": "0xdb7c30d7a6aa27489ff5568976c5523c9a75739dcc8cd9cf0f69cba318563288", - "logs": [], - "blockNumber": 15500544, - "cumulativeGasUsed": "788491", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 1, - "solcInputHash": "b1bc2a879218740e83dfbb7046a3cc8c", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"historyOwner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract History\",\"name\":\"history\",\"type\":\"address\"}],\"name\":\"HistoryCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_historyOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"calculateHistoryAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_historyOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"newHistory\",\"outputs\":[{\"internalType\":\"contract History\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_historyOwner\",\"type\":\"address\"}],\"name\":\"newHistory\",\"outputs\":[{\"internalType\":\"contract History\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"HistoryCreated(address,address)\":{\"details\":\"MUST be triggered on a successful call to `newHistory`.\",\"params\":{\"history\":\"The history\",\"historyOwner\":\"The initial history owner\"}}},\"kind\":\"dev\",\"methods\":{\"calculateHistoryAddress(address,bytes32)\":{\"details\":\"Beware that only the `newHistory` function with the `_salt` parameter is able to deterministically deploy a history.\",\"params\":{\"_historyOwner\":\"The initial history owner\",\"_salt\":\"The salt used to deterministically generate the history address\"},\"returns\":{\"_0\":\"The deterministic history address\"}},\"newHistory(address)\":{\"details\":\"On success, MUST emit a `HistoryCreated` event.\",\"params\":{\"_historyOwner\":\"The initial history owner\"},\"returns\":{\"_0\":\"The history\"}},\"newHistory(address,bytes32)\":{\"details\":\"On success, MUST emit a `HistoryCreated` event.\",\"params\":{\"_historyOwner\":\"The initial history owner\",\"_salt\":\"The salt used to deterministically generate the history address\"},\"returns\":{\"_0\":\"The history\"}}},\"title\":\"History Factory\",\"version\":1},\"userdoc\":{\"events\":{\"HistoryCreated(address,address)\":{\"notice\":\"A new history was deployed.\"}},\"kind\":\"user\",\"methods\":{\"calculateHistoryAddress(address,bytes32)\":{\"notice\":\"Calculate the address of a history to be deployed deterministically.\"},\"newHistory(address)\":{\"notice\":\"Deploy a new history.\"},\"newHistory(address,bytes32)\":{\"notice\":\"Deploy a new history deterministically.\"}},\"notice\":\"Allows anyone to reliably deploy a new `History` contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/history/HistoryFactory.sol\":\"HistoryFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\\n require(address(this).balance >= amount, \\\"Create2: insufficient balance\\\");\\n require(bytecode.length != 0, \\\"Create2: bytecode length is zero\\\");\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n require(addr != address(0), \\\"Create2: Failed on deploy\\\");\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6e00f269073ffc4350e56b7e8153c9092d5f70bfba423299990514183101ef89\",\"license\":\"MIT\"},\"contracts/history/History.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\nimport {IHistory} from \\\"./IHistory.sol\\\";\\n\\n/// @title Simple History\\n///\\n/// @notice This contract stores claims for each DApp individually.\\n/// This means that, for each DApp, the contract stores an array of\\n/// `Claim` entries, where each `Claim` is composed of:\\n///\\n/// * An epoch hash (`bytes32`)\\n/// * A closed interval of input indices (`uint128`, `uint128`)\\n///\\n/// The contract guarantees that the first interval starts at index 0,\\n/// and that the following intervals don't have gaps or overlaps.\\n///\\n/// Furthermore, claims can only be submitted by the contract owner\\n/// through `submitClaim`, but can be retrieved by anyone with `getClaim`.\\n///\\n/// @dev This contract inherits OpenZeppelin's `Ownable` contract.\\n/// For more information on `Ownable`, please consult OpenZeppelin's official documentation.\\ncontract History is IHistory, Ownable {\\n struct Claim {\\n bytes32 epochHash;\\n uint128 firstIndex;\\n uint128 lastIndex;\\n }\\n\\n /// @notice Mapping from DApp address to number of claims.\\n mapping(address => uint256) internal numClaims;\\n\\n /// @notice Mapping from DApp address and claim index to claim.\\n /// @dev See the `getClaim` and `submitClaim` functions.\\n mapping(address => mapping(uint256 => Claim)) internal claims;\\n\\n /// @notice A new claim regarding a specific DApp was submitted.\\n /// @param dapp The address of the DApp\\n /// @param claim The newly-submitted claim\\n /// @dev MUST be triggered on a successful call to `submitClaim`.\\n event NewClaimToHistory(address indexed dapp, Claim claim);\\n\\n /// @notice Raised when one tries to submit a claim whose first input index\\n /// is not less than or equal to its last input index.\\n error InvalidInputIndices();\\n\\n /// @notice Raised when one tries to submit a claim that skips some input.\\n /// For example, when the 1st claim starts at index 5 (instead of 0)\\n /// or when the 1st claim ends at index 20 but the 2nd claim starts at\\n /// index 22 (instead of 21).\\n error UnclaimedInputs();\\n\\n /// @notice Raised when one tries to retrieve a claim with an invalid index.\\n error InvalidClaimIndex();\\n\\n /// @notice Creates a `History` contract.\\n /// @param _owner The initial owner\\n constructor(address _owner) {\\n // constructor in Ownable already called `transferOwnership(msg.sender)`, so\\n // we only need to call `transferOwnership(_owner)` if _owner != msg.sender\\n if (_owner != msg.sender) {\\n transferOwnership(_owner);\\n }\\n }\\n\\n /// @notice Submit a claim regarding a DApp.\\n /// There are several requirements for this function to be called successfully.\\n ///\\n /// * `_claimData` MUST be well-encoded. In Solidity, it can be constructed\\n /// as `abi.encode(dapp, claim)`, where `dapp` is the DApp address (type `address`)\\n /// and `claim` is the claim structure (type `Claim`).\\n ///\\n /// * `firstIndex` MUST be less than or equal to `lastIndex`.\\n /// As a result, every claim MUST encompass AT LEAST one input.\\n ///\\n /// * If this is the DApp's first claim, then `firstIndex` MUST be `0`.\\n /// Otherwise, `firstIndex` MUST be the `lastClaim.lastIndex + 1`.\\n /// In other words, claims MUST NOT skip inputs.\\n ///\\n /// @inheritdoc IHistory\\n /// @dev Emits a `NewClaimToHistory` event. Should have access control.\\n /// Incorrect claim input indices could raise two errors:\\n /// `InvalidInputIndices` if first index is posterior than last index or\\n /// `UnclaimedInputs` if first index is not the subsequent of previous claimed index or\\n /// if the first index of the first claim is not zero.\\n function submitClaim(\\n bytes calldata _claimData\\n ) external override onlyOwner {\\n (address dapp, Claim memory claim) = abi.decode(\\n _claimData,\\n (address, Claim)\\n );\\n\\n if (claim.firstIndex > claim.lastIndex) {\\n revert InvalidInputIndices();\\n }\\n\\n uint256 numDAppClaims = numClaims[dapp];\\n\\n if (\\n claim.firstIndex !=\\n (\\n (numDAppClaims == 0)\\n ? 0\\n : (claims[dapp][numDAppClaims - 1].lastIndex + 1)\\n )\\n ) {\\n revert UnclaimedInputs();\\n }\\n\\n claims[dapp][numDAppClaims] = claim;\\n numClaims[dapp] = numDAppClaims + 1;\\n\\n emit NewClaimToHistory(dapp, claim);\\n }\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// There are several requirements for this function to be called successfully.\\n ///\\n /// * `_proofContext` MUST be well-encoded. In Solidity, it can be constructed\\n /// as `abi.encode(claimIndex)`, where `claimIndex` is the claim index (type `uint256`).\\n ///\\n /// * `claimIndex` MUST be inside the interval `[0, n)` where `n` is the number of claims\\n /// that have been submitted to `_dapp` already.\\n ///\\n /// @inheritdoc IHistory\\n /// @dev If `claimIndex` is not inside the interval `[0, n)`, then\\n /// an `InvalidClaimIndex` error is raised.\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n ) external view override returns (bytes32, uint256, uint256) {\\n uint256 claimIndex = abi.decode(_proofContext, (uint256));\\n\\n uint256 numDAppClaims = numClaims[_dapp];\\n\\n if (claimIndex >= numDAppClaims) {\\n revert InvalidClaimIndex();\\n }\\n\\n Claim memory claim = claims[_dapp][claimIndex];\\n\\n return (claim.epochHash, claim.firstIndex, claim.lastIndex);\\n }\\n\\n /// @inheritdoc IHistory\\n /// @dev Emits an `OwnershipTransferred` event. Should have access control.\\n function migrateToConsensus(\\n address _consensus\\n ) external override onlyOwner {\\n transferOwnership(_consensus);\\n }\\n}\\n\",\"keccak256\":\"0x9fa2563961c1769c3bba2b6b27ec90eca8423dd7b5b5f47e3ef90451a31d66c8\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/history/HistoryFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Create2} from \\\"@openzeppelin/contracts/utils/Create2.sol\\\";\\n\\nimport {IHistoryFactory} from \\\"./IHistoryFactory.sol\\\";\\nimport {History} from \\\"./History.sol\\\";\\n\\n/// @title History Factory\\n/// @notice Allows anyone to reliably deploy a new `History` contract.\\ncontract HistoryFactory is IHistoryFactory {\\n function newHistory(\\n address _historyOwner\\n ) external override returns (History) {\\n History history = new History(_historyOwner);\\n\\n emit HistoryCreated(_historyOwner, history);\\n\\n return history;\\n }\\n\\n function newHistory(\\n address _historyOwner,\\n bytes32 _salt\\n ) external override returns (History) {\\n History history = new History{salt: _salt}(_historyOwner);\\n\\n emit HistoryCreated(_historyOwner, history);\\n\\n return history;\\n }\\n\\n function calculateHistoryAddress(\\n address _historyOwner,\\n bytes32 _salt\\n ) external view override returns (address) {\\n return\\n Create2.computeAddress(\\n _salt,\\n keccak256(\\n abi.encodePacked(\\n type(History).creationCode,\\n abi.encode(_historyOwner)\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x9cce9bafb6c8f3aa056f9109ff664d27f7f10160a3a856ade469598c31cfe9af\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/history/IHistory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @title History interface\\ninterface IHistory {\\n // Permissioned functions\\n\\n /// @notice Submit a claim.\\n /// The encoding of `_claimData` might vary\\n /// depending on the history implementation.\\n /// @param _claimData Data for submitting a claim\\n /// @dev Should have access control.\\n function submitClaim(bytes calldata _claimData) external;\\n\\n /// @notice Transfer ownership to another consensus.\\n /// @param _consensus The new consensus\\n /// @dev Should have access control.\\n function migrateToConsensus(address _consensus) external;\\n\\n // Permissionless functions\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// The encoding of `_proofContext` might vary\\n /// depending on the history implementation.\\n /// @param _dapp The DApp address\\n /// @param _proofContext Data for retrieving the desired claim\\n /// @return epochHash_ The claimed epoch hash\\n /// @return firstInputIndex_ The index of the first input of the epoch in the input box\\n /// @return lastInputIndex_ The index of the last input of the epoch in the input box\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n )\\n external\\n view\\n returns (\\n bytes32 epochHash_,\\n uint256 firstInputIndex_,\\n uint256 lastInputIndex_\\n );\\n}\\n\",\"keccak256\":\"0x1378cbc831833abae8e2a565b88899d6416ea1208aa9724bd4df28e74848ffcf\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/history/IHistoryFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {History} from \\\"./History.sol\\\";\\n\\n/// @title History Factory interface\\ninterface IHistoryFactory {\\n // Events\\n\\n /// @notice A new history was deployed.\\n /// @param historyOwner The initial history owner\\n /// @param history The history\\n /// @dev MUST be triggered on a successful call to `newHistory`.\\n event HistoryCreated(address historyOwner, History history);\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new history.\\n /// @param _historyOwner The initial history owner\\n /// @return The history\\n /// @dev On success, MUST emit a `HistoryCreated` event.\\n function newHistory(address _historyOwner) external returns (History);\\n\\n /// @notice Deploy a new history deterministically.\\n /// @param _historyOwner The initial history owner\\n /// @param _salt The salt used to deterministically generate the history address\\n /// @return The history\\n /// @dev On success, MUST emit a `HistoryCreated` event.\\n function newHistory(\\n address _historyOwner,\\n bytes32 _salt\\n ) external returns (History);\\n\\n /// @notice Calculate the address of a history to be deployed deterministically.\\n /// @param _historyOwner The initial history owner\\n /// @param _salt The salt used to deterministically generate the history address\\n /// @return The deterministic history address\\n /// @dev Beware that only the `newHistory` function with the `_salt` parameter\\n /// is able to deterministically deploy a history.\\n function calculateHistoryAddress(\\n address _historyOwner,\\n bytes32 _salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0xde2581bb8fc418b9ea6375c525c270cc49193269b90b0e46312df2fe28bee6b3\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50610c6f806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80632ab8b1151461004657806350f9c5ba1461007557806388d49a6214610088575b600080fd5b610059610054366004610289565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b610059610083366004610289565b61012a565b6100596100963660046102b3565b6101a5565b60008082846040516100ac90610260565b6001600160a01b0390911681526020018190604051809103906000f59050801580156100dc573d6000803e3d6000fd5b50604080516001600160a01b038088168252831660208201529192507f5b0ee1fb14fdb4a34ba9f0dda6790b059be11d8b3a954905dbad3c025c05c9c6910160405180910390a19392505050565b600061019e826040518060200161014090610260565b601f1982820381018352601f9091011660408181526001600160a01b03881660208301520160408051601f198184030181529082905261018392916020016102fe565b6040516020818303038152906040528051906020012061022e565b9392505050565b600080826040516101b590610260565b6001600160a01b039091168152602001604051809103906000f0801580156101e1573d6000803e3d6000fd5b50604080516001600160a01b038087168252831660208201529192507f5b0ee1fb14fdb4a34ba9f0dda6790b059be11d8b3a954905dbad3c025c05c9c6910160405180910390a192915050565b600061019e8383306000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b61091e8061031c83390190565b80356001600160a01b038116811461028457600080fd5b919050565b6000806040838503121561029c57600080fd5b6102a58361026d565b946020939093013593505050565b6000602082840312156102c557600080fd5b61019e8261026d565b6000815160005b818110156102ef57602081850181015186830152016102d5565b50600093019283525090919050565b600061031361030d83866102ce565b846102ce565b94935050505056fe608060405234801561001057600080fd5b5060405161091e38038061091e83398101604081905261002f91610181565b61003833610057565b6001600160a01b038116331461005157610051816100a7565b506101b1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6100af610125565b6001600160a01b0381166101195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61012281610057565b50565b6000546001600160a01b0316331461017f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610110565b565b60006020828403121561019357600080fd5b81516001600160a01b03811681146101aa57600080fd5b9392505050565b61075e806101c06000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c8063715018a6146100675780638da5cb5b14610071578063d79a824014610091578063ddfdfbb0146100bf578063f2fde38b146100d2578063fc411683146100e5575b600080fd5b61006f6100f8565b005b6000546040516001600160a01b0390911681526020015b60405180910390f35b6100a461009f366004610531565b61010c565b60408051938452602084019290925290820152606001610088565b61006f6100cd366004610586565b6101bf565b61006f6100e03660046105c8565b61039a565b61006f6100f33660046105c8565b610418565b610100610429565b61010a6000610483565b565b600080808061011d858701876105ec565b6001600160a01b038816600090815260016020526040902054909150808210610159576040516387332c0160e01b815260040160405180910390fd5b506001600160a01b0396909616600090815260026020908152604080832098835297815290879020875160608101895281548082526001909201546001600160801b03808216948301859052600160801b90910416980188905297909695509350505050565b6101c7610429565b6000806101d683850185610621565b9150915080604001516001600160801b031681602001516001600160801b031611156102155760405163123974fd60e01b815260040160405180910390fd5b6001600160a01b038216600090815260016020526040902054801561028e576001600160a01b0383166000908152600260205260408120906102586001846106d5565b815260200190815260200160002060010160109054906101000a90046001600160801b0316600161028991906106ee565b610291565b60005b6001600160801b031682602001516001600160801b0316146102c65760405163118b891b60e01b815260040160405180910390fd5b6001600160a01b03831660009081526002602090815260408083208484528252918290208451815590840151918401516001600160801b03908116600160801b0292169190911760019182015561031e908290610715565b6001600160a01b03841660008181526001602090815260409182902093909355805185518152858401516001600160801b03908116948201949094528582015190931690830152907fb71880d7a0c514d48c0296b2721b0a4f9641a45117960f2ca86b5b7873c4ab2f9060600160405180910390a25050505050565b6103a2610429565b6001600160a01b03811661040c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61041581610483565b50565b610420610429565b6104158161039a565b6000546001600160a01b0316331461010a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610403565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461041557600080fd5b60008083601f8401126104fa57600080fd5b50813567ffffffffffffffff81111561051257600080fd5b60208301915083602082850101111561052a57600080fd5b9250929050565b60008060006040848603121561054657600080fd5b8335610551816104d3565b9250602084013567ffffffffffffffff81111561056d57600080fd5b610579868287016104e8565b9497909650939450505050565b6000806020838503121561059957600080fd5b823567ffffffffffffffff8111156105b057600080fd5b6105bc858286016104e8565b90969095509350505050565b6000602082840312156105da57600080fd5b81356105e5816104d3565b9392505050565b6000602082840312156105fe57600080fd5b5035919050565b80356001600160801b038116811461061c57600080fd5b919050565b600080828403608081121561063557600080fd5b8335610640816104d3565b92506060601f198201121561065457600080fd5b506040516060810181811067ffffffffffffffff8211171561068657634e487b7160e01b600052604160045260246000fd5b80604052506020840135815261069e60408501610605565b60208201526106af60608501610605565b6040820152809150509250929050565b634e487b7160e01b600052601160045260246000fd5b818103818111156106e8576106e86106bf565b92915050565b6001600160801b0381811683821601908082111561070e5761070e6106bf565b5092915050565b808201808211156106e8576106e86106bf56fea2646970667358221220af04065c5d35d3460abc2711367000a2134970c84818233d66386f35794dfb5b64736f6c63430008130033a2646970667358221220022e94d4ec2e139486be793ccd0a8adc660dbcb526c820d52e52c49b3ca0a2c064736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80632ab8b1151461004657806350f9c5ba1461007557806388d49a6214610088575b600080fd5b610059610054366004610289565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b610059610083366004610289565b61012a565b6100596100963660046102b3565b6101a5565b60008082846040516100ac90610260565b6001600160a01b0390911681526020018190604051809103906000f59050801580156100dc573d6000803e3d6000fd5b50604080516001600160a01b038088168252831660208201529192507f5b0ee1fb14fdb4a34ba9f0dda6790b059be11d8b3a954905dbad3c025c05c9c6910160405180910390a19392505050565b600061019e826040518060200161014090610260565b601f1982820381018352601f9091011660408181526001600160a01b03881660208301520160408051601f198184030181529082905261018392916020016102fe565b6040516020818303038152906040528051906020012061022e565b9392505050565b600080826040516101b590610260565b6001600160a01b039091168152602001604051809103906000f0801580156101e1573d6000803e3d6000fd5b50604080516001600160a01b038087168252831660208201529192507f5b0ee1fb14fdb4a34ba9f0dda6790b059be11d8b3a954905dbad3c025c05c9c6910160405180910390a192915050565b600061019e8383306000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b61091e8061031c83390190565b80356001600160a01b038116811461028457600080fd5b919050565b6000806040838503121561029c57600080fd5b6102a58361026d565b946020939093013593505050565b6000602082840312156102c557600080fd5b61019e8261026d565b6000815160005b818110156102ef57602081850181015186830152016102d5565b50600093019283525090919050565b600061031361030d83866102ce565b846102ce565b94935050505056fe608060405234801561001057600080fd5b5060405161091e38038061091e83398101604081905261002f91610181565b61003833610057565b6001600160a01b038116331461005157610051816100a7565b506101b1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6100af610125565b6001600160a01b0381166101195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61012281610057565b50565b6000546001600160a01b0316331461017f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610110565b565b60006020828403121561019357600080fd5b81516001600160a01b03811681146101aa57600080fd5b9392505050565b61075e806101c06000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c8063715018a6146100675780638da5cb5b14610071578063d79a824014610091578063ddfdfbb0146100bf578063f2fde38b146100d2578063fc411683146100e5575b600080fd5b61006f6100f8565b005b6000546040516001600160a01b0390911681526020015b60405180910390f35b6100a461009f366004610531565b61010c565b60408051938452602084019290925290820152606001610088565b61006f6100cd366004610586565b6101bf565b61006f6100e03660046105c8565b61039a565b61006f6100f33660046105c8565b610418565b610100610429565b61010a6000610483565b565b600080808061011d858701876105ec565b6001600160a01b038816600090815260016020526040902054909150808210610159576040516387332c0160e01b815260040160405180910390fd5b506001600160a01b0396909616600090815260026020908152604080832098835297815290879020875160608101895281548082526001909201546001600160801b03808216948301859052600160801b90910416980188905297909695509350505050565b6101c7610429565b6000806101d683850185610621565b9150915080604001516001600160801b031681602001516001600160801b031611156102155760405163123974fd60e01b815260040160405180910390fd5b6001600160a01b038216600090815260016020526040902054801561028e576001600160a01b0383166000908152600260205260408120906102586001846106d5565b815260200190815260200160002060010160109054906101000a90046001600160801b0316600161028991906106ee565b610291565b60005b6001600160801b031682602001516001600160801b0316146102c65760405163118b891b60e01b815260040160405180910390fd5b6001600160a01b03831660009081526002602090815260408083208484528252918290208451815590840151918401516001600160801b03908116600160801b0292169190911760019182015561031e908290610715565b6001600160a01b03841660008181526001602090815260409182902093909355805185518152858401516001600160801b03908116948201949094528582015190931690830152907fb71880d7a0c514d48c0296b2721b0a4f9641a45117960f2ca86b5b7873c4ab2f9060600160405180910390a25050505050565b6103a2610429565b6001600160a01b03811661040c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61041581610483565b50565b610420610429565b6104158161039a565b6000546001600160a01b0316331461010a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610403565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461041557600080fd5b60008083601f8401126104fa57600080fd5b50813567ffffffffffffffff81111561051257600080fd5b60208301915083602082850101111561052a57600080fd5b9250929050565b60008060006040848603121561054657600080fd5b8335610551816104d3565b9250602084013567ffffffffffffffff81111561056d57600080fd5b610579868287016104e8565b9497909650939450505050565b6000806020838503121561059957600080fd5b823567ffffffffffffffff8111156105b057600080fd5b6105bc858286016104e8565b90969095509350505050565b6000602082840312156105da57600080fd5b81356105e5816104d3565b9392505050565b6000602082840312156105fe57600080fd5b5035919050565b80356001600160801b038116811461061c57600080fd5b919050565b600080828403608081121561063557600080fd5b8335610640816104d3565b92506060601f198201121561065457600080fd5b506040516060810181811067ffffffffffffffff8211171561068657634e487b7160e01b600052604160045260246000fd5b80604052506020840135815261069e60408501610605565b60208201526106af60608501610605565b6040820152809150509250929050565b634e487b7160e01b600052601160045260246000fd5b818103818111156106e8576106e86106bf565b92915050565b6001600160801b0381811683821601908082111561070e5761070e6106bf565b5092915050565b808201808211156106e8576106e86106bf56fea2646970667358221220af04065c5d35d3460abc2711367000a2134970c84818233d66386f35794dfb5b64736f6c63430008130033a2646970667358221220022e94d4ec2e139486be793ccd0a8adc660dbcb526c820d52e52c49b3ca0a2c064736f6c63430008130033", - "devdoc": { - "events": { - "HistoryCreated(address,address)": { - "details": "MUST be triggered on a successful call to `newHistory`.", - "params": { - "history": "The history", - "historyOwner": "The initial history owner" - } - } - }, - "kind": "dev", - "methods": { - "calculateHistoryAddress(address,bytes32)": { - "details": "Beware that only the `newHistory` function with the `_salt` parameter is able to deterministically deploy a history.", - "params": { - "_historyOwner": "The initial history owner", - "_salt": "The salt used to deterministically generate the history address" - }, - "returns": { - "_0": "The deterministic history address" - } - }, - "newHistory(address)": { - "details": "On success, MUST emit a `HistoryCreated` event.", - "params": { - "_historyOwner": "The initial history owner" - }, - "returns": { - "_0": "The history" - } - }, - "newHistory(address,bytes32)": { - "details": "On success, MUST emit a `HistoryCreated` event.", - "params": { - "_historyOwner": "The initial history owner", - "_salt": "The salt used to deterministically generate the history address" - }, - "returns": { - "_0": "The history" - } - } - }, - "title": "History Factory", - "version": 1 - }, - "userdoc": { - "events": { - "HistoryCreated(address,address)": { - "notice": "A new history was deployed." - } - }, - "kind": "user", - "methods": { - "calculateHistoryAddress(address,bytes32)": { - "notice": "Calculate the address of a history to be deployed deterministically." - }, - "newHistory(address)": { - "notice": "Deploy a new history." - }, - "newHistory(address,bytes32)": { - "notice": "Deploy a new history deterministically." - } - }, - "notice": "Allows anyone to reliably deploy a new `History` contract.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/onchain/rollups/deployments/sepolia/HistoryFactory.json b/onchain/rollups/deployments/sepolia/HistoryFactory.json deleted file mode 100644 index 8064313c..00000000 --- a/onchain/rollups/deployments/sepolia/HistoryFactory.json +++ /dev/null @@ -1,183 +0,0 @@ -{ - "address": "0x1f158b5320BBf677FdA89F9a438df99BbE560A26", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "historyOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract History", - "name": "history", - "type": "address" - } - ], - "name": "HistoryCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateHistoryAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newHistory", - "outputs": [ - { - "internalType": "contract History", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - } - ], - "name": "newHistory", - "outputs": [ - { - "internalType": "contract History", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0xa8f4bf21881d35ce2973f4b4ae97722d240e38364beceba11de4c6587f97034b", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", - "contractAddress": null, - "transactionIndex": 55, - "gasUsed": "741828", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x3e8a7f3115996e5b9c773cff7b4f599fd6e6805b414dc88571da29ac9f155a62", - "transactionHash": "0xa8f4bf21881d35ce2973f4b4ae97722d240e38364beceba11de4c6587f97034b", - "logs": [], - "blockNumber": 4423534, - "cumulativeGasUsed": "13067086", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 1, - "solcInputHash": "b1bc2a879218740e83dfbb7046a3cc8c", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"historyOwner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract History\",\"name\":\"history\",\"type\":\"address\"}],\"name\":\"HistoryCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_historyOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"calculateHistoryAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_historyOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"newHistory\",\"outputs\":[{\"internalType\":\"contract History\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_historyOwner\",\"type\":\"address\"}],\"name\":\"newHistory\",\"outputs\":[{\"internalType\":\"contract History\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"HistoryCreated(address,address)\":{\"details\":\"MUST be triggered on a successful call to `newHistory`.\",\"params\":{\"history\":\"The history\",\"historyOwner\":\"The initial history owner\"}}},\"kind\":\"dev\",\"methods\":{\"calculateHistoryAddress(address,bytes32)\":{\"details\":\"Beware that only the `newHistory` function with the `_salt` parameter is able to deterministically deploy a history.\",\"params\":{\"_historyOwner\":\"The initial history owner\",\"_salt\":\"The salt used to deterministically generate the history address\"},\"returns\":{\"_0\":\"The deterministic history address\"}},\"newHistory(address)\":{\"details\":\"On success, MUST emit a `HistoryCreated` event.\",\"params\":{\"_historyOwner\":\"The initial history owner\"},\"returns\":{\"_0\":\"The history\"}},\"newHistory(address,bytes32)\":{\"details\":\"On success, MUST emit a `HistoryCreated` event.\",\"params\":{\"_historyOwner\":\"The initial history owner\",\"_salt\":\"The salt used to deterministically generate the history address\"},\"returns\":{\"_0\":\"The history\"}}},\"title\":\"History Factory\",\"version\":1},\"userdoc\":{\"events\":{\"HistoryCreated(address,address)\":{\"notice\":\"A new history was deployed.\"}},\"kind\":\"user\",\"methods\":{\"calculateHistoryAddress(address,bytes32)\":{\"notice\":\"Calculate the address of a history to be deployed deterministically.\"},\"newHistory(address)\":{\"notice\":\"Deploy a new history.\"},\"newHistory(address,bytes32)\":{\"notice\":\"Deploy a new history deterministically.\"}},\"notice\":\"Allows anyone to reliably deploy a new `History` contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/history/HistoryFactory.sol\":\"HistoryFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\\n require(address(this).balance >= amount, \\\"Create2: insufficient balance\\\");\\n require(bytecode.length != 0, \\\"Create2: bytecode length is zero\\\");\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n require(addr != address(0), \\\"Create2: Failed on deploy\\\");\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6e00f269073ffc4350e56b7e8153c9092d5f70bfba423299990514183101ef89\",\"license\":\"MIT\"},\"contracts/history/History.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\nimport {IHistory} from \\\"./IHistory.sol\\\";\\n\\n/// @title Simple History\\n///\\n/// @notice This contract stores claims for each DApp individually.\\n/// This means that, for each DApp, the contract stores an array of\\n/// `Claim` entries, where each `Claim` is composed of:\\n///\\n/// * An epoch hash (`bytes32`)\\n/// * A closed interval of input indices (`uint128`, `uint128`)\\n///\\n/// The contract guarantees that the first interval starts at index 0,\\n/// and that the following intervals don't have gaps or overlaps.\\n///\\n/// Furthermore, claims can only be submitted by the contract owner\\n/// through `submitClaim`, but can be retrieved by anyone with `getClaim`.\\n///\\n/// @dev This contract inherits OpenZeppelin's `Ownable` contract.\\n/// For more information on `Ownable`, please consult OpenZeppelin's official documentation.\\ncontract History is IHistory, Ownable {\\n struct Claim {\\n bytes32 epochHash;\\n uint128 firstIndex;\\n uint128 lastIndex;\\n }\\n\\n /// @notice Mapping from DApp address to number of claims.\\n mapping(address => uint256) internal numClaims;\\n\\n /// @notice Mapping from DApp address and claim index to claim.\\n /// @dev See the `getClaim` and `submitClaim` functions.\\n mapping(address => mapping(uint256 => Claim)) internal claims;\\n\\n /// @notice A new claim regarding a specific DApp was submitted.\\n /// @param dapp The address of the DApp\\n /// @param claim The newly-submitted claim\\n /// @dev MUST be triggered on a successful call to `submitClaim`.\\n event NewClaimToHistory(address indexed dapp, Claim claim);\\n\\n /// @notice Raised when one tries to submit a claim whose first input index\\n /// is not less than or equal to its last input index.\\n error InvalidInputIndices();\\n\\n /// @notice Raised when one tries to submit a claim that skips some input.\\n /// For example, when the 1st claim starts at index 5 (instead of 0)\\n /// or when the 1st claim ends at index 20 but the 2nd claim starts at\\n /// index 22 (instead of 21).\\n error UnclaimedInputs();\\n\\n /// @notice Raised when one tries to retrieve a claim with an invalid index.\\n error InvalidClaimIndex();\\n\\n /// @notice Creates a `History` contract.\\n /// @param _owner The initial owner\\n constructor(address _owner) {\\n // constructor in Ownable already called `transferOwnership(msg.sender)`, so\\n // we only need to call `transferOwnership(_owner)` if _owner != msg.sender\\n if (_owner != msg.sender) {\\n transferOwnership(_owner);\\n }\\n }\\n\\n /// @notice Submit a claim regarding a DApp.\\n /// There are several requirements for this function to be called successfully.\\n ///\\n /// * `_claimData` MUST be well-encoded. In Solidity, it can be constructed\\n /// as `abi.encode(dapp, claim)`, where `dapp` is the DApp address (type `address`)\\n /// and `claim` is the claim structure (type `Claim`).\\n ///\\n /// * `firstIndex` MUST be less than or equal to `lastIndex`.\\n /// As a result, every claim MUST encompass AT LEAST one input.\\n ///\\n /// * If this is the DApp's first claim, then `firstIndex` MUST be `0`.\\n /// Otherwise, `firstIndex` MUST be the `lastClaim.lastIndex + 1`.\\n /// In other words, claims MUST NOT skip inputs.\\n ///\\n /// @inheritdoc IHistory\\n /// @dev Emits a `NewClaimToHistory` event. Should have access control.\\n /// Incorrect claim input indices could raise two errors:\\n /// `InvalidInputIndices` if first index is posterior than last index or\\n /// `UnclaimedInputs` if first index is not the subsequent of previous claimed index or\\n /// if the first index of the first claim is not zero.\\n function submitClaim(\\n bytes calldata _claimData\\n ) external override onlyOwner {\\n (address dapp, Claim memory claim) = abi.decode(\\n _claimData,\\n (address, Claim)\\n );\\n\\n if (claim.firstIndex > claim.lastIndex) {\\n revert InvalidInputIndices();\\n }\\n\\n uint256 numDAppClaims = numClaims[dapp];\\n\\n if (\\n claim.firstIndex !=\\n (\\n (numDAppClaims == 0)\\n ? 0\\n : (claims[dapp][numDAppClaims - 1].lastIndex + 1)\\n )\\n ) {\\n revert UnclaimedInputs();\\n }\\n\\n claims[dapp][numDAppClaims] = claim;\\n numClaims[dapp] = numDAppClaims + 1;\\n\\n emit NewClaimToHistory(dapp, claim);\\n }\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// There are several requirements for this function to be called successfully.\\n ///\\n /// * `_proofContext` MUST be well-encoded. In Solidity, it can be constructed\\n /// as `abi.encode(claimIndex)`, where `claimIndex` is the claim index (type `uint256`).\\n ///\\n /// * `claimIndex` MUST be inside the interval `[0, n)` where `n` is the number of claims\\n /// that have been submitted to `_dapp` already.\\n ///\\n /// @inheritdoc IHistory\\n /// @dev If `claimIndex` is not inside the interval `[0, n)`, then\\n /// an `InvalidClaimIndex` error is raised.\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n ) external view override returns (bytes32, uint256, uint256) {\\n uint256 claimIndex = abi.decode(_proofContext, (uint256));\\n\\n uint256 numDAppClaims = numClaims[_dapp];\\n\\n if (claimIndex >= numDAppClaims) {\\n revert InvalidClaimIndex();\\n }\\n\\n Claim memory claim = claims[_dapp][claimIndex];\\n\\n return (claim.epochHash, claim.firstIndex, claim.lastIndex);\\n }\\n\\n /// @inheritdoc IHistory\\n /// @dev Emits an `OwnershipTransferred` event. Should have access control.\\n function migrateToConsensus(\\n address _consensus\\n ) external override onlyOwner {\\n transferOwnership(_consensus);\\n }\\n}\\n\",\"keccak256\":\"0x9fa2563961c1769c3bba2b6b27ec90eca8423dd7b5b5f47e3ef90451a31d66c8\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/history/HistoryFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Create2} from \\\"@openzeppelin/contracts/utils/Create2.sol\\\";\\n\\nimport {IHistoryFactory} from \\\"./IHistoryFactory.sol\\\";\\nimport {History} from \\\"./History.sol\\\";\\n\\n/// @title History Factory\\n/// @notice Allows anyone to reliably deploy a new `History` contract.\\ncontract HistoryFactory is IHistoryFactory {\\n function newHistory(\\n address _historyOwner\\n ) external override returns (History) {\\n History history = new History(_historyOwner);\\n\\n emit HistoryCreated(_historyOwner, history);\\n\\n return history;\\n }\\n\\n function newHistory(\\n address _historyOwner,\\n bytes32 _salt\\n ) external override returns (History) {\\n History history = new History{salt: _salt}(_historyOwner);\\n\\n emit HistoryCreated(_historyOwner, history);\\n\\n return history;\\n }\\n\\n function calculateHistoryAddress(\\n address _historyOwner,\\n bytes32 _salt\\n ) external view override returns (address) {\\n return\\n Create2.computeAddress(\\n _salt,\\n keccak256(\\n abi.encodePacked(\\n type(History).creationCode,\\n abi.encode(_historyOwner)\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x9cce9bafb6c8f3aa056f9109ff664d27f7f10160a3a856ade469598c31cfe9af\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/history/IHistory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @title History interface\\ninterface IHistory {\\n // Permissioned functions\\n\\n /// @notice Submit a claim.\\n /// The encoding of `_claimData` might vary\\n /// depending on the history implementation.\\n /// @param _claimData Data for submitting a claim\\n /// @dev Should have access control.\\n function submitClaim(bytes calldata _claimData) external;\\n\\n /// @notice Transfer ownership to another consensus.\\n /// @param _consensus The new consensus\\n /// @dev Should have access control.\\n function migrateToConsensus(address _consensus) external;\\n\\n // Permissionless functions\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// The encoding of `_proofContext` might vary\\n /// depending on the history implementation.\\n /// @param _dapp The DApp address\\n /// @param _proofContext Data for retrieving the desired claim\\n /// @return epochHash_ The claimed epoch hash\\n /// @return firstInputIndex_ The index of the first input of the epoch in the input box\\n /// @return lastInputIndex_ The index of the last input of the epoch in the input box\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n )\\n external\\n view\\n returns (\\n bytes32 epochHash_,\\n uint256 firstInputIndex_,\\n uint256 lastInputIndex_\\n );\\n}\\n\",\"keccak256\":\"0x1378cbc831833abae8e2a565b88899d6416ea1208aa9724bd4df28e74848ffcf\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/history/IHistoryFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {History} from \\\"./History.sol\\\";\\n\\n/// @title History Factory interface\\ninterface IHistoryFactory {\\n // Events\\n\\n /// @notice A new history was deployed.\\n /// @param historyOwner The initial history owner\\n /// @param history The history\\n /// @dev MUST be triggered on a successful call to `newHistory`.\\n event HistoryCreated(address historyOwner, History history);\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new history.\\n /// @param _historyOwner The initial history owner\\n /// @return The history\\n /// @dev On success, MUST emit a `HistoryCreated` event.\\n function newHistory(address _historyOwner) external returns (History);\\n\\n /// @notice Deploy a new history deterministically.\\n /// @param _historyOwner The initial history owner\\n /// @param _salt The salt used to deterministically generate the history address\\n /// @return The history\\n /// @dev On success, MUST emit a `HistoryCreated` event.\\n function newHistory(\\n address _historyOwner,\\n bytes32 _salt\\n ) external returns (History);\\n\\n /// @notice Calculate the address of a history to be deployed deterministically.\\n /// @param _historyOwner The initial history owner\\n /// @param _salt The salt used to deterministically generate the history address\\n /// @return The deterministic history address\\n /// @dev Beware that only the `newHistory` function with the `_salt` parameter\\n /// is able to deterministically deploy a history.\\n function calculateHistoryAddress(\\n address _historyOwner,\\n bytes32 _salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0xde2581bb8fc418b9ea6375c525c270cc49193269b90b0e46312df2fe28bee6b3\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50610c6f806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80632ab8b1151461004657806350f9c5ba1461007557806388d49a6214610088575b600080fd5b610059610054366004610289565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b610059610083366004610289565b61012a565b6100596100963660046102b3565b6101a5565b60008082846040516100ac90610260565b6001600160a01b0390911681526020018190604051809103906000f59050801580156100dc573d6000803e3d6000fd5b50604080516001600160a01b038088168252831660208201529192507f5b0ee1fb14fdb4a34ba9f0dda6790b059be11d8b3a954905dbad3c025c05c9c6910160405180910390a19392505050565b600061019e826040518060200161014090610260565b601f1982820381018352601f9091011660408181526001600160a01b03881660208301520160408051601f198184030181529082905261018392916020016102fe565b6040516020818303038152906040528051906020012061022e565b9392505050565b600080826040516101b590610260565b6001600160a01b039091168152602001604051809103906000f0801580156101e1573d6000803e3d6000fd5b50604080516001600160a01b038087168252831660208201529192507f5b0ee1fb14fdb4a34ba9f0dda6790b059be11d8b3a954905dbad3c025c05c9c6910160405180910390a192915050565b600061019e8383306000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b61091e8061031c83390190565b80356001600160a01b038116811461028457600080fd5b919050565b6000806040838503121561029c57600080fd5b6102a58361026d565b946020939093013593505050565b6000602082840312156102c557600080fd5b61019e8261026d565b6000815160005b818110156102ef57602081850181015186830152016102d5565b50600093019283525090919050565b600061031361030d83866102ce565b846102ce565b94935050505056fe608060405234801561001057600080fd5b5060405161091e38038061091e83398101604081905261002f91610181565b61003833610057565b6001600160a01b038116331461005157610051816100a7565b506101b1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6100af610125565b6001600160a01b0381166101195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61012281610057565b50565b6000546001600160a01b0316331461017f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610110565b565b60006020828403121561019357600080fd5b81516001600160a01b03811681146101aa57600080fd5b9392505050565b61075e806101c06000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c8063715018a6146100675780638da5cb5b14610071578063d79a824014610091578063ddfdfbb0146100bf578063f2fde38b146100d2578063fc411683146100e5575b600080fd5b61006f6100f8565b005b6000546040516001600160a01b0390911681526020015b60405180910390f35b6100a461009f366004610531565b61010c565b60408051938452602084019290925290820152606001610088565b61006f6100cd366004610586565b6101bf565b61006f6100e03660046105c8565b61039a565b61006f6100f33660046105c8565b610418565b610100610429565b61010a6000610483565b565b600080808061011d858701876105ec565b6001600160a01b038816600090815260016020526040902054909150808210610159576040516387332c0160e01b815260040160405180910390fd5b506001600160a01b0396909616600090815260026020908152604080832098835297815290879020875160608101895281548082526001909201546001600160801b03808216948301859052600160801b90910416980188905297909695509350505050565b6101c7610429565b6000806101d683850185610621565b9150915080604001516001600160801b031681602001516001600160801b031611156102155760405163123974fd60e01b815260040160405180910390fd5b6001600160a01b038216600090815260016020526040902054801561028e576001600160a01b0383166000908152600260205260408120906102586001846106d5565b815260200190815260200160002060010160109054906101000a90046001600160801b0316600161028991906106ee565b610291565b60005b6001600160801b031682602001516001600160801b0316146102c65760405163118b891b60e01b815260040160405180910390fd5b6001600160a01b03831660009081526002602090815260408083208484528252918290208451815590840151918401516001600160801b03908116600160801b0292169190911760019182015561031e908290610715565b6001600160a01b03841660008181526001602090815260409182902093909355805185518152858401516001600160801b03908116948201949094528582015190931690830152907fb71880d7a0c514d48c0296b2721b0a4f9641a45117960f2ca86b5b7873c4ab2f9060600160405180910390a25050505050565b6103a2610429565b6001600160a01b03811661040c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61041581610483565b50565b610420610429565b6104158161039a565b6000546001600160a01b0316331461010a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610403565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461041557600080fd5b60008083601f8401126104fa57600080fd5b50813567ffffffffffffffff81111561051257600080fd5b60208301915083602082850101111561052a57600080fd5b9250929050565b60008060006040848603121561054657600080fd5b8335610551816104d3565b9250602084013567ffffffffffffffff81111561056d57600080fd5b610579868287016104e8565b9497909650939450505050565b6000806020838503121561059957600080fd5b823567ffffffffffffffff8111156105b057600080fd5b6105bc858286016104e8565b90969095509350505050565b6000602082840312156105da57600080fd5b81356105e5816104d3565b9392505050565b6000602082840312156105fe57600080fd5b5035919050565b80356001600160801b038116811461061c57600080fd5b919050565b600080828403608081121561063557600080fd5b8335610640816104d3565b92506060601f198201121561065457600080fd5b506040516060810181811067ffffffffffffffff8211171561068657634e487b7160e01b600052604160045260246000fd5b80604052506020840135815261069e60408501610605565b60208201526106af60608501610605565b6040820152809150509250929050565b634e487b7160e01b600052601160045260246000fd5b818103818111156106e8576106e86106bf565b92915050565b6001600160801b0381811683821601908082111561070e5761070e6106bf565b5092915050565b808201808211156106e8576106e86106bf56fea2646970667358221220af04065c5d35d3460abc2711367000a2134970c84818233d66386f35794dfb5b64736f6c63430008130033a2646970667358221220022e94d4ec2e139486be793ccd0a8adc660dbcb526c820d52e52c49b3ca0a2c064736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80632ab8b1151461004657806350f9c5ba1461007557806388d49a6214610088575b600080fd5b610059610054366004610289565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b610059610083366004610289565b61012a565b6100596100963660046102b3565b6101a5565b60008082846040516100ac90610260565b6001600160a01b0390911681526020018190604051809103906000f59050801580156100dc573d6000803e3d6000fd5b50604080516001600160a01b038088168252831660208201529192507f5b0ee1fb14fdb4a34ba9f0dda6790b059be11d8b3a954905dbad3c025c05c9c6910160405180910390a19392505050565b600061019e826040518060200161014090610260565b601f1982820381018352601f9091011660408181526001600160a01b03881660208301520160408051601f198184030181529082905261018392916020016102fe565b6040516020818303038152906040528051906020012061022e565b9392505050565b600080826040516101b590610260565b6001600160a01b039091168152602001604051809103906000f0801580156101e1573d6000803e3d6000fd5b50604080516001600160a01b038087168252831660208201529192507f5b0ee1fb14fdb4a34ba9f0dda6790b059be11d8b3a954905dbad3c025c05c9c6910160405180910390a192915050565b600061019e8383306000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b61091e8061031c83390190565b80356001600160a01b038116811461028457600080fd5b919050565b6000806040838503121561029c57600080fd5b6102a58361026d565b946020939093013593505050565b6000602082840312156102c557600080fd5b61019e8261026d565b6000815160005b818110156102ef57602081850181015186830152016102d5565b50600093019283525090919050565b600061031361030d83866102ce565b846102ce565b94935050505056fe608060405234801561001057600080fd5b5060405161091e38038061091e83398101604081905261002f91610181565b61003833610057565b6001600160a01b038116331461005157610051816100a7565b506101b1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6100af610125565b6001600160a01b0381166101195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61012281610057565b50565b6000546001600160a01b0316331461017f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610110565b565b60006020828403121561019357600080fd5b81516001600160a01b03811681146101aa57600080fd5b9392505050565b61075e806101c06000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c8063715018a6146100675780638da5cb5b14610071578063d79a824014610091578063ddfdfbb0146100bf578063f2fde38b146100d2578063fc411683146100e5575b600080fd5b61006f6100f8565b005b6000546040516001600160a01b0390911681526020015b60405180910390f35b6100a461009f366004610531565b61010c565b60408051938452602084019290925290820152606001610088565b61006f6100cd366004610586565b6101bf565b61006f6100e03660046105c8565b61039a565b61006f6100f33660046105c8565b610418565b610100610429565b61010a6000610483565b565b600080808061011d858701876105ec565b6001600160a01b038816600090815260016020526040902054909150808210610159576040516387332c0160e01b815260040160405180910390fd5b506001600160a01b0396909616600090815260026020908152604080832098835297815290879020875160608101895281548082526001909201546001600160801b03808216948301859052600160801b90910416980188905297909695509350505050565b6101c7610429565b6000806101d683850185610621565b9150915080604001516001600160801b031681602001516001600160801b031611156102155760405163123974fd60e01b815260040160405180910390fd5b6001600160a01b038216600090815260016020526040902054801561028e576001600160a01b0383166000908152600260205260408120906102586001846106d5565b815260200190815260200160002060010160109054906101000a90046001600160801b0316600161028991906106ee565b610291565b60005b6001600160801b031682602001516001600160801b0316146102c65760405163118b891b60e01b815260040160405180910390fd5b6001600160a01b03831660009081526002602090815260408083208484528252918290208451815590840151918401516001600160801b03908116600160801b0292169190911760019182015561031e908290610715565b6001600160a01b03841660008181526001602090815260409182902093909355805185518152858401516001600160801b03908116948201949094528582015190931690830152907fb71880d7a0c514d48c0296b2721b0a4f9641a45117960f2ca86b5b7873c4ab2f9060600160405180910390a25050505050565b6103a2610429565b6001600160a01b03811661040c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61041581610483565b50565b610420610429565b6104158161039a565b6000546001600160a01b0316331461010a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610403565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461041557600080fd5b60008083601f8401126104fa57600080fd5b50813567ffffffffffffffff81111561051257600080fd5b60208301915083602082850101111561052a57600080fd5b9250929050565b60008060006040848603121561054657600080fd5b8335610551816104d3565b9250602084013567ffffffffffffffff81111561056d57600080fd5b610579868287016104e8565b9497909650939450505050565b6000806020838503121561059957600080fd5b823567ffffffffffffffff8111156105b057600080fd5b6105bc858286016104e8565b90969095509350505050565b6000602082840312156105da57600080fd5b81356105e5816104d3565b9392505050565b6000602082840312156105fe57600080fd5b5035919050565b80356001600160801b038116811461061c57600080fd5b919050565b600080828403608081121561063557600080fd5b8335610640816104d3565b92506060601f198201121561065457600080fd5b506040516060810181811067ffffffffffffffff8211171561068657634e487b7160e01b600052604160045260246000fd5b80604052506020840135815261069e60408501610605565b60208201526106af60608501610605565b6040820152809150509250929050565b634e487b7160e01b600052601160045260246000fd5b818103818111156106e8576106e86106bf565b92915050565b6001600160801b0381811683821601908082111561070e5761070e6106bf565b5092915050565b808201808211156106e8576106e86106bf56fea2646970667358221220af04065c5d35d3460abc2711367000a2134970c84818233d66386f35794dfb5b64736f6c63430008130033a2646970667358221220022e94d4ec2e139486be793ccd0a8adc660dbcb526c820d52e52c49b3ca0a2c064736f6c63430008130033", - "devdoc": { - "events": { - "HistoryCreated(address,address)": { - "details": "MUST be triggered on a successful call to `newHistory`.", - "params": { - "history": "The history", - "historyOwner": "The initial history owner" - } - } - }, - "kind": "dev", - "methods": { - "calculateHistoryAddress(address,bytes32)": { - "details": "Beware that only the `newHistory` function with the `_salt` parameter is able to deterministically deploy a history.", - "params": { - "_historyOwner": "The initial history owner", - "_salt": "The salt used to deterministically generate the history address" - }, - "returns": { - "_0": "The deterministic history address" - } - }, - "newHistory(address)": { - "details": "On success, MUST emit a `HistoryCreated` event.", - "params": { - "_historyOwner": "The initial history owner" - }, - "returns": { - "_0": "The history" - } - }, - "newHistory(address,bytes32)": { - "details": "On success, MUST emit a `HistoryCreated` event.", - "params": { - "_historyOwner": "The initial history owner", - "_salt": "The salt used to deterministically generate the history address" - }, - "returns": { - "_0": "The history" - } - } - }, - "title": "History Factory", - "version": 1 - }, - "userdoc": { - "events": { - "HistoryCreated(address,address)": { - "notice": "A new history was deployed." - } - }, - "kind": "user", - "methods": { - "calculateHistoryAddress(address,bytes32)": { - "notice": "Calculate the address of a history to be deployed deterministically." - }, - "newHistory(address)": { - "notice": "Deploy a new history." - }, - "newHistory(address,bytes32)": { - "notice": "Deploy a new history deterministically." - } - }, - "notice": "Allows anyone to reliably deploy a new `History` contract.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/onchain/rollups/export/abi/arbitrum.json b/onchain/rollups/export/abi/arbitrum.json index c05766e3..6dbefde3 100644 --- a/onchain/rollups/export/abi/arbitrum.json +++ b/onchain/rollups/export/abi/arbitrum.json @@ -957,97 +957,6 @@ "type": "function" } ] - }, - "HistoryFactory": { - "address": "0x1f158b5320BBf677FdA89F9a438df99BbE560A26", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "historyOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract History", - "name": "history", - "type": "address" - } - ], - "name": "HistoryCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateHistoryAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newHistory", - "outputs": [ - { - "internalType": "contract History", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - } - ], - "name": "newHistory", - "outputs": [ - { - "internalType": "contract History", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ] } } } diff --git a/onchain/rollups/export/abi/arbitrum_goerli.json b/onchain/rollups/export/abi/arbitrum_goerli.json index 62dcaf40..43a686d4 100644 --- a/onchain/rollups/export/abi/arbitrum_goerli.json +++ b/onchain/rollups/export/abi/arbitrum_goerli.json @@ -573,97 +573,6 @@ } ] }, - "HistoryFactory": { - "address": "0x1f158b5320BBf677FdA89F9a438df99BbE560A26", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "historyOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract History", - "name": "history", - "type": "address" - } - ], - "name": "HistoryCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateHistoryAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newHistory", - "outputs": [ - { - "internalType": "contract History", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - } - ], - "name": "newHistory", - "outputs": [ - { - "internalType": "contract History", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ] - }, "InputBox": { "address": "0x59b22D57D4f067708AB0c00552767405926dc768", "abi": [ diff --git a/onchain/rollups/export/abi/mainnet.json b/onchain/rollups/export/abi/mainnet.json index 49b60bbe..2dc6e0d2 100644 --- a/onchain/rollups/export/abi/mainnet.json +++ b/onchain/rollups/export/abi/mainnet.json @@ -957,97 +957,6 @@ "type": "function" } ] - }, - "HistoryFactory": { - "address": "0x1f158b5320BBf677FdA89F9a438df99BbE560A26", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "historyOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract History", - "name": "history", - "type": "address" - } - ], - "name": "HistoryCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateHistoryAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newHistory", - "outputs": [ - { - "internalType": "contract History", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - } - ], - "name": "newHistory", - "outputs": [ - { - "internalType": "contract History", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ] } } } diff --git a/onchain/rollups/export/abi/optimism.json b/onchain/rollups/export/abi/optimism.json index cdf65661..3a5a22e3 100644 --- a/onchain/rollups/export/abi/optimism.json +++ b/onchain/rollups/export/abi/optimism.json @@ -957,97 +957,6 @@ "type": "function" } ] - }, - "HistoryFactory": { - "address": "0x1f158b5320BBf677FdA89F9a438df99BbE560A26", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "historyOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract History", - "name": "history", - "type": "address" - } - ], - "name": "HistoryCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateHistoryAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newHistory", - "outputs": [ - { - "internalType": "contract History", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - } - ], - "name": "newHistory", - "outputs": [ - { - "internalType": "contract History", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ] } } } diff --git a/onchain/rollups/export/abi/optimism_goerli.json b/onchain/rollups/export/abi/optimism_goerli.json index 34ac1348..07bf8a57 100644 --- a/onchain/rollups/export/abi/optimism_goerli.json +++ b/onchain/rollups/export/abi/optimism_goerli.json @@ -573,97 +573,6 @@ } ] }, - "HistoryFactory": { - "address": "0x1f158b5320BBf677FdA89F9a438df99BbE560A26", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "historyOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract History", - "name": "history", - "type": "address" - } - ], - "name": "HistoryCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateHistoryAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newHistory", - "outputs": [ - { - "internalType": "contract History", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - } - ], - "name": "newHistory", - "outputs": [ - { - "internalType": "contract History", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ] - }, "InputBox": { "address": "0x59b22D57D4f067708AB0c00552767405926dc768", "abi": [ diff --git a/onchain/rollups/export/abi/sepolia.json b/onchain/rollups/export/abi/sepolia.json index ea85cb84..0f992ed9 100644 --- a/onchain/rollups/export/abi/sepolia.json +++ b/onchain/rollups/export/abi/sepolia.json @@ -573,97 +573,6 @@ } ] }, - "HistoryFactory": { - "address": "0x1f158b5320BBf677FdA89F9a438df99BbE560A26", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "historyOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract History", - "name": "history", - "type": "address" - } - ], - "name": "HistoryCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateHistoryAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newHistory", - "outputs": [ - { - "internalType": "contract History", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_historyOwner", - "type": "address" - } - ], - "name": "newHistory", - "outputs": [ - { - "internalType": "contract History", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ] - }, "InputBox": { "address": "0x59b22D57D4f067708AB0c00552767405926dc768", "abi": [ diff --git a/onchain/rollups/test/foundry/history/HistoryFactory.t.sol b/onchain/rollups/test/foundry/history/HistoryFactory.t.sol deleted file mode 100644 index ab934235..00000000 --- a/onchain/rollups/test/foundry/history/HistoryFactory.t.sol +++ /dev/null @@ -1,100 +0,0 @@ -// (c) Cartesi and individual authors (see AUTHORS) -// SPDX-License-Identifier: Apache-2.0 (see LICENSE) - -/// @title History Factory Test -pragma solidity ^0.8.8; - -import {Test} from "forge-std/Test.sol"; -import {HistoryFactory} from "contracts/history/HistoryFactory.sol"; -import {History} from "contracts/history/History.sol"; -import {Vm} from "forge-std/Vm.sol"; - -contract HistoryFactoryTest is Test { - HistoryFactory factory; - - event HistoryCreated(address historyOwner, History history); - - struct HistoryCreatedEventData { - address historyOwner; - History history; - } - - function setUp() public { - factory = new HistoryFactory(); - } - - function testNewHistory(address _historyOwner) public { - vm.assume(_historyOwner != address(0)); - - vm.recordLogs(); - - History history = factory.newHistory(_historyOwner); - - testNewHistoryAux(_historyOwner, history); - } - - function testNewHistoryAux( - address _historyOwner, - History _history - ) internal { - Vm.Log[] memory entries = vm.getRecordedLogs(); - - uint256 numOfHistoryCreated; - - for (uint256 i; i < entries.length; ++i) { - Vm.Log memory entry = entries[i]; - - if ( - entry.emitter == address(factory) && - entry.topics[0] == HistoryCreated.selector - ) { - ++numOfHistoryCreated; - - HistoryCreatedEventData memory eventData; - - eventData = abi.decode(entry.data, (HistoryCreatedEventData)); - - assertEq(_historyOwner, eventData.historyOwner); - assertEq(address(_history), address(eventData.history)); - } - } - - assertEq(numOfHistoryCreated, 1); - - // call to check history's owner - assertEq(_history.owner(), _historyOwner); - } - - function testNewHistoryDeterministic( - address _historyOwner, - bytes32 _salt - ) public { - vm.assume(_historyOwner != address(0)); - - address precalculatedAddress = factory.calculateHistoryAddress( - _historyOwner, - _salt - ); - - vm.recordLogs(); - - History history = factory.newHistory(_historyOwner, _salt); - - testNewHistoryAux(_historyOwner, history); - - // Precalculated address must match actual address - assertEq(precalculatedAddress, address(history)); - - precalculatedAddress = factory.calculateHistoryAddress( - _historyOwner, - _salt - ); - - // Precalculated address must STILL match actual address - assertEq(precalculatedAddress, address(history)); - - // Cannot deploy a history with the same salt twice - vm.expectRevert(); - factory.newHistory(_historyOwner, _salt); - } -}