From cc3ae5c17453d5a5171a2276ea5d529e1d8f505c Mon Sep 17 00:00:00 2001 From: Guilherme Dantas Date: Sun, 19 Nov 2023 23:00:31 -0300 Subject: [PATCH] feat!: remove authority-history pair factory --- .../rollups/.changeset/dull-clouds-smash.md | 6 + .../authority/AuthorityHistoryPairFactory.sol | 109 ------- .../IAuthorityHistoryPairFactory.sol | 63 ---- onchain/rollups/deploy/02_factory.ts | 9 +- .../arbitrum/AuthorityHistoryPairFactory.json | 282 ------------------ .../AuthorityHistoryPairFactory.json | 282 ------------------ .../mainnet/AuthorityHistoryPairFactory.json | 282 ------------------ .../optimism/AuthorityHistoryPairFactory.json | 282 ------------------ .../AuthorityHistoryPairFactory.json | 282 ------------------ .../sepolia/AuthorityHistoryPairFactory.json | 282 ------------------ onchain/rollups/export/abi/arbitrum.json | 150 +--------- .../rollups/export/abi/arbitrum_goerli.json | 150 +--------- onchain/rollups/export/abi/mainnet.json | 150 +--------- onchain/rollups/export/abi/optimism.json | 150 +--------- .../rollups/export/abi/optimism_goerli.json | 150 +--------- onchain/rollups/export/abi/sepolia.json | 150 +--------- .../AuthorityHistoryPairFactory.t.sol | 256 ---------------- 17 files changed, 14 insertions(+), 3021 deletions(-) create mode 100644 onchain/rollups/.changeset/dull-clouds-smash.md delete mode 100644 onchain/rollups/contracts/consensus/authority/AuthorityHistoryPairFactory.sol delete mode 100644 onchain/rollups/contracts/consensus/authority/IAuthorityHistoryPairFactory.sol delete mode 100644 onchain/rollups/deployments/arbitrum/AuthorityHistoryPairFactory.json delete mode 100644 onchain/rollups/deployments/arbitrum_goerli/AuthorityHistoryPairFactory.json delete mode 100644 onchain/rollups/deployments/mainnet/AuthorityHistoryPairFactory.json delete mode 100644 onchain/rollups/deployments/optimism/AuthorityHistoryPairFactory.json delete mode 100644 onchain/rollups/deployments/optimism_goerli/AuthorityHistoryPairFactory.json delete mode 100644 onchain/rollups/deployments/sepolia/AuthorityHistoryPairFactory.json delete mode 100644 onchain/rollups/test/foundry/consensus/authority/AuthorityHistoryPairFactory.t.sol diff --git a/onchain/rollups/.changeset/dull-clouds-smash.md b/onchain/rollups/.changeset/dull-clouds-smash.md new file mode 100644 index 00000000..f678e76f --- /dev/null +++ b/onchain/rollups/.changeset/dull-clouds-smash.md @@ -0,0 +1,6 @@ +--- +"@cartesi/rollups": major +--- + +Removed `AuthorityHistoryPairFactory` and `IAuthorityHistoryPairFactory`. +These contracts is no longer be necessary for the new `Authority` contract. diff --git a/onchain/rollups/contracts/consensus/authority/AuthorityHistoryPairFactory.sol b/onchain/rollups/contracts/consensus/authority/AuthorityHistoryPairFactory.sol deleted file mode 100644 index a8072585..00000000 --- a/onchain/rollups/contracts/consensus/authority/AuthorityHistoryPairFactory.sol +++ /dev/null @@ -1,109 +0,0 @@ -// (c) Cartesi and individual authors (see AUTHORS) -// SPDX-License-Identifier: Apache-2.0 (see LICENSE) - -pragma solidity ^0.8.8; - -import {IAuthorityHistoryPairFactory} from "./IAuthorityHistoryPairFactory.sol"; -import {Authority} from "./Authority.sol"; -import {IAuthorityFactory} from "./IAuthorityFactory.sol"; -import {History} from "../../history/History.sol"; -import {IHistoryFactory} from "../../history/IHistoryFactory.sol"; - -/// @title Authority-History Pair Factory -/// @notice Allows anyone to reliably deploy a new Authority-History pair. -contract AuthorityHistoryPairFactory is IAuthorityHistoryPairFactory { - IAuthorityFactory immutable authorityFactory; - IHistoryFactory immutable historyFactory; - - /// @notice Constructs the factory. - /// @param _authorityFactory The `Authority` factory - /// @param _historyFactory The `History` factory - constructor( - IAuthorityFactory _authorityFactory, - IHistoryFactory _historyFactory - ) { - authorityFactory = _authorityFactory; - historyFactory = _historyFactory; - - emit AuthorityHistoryPairFactoryCreated( - _authorityFactory, - _historyFactory - ); - } - - function getAuthorityFactory() - external - view - override - returns (IAuthorityFactory) - { - return authorityFactory; - } - - function getHistoryFactory() - external - view - override - returns (IHistoryFactory) - { - return historyFactory; - } - - function newAuthorityHistoryPair( - address _authorityOwner - ) external override returns (Authority authority_, History history_) { - authority_ = authorityFactory.newAuthority(address(this)); - history_ = historyFactory.newHistory(address(authority_)); - - authority_.setHistory(history_); - authority_.transferOwnership(_authorityOwner); - } - - function newAuthorityHistoryPair( - address _authorityOwner, - bytes32 _salt - ) external override returns (Authority authority_, History history_) { - authority_ = authorityFactory.newAuthority( - address(this), - calculateCompoundSalt(_authorityOwner, _salt) - ); - history_ = historyFactory.newHistory(address(authority_), _salt); - - authority_.setHistory(history_); - authority_.transferOwnership(_authorityOwner); - } - - function calculateAuthorityHistoryAddressPair( - address _authorityOwner, - bytes32 _salt - ) - external - view - override - returns (address authorityAddress_, address historyAddress_) - { - authorityAddress_ = authorityFactory.calculateAuthorityAddress( - address(this), - calculateCompoundSalt(_authorityOwner, _salt) - ); - - historyAddress_ = historyFactory.calculateHistoryAddress( - authorityAddress_, - _salt - ); - } - - /// @notice Calculate the compound salt. - /// @param _authorityOwner authority owner - /// @param _salt salt - /// @return compound salt - /// @dev The purpose of calculating a compound salt is to - /// prevent attackers front-running the creation of an Authority - /// occupying the to-be-deployed address, but with a different owner. - function calculateCompoundSalt( - address _authorityOwner, - bytes32 _salt - ) internal pure returns (bytes32) { - return keccak256(abi.encodePacked(_authorityOwner, _salt)); - } -} diff --git a/onchain/rollups/contracts/consensus/authority/IAuthorityHistoryPairFactory.sol b/onchain/rollups/contracts/consensus/authority/IAuthorityHistoryPairFactory.sol deleted file mode 100644 index 0ffef10f..00000000 --- a/onchain/rollups/contracts/consensus/authority/IAuthorityHistoryPairFactory.sol +++ /dev/null @@ -1,63 +0,0 @@ -// (c) Cartesi and individual authors (see AUTHORS) -// SPDX-License-Identifier: Apache-2.0 (see LICENSE) - -pragma solidity ^0.8.8; - -import {Authority} from "./Authority.sol"; -import {IAuthorityFactory} from "./IAuthorityFactory.sol"; -import {History} from "../../history/History.sol"; -import {IHistoryFactory} from "../../history/IHistoryFactory.sol"; - -/// @title Authority-History Pair Factory interface -interface IAuthorityHistoryPairFactory { - // Events - - /// @notice The factory was created. - /// @param authorityFactory The underlying `Authority` factory - /// @param historyFactory The underlying `History` factory - /// @dev MUST be emitted on construction. - event AuthorityHistoryPairFactoryCreated( - IAuthorityFactory authorityFactory, - IHistoryFactory historyFactory - ); - - // Permissionless functions - - /// @notice Get the factory used to deploy `Authority` contracts - /// @return The `Authority` factory - function getAuthorityFactory() external view returns (IAuthorityFactory); - - /// @notice Get the factory used to deploy `History` contracts - /// @return The `History` factory - function getHistoryFactory() external view returns (IHistoryFactory); - - /// @notice Deploy a new authority-history pair. - /// @param _authorityOwner The initial authority owner - /// @return The authority - /// @return The history - function newAuthorityHistoryPair( - address _authorityOwner - ) external returns (Authority, History); - - /// @notice Deploy a new authority-history pair deterministically. - /// @param _authorityOwner The initial authority owner - /// @param _salt The salt used to deterministically generate the authority-history pair address - /// @return The authority - /// @return The history - function newAuthorityHistoryPair( - address _authorityOwner, - bytes32 _salt - ) external returns (Authority, History); - - /// @notice Calculate the address of an authority-history pair to be deployed deterministically. - /// @param _authorityOwner The initial authority owner - /// @param _salt The salt used to deterministically generate the authority-history address pair - /// @return The deterministic authority address - /// @return The deterministic history address - /// @dev Beware that only the `newAuthorityHistoryPair` function with the `_salt` parameter - /// is able to deterministically deploy an authority-history pair. - function calculateAuthorityHistoryAddressPair( - address _authorityOwner, - bytes32 _salt - ) external view returns (address, address); -} diff --git a/onchain/rollups/deploy/02_factory.ts b/onchain/rollups/deploy/02_factory.ts index 4b28e60c..70a76999 100644 --- a/onchain/rollups/deploy/02_factory.ts +++ b/onchain/rollups/deploy/02_factory.ts @@ -23,13 +23,8 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { const { Bitmask, MerkleV2 } = await deployments.all(); - const AuthorityFactory = await deployments.deploy("AuthorityFactory", opts); - const HistoryFactory = await deployments.deploy("HistoryFactory", opts); - - await deployments.deploy("AuthorityHistoryPairFactory", { - ...opts, - args: [AuthorityFactory.address, HistoryFactory.address], - }); + await deployments.deploy("AuthorityFactory", opts); + await deployments.deploy("HistoryFactory", opts); await deployments.deploy("CartesiDAppFactory", { ...opts, diff --git a/onchain/rollups/deployments/arbitrum/AuthorityHistoryPairFactory.json b/onchain/rollups/deployments/arbitrum/AuthorityHistoryPairFactory.json deleted file mode 100644 index 27c75e00..00000000 --- a/onchain/rollups/deployments/arbitrum/AuthorityHistoryPairFactory.json +++ /dev/null @@ -1,282 +0,0 @@ -{ - "address": "0x3890A047Cf9Af60731E80B2105362BbDCD70142D", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IAuthorityFactory", - "name": "_authorityFactory", - "type": "address" - }, - { - "internalType": "contract IHistoryFactory", - "name": "_historyFactory", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract IAuthorityFactory", - "name": "authorityFactory", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract IHistoryFactory", - "name": "historyFactory", - "type": "address" - } - ], - "name": "AuthorityHistoryPairFactoryCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateAuthorityHistoryAddressPair", - "outputs": [ - { - "internalType": "address", - "name": "authorityAddress_", - "type": "address" - }, - { - "internalType": "address", - "name": "historyAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getAuthorityFactory", - "outputs": [ - { - "internalType": "contract IAuthorityFactory", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getHistoryFactory", - "outputs": [ - { - "internalType": "contract IHistoryFactory", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - } - ], - "name": "newAuthorityHistoryPair", - "outputs": [ - { - "internalType": "contract Authority", - "name": "authority_", - "type": "address" - }, - { - "internalType": "contract History", - "name": "history_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newAuthorityHistoryPair", - "outputs": [ - { - "internalType": "contract Authority", - "name": "authority_", - "type": "address" - }, - { - "internalType": "contract History", - "name": "history_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0xd3829b59f1ef8e52ebbd98a8c5d39fa1d651321c77c35d6566a3ca548c057134", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 4, - "gasUsed": "2268511", - "logsBloom": "0x00000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000004000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x970f725ae44c499ae5715f18acaa14e46ed51369962476db8514733bbf8ce72c", - "transactionHash": "0xd3829b59f1ef8e52ebbd98a8c5d39fa1d651321c77c35d6566a3ca548c057134", - "logs": [ - { - "transactionIndex": 4, - "blockNumber": 137456748, - "transactionHash": "0xd3829b59f1ef8e52ebbd98a8c5d39fa1d651321c77c35d6566a3ca548c057134", - "address": "0x3890A047Cf9Af60731E80B2105362BbDCD70142D", - "topics": [ - "0x030bcdc35fc24f8a53829b016647c842a9d981d1fed3783a7e282b6e6c9ea4a9" - ], - "data": "0x000000000000000000000000f26a5b278c25d8d41a136d22ad719eaced9c3e630000000000000000000000001f158b5320bbf677fda89f9a438df99bbe560a26", - "logIndex": 11, - "blockHash": "0x970f725ae44c499ae5715f18acaa14e46ed51369962476db8514733bbf8ce72c" - } - ], - "blockNumber": 137456748, - "cumulativeGasUsed": "4505101", - "status": 1, - "byzantium": true - }, - "args": [ - "0xf26a5b278C25D8D41A136d22Ad719EACEd9c3e63", - "0x1f158b5320BBf677FdA89F9a438df99BbE560A26" - ], - "numDeployments": 1, - "solcInputHash": "b1bc2a879218740e83dfbb7046a3cc8c", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IAuthorityFactory\",\"name\":\"_authorityFactory\",\"type\":\"address\"},{\"internalType\":\"contract IHistoryFactory\",\"name\":\"_historyFactory\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract IAuthorityFactory\",\"name\":\"authorityFactory\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract IHistoryFactory\",\"name\":\"historyFactory\",\"type\":\"address\"}],\"name\":\"AuthorityHistoryPairFactoryCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"calculateAuthorityHistoryAddressPair\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"authorityAddress_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"historyAddress_\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAuthorityFactory\",\"outputs\":[{\"internalType\":\"contract IAuthorityFactory\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getHistoryFactory\",\"outputs\":[{\"internalType\":\"contract IHistoryFactory\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"}],\"name\":\"newAuthorityHistoryPair\",\"outputs\":[{\"internalType\":\"contract Authority\",\"name\":\"authority_\",\"type\":\"address\"},{\"internalType\":\"contract History\",\"name\":\"history_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"newAuthorityHistoryPair\",\"outputs\":[{\"internalType\":\"contract Authority\",\"name\":\"authority_\",\"type\":\"address\"},{\"internalType\":\"contract History\",\"name\":\"history_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"AuthorityHistoryPairFactoryCreated(address,address)\":{\"details\":\"MUST be emitted on construction.\",\"params\":{\"authorityFactory\":\"The underlying `Authority` factory\",\"historyFactory\":\"The underlying `History` factory\"}}},\"kind\":\"dev\",\"methods\":{\"calculateAuthorityHistoryAddressPair(address,bytes32)\":{\"details\":\"Beware that only the `newAuthorityHistoryPair` function with the `_salt` parameter is able to deterministically deploy an authority-history pair.\",\"params\":{\"_authorityOwner\":\"The initial authority owner\",\"_salt\":\"The salt used to deterministically generate the authority-history address pair\"},\"returns\":{\"authorityAddress_\":\"The deterministic authority address\",\"historyAddress_\":\"The deterministic history address\"}},\"constructor\":{\"params\":{\"_authorityFactory\":\"The `Authority` factory\",\"_historyFactory\":\"The `History` factory\"}},\"getAuthorityFactory()\":{\"returns\":{\"_0\":\"The `Authority` factory\"}},\"getHistoryFactory()\":{\"returns\":{\"_0\":\"The `History` factory\"}},\"newAuthorityHistoryPair(address)\":{\"params\":{\"_authorityOwner\":\"The initial authority owner\"},\"returns\":{\"authority_\":\"The authority\",\"history_\":\"The history\"}},\"newAuthorityHistoryPair(address,bytes32)\":{\"params\":{\"_authorityOwner\":\"The initial authority owner\",\"_salt\":\"The salt used to deterministically generate the authority-history pair address\"},\"returns\":{\"authority_\":\"The authority\",\"history_\":\"The history\"}}},\"title\":\"Authority-History Pair Factory\",\"version\":1},\"userdoc\":{\"events\":{\"AuthorityHistoryPairFactoryCreated(address,address)\":{\"notice\":\"The factory was created.\"}},\"kind\":\"user\",\"methods\":{\"calculateAuthorityHistoryAddressPair(address,bytes32)\":{\"notice\":\"Calculate the address of an authority-history pair to be deployed deterministically.\"},\"constructor\":{\"notice\":\"Constructs the factory.\"},\"getAuthorityFactory()\":{\"notice\":\"Get the factory used to deploy `Authority` contracts\"},\"getHistoryFactory()\":{\"notice\":\"Get the factory used to deploy `History` contracts\"},\"newAuthorityHistoryPair(address)\":{\"notice\":\"Deploy a new authority-history pair.\"},\"newAuthorityHistoryPair(address,bytes32)\":{\"notice\":\"Deploy a new authority-history pair deterministically.\"}},\"notice\":\"Allows anyone to reliably deploy a new Authority-History pair.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/consensus/authority/AuthorityHistoryPairFactory.sol\":\"AuthorityHistoryPairFactory\"},\"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/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"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\"},\"contracts/consensus/AbstractConsensus.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 {IConsensus} from \\\"./IConsensus.sol\\\";\\n\\n/// @title Abstract Consensus\\n/// @notice An abstract contract that partially implements `IConsensus`.\\nabstract contract AbstractConsensus is IConsensus {\\n /// @notice Emits an `ApplicationJoined` event with the message sender.\\n function join() external override {\\n emit ApplicationJoined(msg.sender);\\n }\\n}\\n\",\"keccak256\":\"0xced9c940ccbbe81fbfcf3bc087c04b9ae90325d6bba68a8cee9ebfa3dd9d231d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/IConsensus.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 Consensus interface\\n///\\n/// @notice This contract defines a generic interface for consensuses.\\n/// We use the word \\\"consensus\\\" to designate a contract that provides claims\\n/// in the base layer regarding the state of off-chain machines running in\\n/// the execution layer. How this contract is able to reach consensus, who is\\n/// able to submit claims, and how are claims stored in the base layer are\\n/// some of the implementation details left unspecified by this interface.\\n///\\n/// From the point of view of a DApp, these claims are necessary to validate\\n/// on-chain action allowed by the off-chain machine in the form of vouchers\\n/// and notices. Each claim is composed of three parts: an epoch hash, a first\\n/// index, and a last index. We'll explain each of these parts below.\\n///\\n/// First, let us define the word \\\"epoch\\\". For finality reasons, we need to\\n/// divide the stream of inputs being fed into the off-chain machine into\\n/// batches of inputs, which we call \\\"epoches\\\". At the end of every epoch,\\n/// we summarize the state of the off-chain machine in a single hash, called\\n/// \\\"epoch hash\\\". Please note that this interface does not define how this\\n/// stream of inputs is being chopped up into epoches.\\n///\\n/// The other two parts are simply the indices of the first and last inputs\\n/// accepted during the epoch. Logically, the first index MUST BE less than\\n/// or equal to the last index. As a result, every epoch MUST accept at least\\n/// one input. This assumption stems from the fact that the state of a machine\\n/// can only change after an input is fed into it.\\n///\\n/// Examples of possible implementations of this interface include:\\n///\\n/// * An authority consensus, controlled by a single address who has full\\n/// control over epoch boundaries, claim submission, asset management, etc.\\n///\\n/// * A quorum consensus, controlled by a limited set of validators, that\\n/// vote on the state of the machine at the end of every epoch. Also, epoch\\n/// boundaries are determined by the timestamp in the base layer, and assets\\n/// are split equally amongst the validators.\\n///\\n/// * An NxN consensus, which allows anyone to submit and dispute claims\\n/// in the base layer. Epoch boundaries are determined in the same fashion\\n/// as in the quorum example.\\n///\\ninterface IConsensus {\\n /// @notice An application has joined the consensus' validation set.\\n /// @param application The application\\n /// @dev MUST be triggered on a successful call to `join`.\\n event ApplicationJoined(address application);\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// The encoding of `_proofContext` might vary\\n /// depending on the 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 /// @notice Signal the consensus that the message sender wants to join its validation set.\\n /// @dev MUST fire an `ApplicationJoined` event with the message sender as argument.\\n function join() external;\\n}\\n\",\"keccak256\":\"0xc9d295fada66eb0602e0f1e2e236708e52f959927abb4ab6b04173a98b92ac16\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/Authority.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\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {IConsensus} from \\\"../IConsensus.sol\\\";\\nimport {AbstractConsensus} from \\\"../AbstractConsensus.sol\\\";\\nimport {IHistory} from \\\"../../history/IHistory.sol\\\";\\n\\n/// @title Authority consensus\\n/// @notice A consensus model controlled by a single address, the owner.\\n/// Claims are stored in an auxiliary contract called `History`.\\n/// @dev This contract inherits `AbstractConsensus` and OpenZeppelin's `Ownable` contract.\\n/// For more information on `Ownable`, please consult OpenZeppelin's official documentation.\\ncontract Authority is AbstractConsensus, Ownable {\\n /// @notice The current history contract.\\n /// @dev See the `getHistory` and `setHistory` functions.\\n IHistory internal history;\\n\\n /// @notice A new history contract is used to store claims.\\n /// @param history The new history contract\\n /// @dev MUST be triggered on a successful call to `setHistory`.\\n event NewHistory(IHistory history);\\n\\n /// @notice Raised when a transfer of tokens from an authority to a recipient fails.\\n error AuthorityWithdrawalFailed();\\n\\n /// @notice Constructs an `Authority` contract.\\n /// @param _owner The initial contract 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 (msg.sender != _owner) {\\n transferOwnership(_owner);\\n }\\n }\\n\\n /// @notice Submits a claim to the current history contract.\\n /// The encoding of `_claimData` might vary depending on the\\n /// implementation of the current history contract.\\n /// @param _claimData Data for submitting a claim\\n /// @dev Can only be called by the `Authority` owner,\\n /// and the `Authority` contract must have ownership over\\n /// its current history contract.\\n function submitClaim(bytes calldata _claimData) external onlyOwner {\\n history.submitClaim(_claimData);\\n }\\n\\n /// @notice Transfer ownership over the current history contract to `_consensus`.\\n /// @param _consensus The new owner of the current history contract\\n /// @dev Can only be called by the `Authority` owner,\\n /// and the `Authority` contract must have ownership over\\n /// its current history contract.\\n function migrateHistoryToConsensus(address _consensus) external onlyOwner {\\n history.migrateToConsensus(_consensus);\\n }\\n\\n /// @notice Make `Authority` point to another history contract.\\n /// @param _history The new history contract\\n /// @dev Emits a `NewHistory` event.\\n /// Can only be called by the `Authority` owner.\\n function setHistory(IHistory _history) external onlyOwner {\\n history = _history;\\n emit NewHistory(_history);\\n }\\n\\n /// @notice Get the current history contract.\\n /// @return The current history contract\\n function getHistory() external view returns (IHistory) {\\n return history;\\n }\\n\\n /// @notice Get a claim from the current history.\\n /// The encoding of `_proofContext` might vary depending on the\\n /// implementation of the current history contract.\\n /// @inheritdoc IConsensus\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n ) external view override returns (bytes32, uint256, uint256) {\\n return history.getClaim(_dapp, _proofContext);\\n }\\n\\n /// @notice Transfer some amount of ERC-20 tokens to a recipient.\\n /// @param _token The token contract\\n /// @param _recipient The recipient address\\n /// @param _amount The amount of tokens to be withdrawn\\n /// @dev Can only be called by the `Authority` owner.\\n function withdrawERC20Tokens(\\n IERC20 _token,\\n address _recipient,\\n uint256 _amount\\n ) external onlyOwner {\\n bool success = _token.transfer(_recipient, _amount);\\n\\n if (!success) {\\n revert AuthorityWithdrawalFailed();\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc71ea13163833684ce576861fbb19dc40e7096a022c6976b61a99dfc9e1c0903\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/AuthorityHistoryPairFactory.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 {IAuthorityHistoryPairFactory} from \\\"./IAuthorityHistoryPairFactory.sol\\\";\\nimport {Authority} from \\\"./Authority.sol\\\";\\nimport {IAuthorityFactory} from \\\"./IAuthorityFactory.sol\\\";\\nimport {History} from \\\"../../history/History.sol\\\";\\nimport {IHistoryFactory} from \\\"../../history/IHistoryFactory.sol\\\";\\n\\n/// @title Authority-History Pair Factory\\n/// @notice Allows anyone to reliably deploy a new Authority-History pair.\\ncontract AuthorityHistoryPairFactory is IAuthorityHistoryPairFactory {\\n IAuthorityFactory immutable authorityFactory;\\n IHistoryFactory immutable historyFactory;\\n\\n /// @notice Constructs the factory.\\n /// @param _authorityFactory The `Authority` factory\\n /// @param _historyFactory The `History` factory\\n constructor(\\n IAuthorityFactory _authorityFactory,\\n IHistoryFactory _historyFactory\\n ) {\\n authorityFactory = _authorityFactory;\\n historyFactory = _historyFactory;\\n\\n emit AuthorityHistoryPairFactoryCreated(\\n _authorityFactory,\\n _historyFactory\\n );\\n }\\n\\n function getAuthorityFactory()\\n external\\n view\\n override\\n returns (IAuthorityFactory)\\n {\\n return authorityFactory;\\n }\\n\\n function getHistoryFactory()\\n external\\n view\\n override\\n returns (IHistoryFactory)\\n {\\n return historyFactory;\\n }\\n\\n function newAuthorityHistoryPair(\\n address _authorityOwner\\n ) external override returns (Authority authority_, History history_) {\\n authority_ = authorityFactory.newAuthority(address(this));\\n history_ = historyFactory.newHistory(address(authority_));\\n\\n authority_.setHistory(history_);\\n authority_.transferOwnership(_authorityOwner);\\n }\\n\\n function newAuthorityHistoryPair(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external override returns (Authority authority_, History history_) {\\n authority_ = authorityFactory.newAuthority(\\n address(this),\\n calculateCompoundSalt(_authorityOwner, _salt)\\n );\\n history_ = historyFactory.newHistory(address(authority_), _salt);\\n\\n authority_.setHistory(history_);\\n authority_.transferOwnership(_authorityOwner);\\n }\\n\\n function calculateAuthorityHistoryAddressPair(\\n address _authorityOwner,\\n bytes32 _salt\\n )\\n external\\n view\\n override\\n returns (address authorityAddress_, address historyAddress_)\\n {\\n authorityAddress_ = authorityFactory.calculateAuthorityAddress(\\n address(this),\\n calculateCompoundSalt(_authorityOwner, _salt)\\n );\\n\\n historyAddress_ = historyFactory.calculateHistoryAddress(\\n authorityAddress_,\\n _salt\\n );\\n }\\n\\n /// @notice Calculate the compound salt.\\n /// @param _authorityOwner authority owner\\n /// @param _salt salt\\n /// @return compound salt\\n /// @dev The purpose of calculating a compound salt is to\\n /// prevent attackers front-running the creation of an Authority\\n /// occupying the to-be-deployed address, but with a different owner.\\n function calculateCompoundSalt(\\n address _authorityOwner,\\n bytes32 _salt\\n ) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(_authorityOwner, _salt));\\n }\\n}\\n\",\"keccak256\":\"0x3ee10d66249cf837c51ba4fe082edb7cebf17466060c9fd405cba2861951690d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/IAuthorityFactory.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 {Authority} from \\\"./Authority.sol\\\";\\n\\n/// @title Authority Factory interface\\ninterface IAuthorityFactory {\\n // Events\\n\\n /// @notice A new authority was deployed.\\n /// @param authorityOwner The initial authority owner\\n /// @param authority The authority\\n /// @dev MUST be triggered on a successful call to `newAuthority`.\\n event AuthorityCreated(address authorityOwner, Authority authority);\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new authority.\\n /// @param _authorityOwner The initial authority owner\\n /// @return The authority\\n /// @dev On success, MUST emit an `AuthorityCreated` event.\\n function newAuthority(address _authorityOwner) external returns (Authority);\\n\\n /// @notice Deploy a new authority deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority address\\n /// @return The authority\\n /// @dev On success, MUST emit an `AuthorityCreated` event.\\n function newAuthority(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external returns (Authority);\\n\\n /// @notice Calculate the address of an authority to be deployed deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority address\\n /// @return The deterministic authority address\\n /// @dev Beware that only the `newAuthority` function with the `_salt` parameter\\n /// is able to deterministically deploy an authority.\\n function calculateAuthorityAddress(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x149bcdf9641b337836263196aabb655e69902212ede21becedd9c08b5b304717\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/IAuthorityHistoryPairFactory.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 {Authority} from \\\"./Authority.sol\\\";\\nimport {IAuthorityFactory} from \\\"./IAuthorityFactory.sol\\\";\\nimport {History} from \\\"../../history/History.sol\\\";\\nimport {IHistoryFactory} from \\\"../../history/IHistoryFactory.sol\\\";\\n\\n/// @title Authority-History Pair Factory interface\\ninterface IAuthorityHistoryPairFactory {\\n // Events\\n\\n /// @notice The factory was created.\\n /// @param authorityFactory The underlying `Authority` factory\\n /// @param historyFactory The underlying `History` factory\\n /// @dev MUST be emitted on construction.\\n event AuthorityHistoryPairFactoryCreated(\\n IAuthorityFactory authorityFactory,\\n IHistoryFactory historyFactory\\n );\\n\\n // Permissionless functions\\n\\n /// @notice Get the factory used to deploy `Authority` contracts\\n /// @return The `Authority` factory\\n function getAuthorityFactory() external view returns (IAuthorityFactory);\\n\\n /// @notice Get the factory used to deploy `History` contracts\\n /// @return The `History` factory\\n function getHistoryFactory() external view returns (IHistoryFactory);\\n\\n /// @notice Deploy a new authority-history pair.\\n /// @param _authorityOwner The initial authority owner\\n /// @return The authority\\n /// @return The history\\n function newAuthorityHistoryPair(\\n address _authorityOwner\\n ) external returns (Authority, History);\\n\\n /// @notice Deploy a new authority-history pair deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority-history pair address\\n /// @return The authority\\n /// @return The history\\n function newAuthorityHistoryPair(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external returns (Authority, History);\\n\\n /// @notice Calculate the address of an authority-history pair to be deployed deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority-history address pair\\n /// @return The deterministic authority address\\n /// @return The deterministic history address\\n /// @dev Beware that only the `newAuthorityHistoryPair` function with the `_salt` parameter\\n /// is able to deterministically deploy an authority-history pair.\\n function calculateAuthorityHistoryAddressPair(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external view returns (address, address);\\n}\\n\",\"keccak256\":\"0xd0e4b284ed461544e4d70c030900d0bb9a74c1eee14952c30e35856ce912fbb3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"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/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": "0x60c060405234801561001057600080fd5b5060405161086f38038061086f83398101604081905261002f916100a0565b6001600160a01b03828116608081905290821660a08190526040805192835260208301919091527f030bcdc35fc24f8a53829b016647c842a9d981d1fed3783a7e282b6e6c9ea4a9910160405180910390a150506100da565b6001600160a01b038116811461009d57600080fd5b50565b600080604083850312156100b357600080fd5b82516100be81610088565b60208401519092506100cf81610088565b809150509250929050565b60805160a0516107486101276000396000818160f6015281816101ec01528181610313015261051601526000818160960152818161011f01528181610284015261044601526107486000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c806339dcd4571461005c57806375689f8314610094578063b05cd1dc146100ce578063d73f347a146100e1578063f16b1a5c146100f4575b600080fd5b61006f61006a3660046106a5565b61011a565b604080516001600160a01b039384168152929091166020830152015b60405180910390f35b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b03909116815260200161008b565b61006f6100dc3660046106d1565b610262565b61006f6100ef3660046106a5565b610441565b7f00000000000000000000000000000000000000000000000000000000000000006100b6565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316629c5784306101568787610646565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381865afa15801561019f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c391906106f5565b60405163287ce2dd60e11b81526001600160a01b038083166004830152602482018690529193507f0000000000000000000000000000000000000000000000000000000000000000909116906350f9c5ba90604401602060405180830381865afa158015610235573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025991906106f5565b90509250929050565b604051632ce946e160e21b815230600482015260009081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063b3a51b84906024016020604051808303816000875af11580156102cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f191906106f5565b60405163446a4d3160e11b81526001600160a01b0380831660048301529193507f0000000000000000000000000000000000000000000000000000000000000000909116906388d49a62906024016020604051808303816000875af115801561035e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038291906106f5565b60405163159c5ea160e01b81526001600160a01b0380831660048301529192509083169063159c5ea190602401600060405180830381600087803b1580156103c957600080fd5b505af11580156103dd573d6000803e3d6000fd5b505060405163f2fde38b60e01b81526001600160a01b0386811660048301528516925063f2fde38b9150602401600060405180830381600087803b15801561042457600080fd5b505af1158015610438573d6000803e3d6000fd5b50505050915091565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635a3f27d33061047e8787610646565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156104c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ed91906106f5565b604051632ab8b11560e01b81526001600160a01b038083166004830152602482018690529193507f000000000000000000000000000000000000000000000000000000000000000090911690632ab8b115906044016020604051808303816000875af1158015610561573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058591906106f5565b60405163159c5ea160e01b81526001600160a01b0380831660048301529192509083169063159c5ea190602401600060405180830381600087803b1580156105cc57600080fd5b505af11580156105e0573d6000803e3d6000fd5b505060405163f2fde38b60e01b81526001600160a01b0387811660048301528516925063f2fde38b9150602401600060405180830381600087803b15801561062757600080fd5b505af115801561063b573d6000803e3d6000fd5b505050509250929050565b6040516bffffffffffffffffffffffff19606084901b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905092915050565b6001600160a01b03811681146106a257600080fd5b50565b600080604083850312156106b857600080fd5b82356106c38161068d565b946020939093013593505050565b6000602082840312156106e357600080fd5b81356106ee8161068d565b9392505050565b60006020828403121561070757600080fd5b81516106ee8161068d56fea2646970667358221220c9ff4c136426d9ba4f5c3e496e98c529a164caa845ab19e63e0cbefb6f48838664736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c806339dcd4571461005c57806375689f8314610094578063b05cd1dc146100ce578063d73f347a146100e1578063f16b1a5c146100f4575b600080fd5b61006f61006a3660046106a5565b61011a565b604080516001600160a01b039384168152929091166020830152015b60405180910390f35b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b03909116815260200161008b565b61006f6100dc3660046106d1565b610262565b61006f6100ef3660046106a5565b610441565b7f00000000000000000000000000000000000000000000000000000000000000006100b6565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316629c5784306101568787610646565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381865afa15801561019f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c391906106f5565b60405163287ce2dd60e11b81526001600160a01b038083166004830152602482018690529193507f0000000000000000000000000000000000000000000000000000000000000000909116906350f9c5ba90604401602060405180830381865afa158015610235573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025991906106f5565b90509250929050565b604051632ce946e160e21b815230600482015260009081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063b3a51b84906024016020604051808303816000875af11580156102cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f191906106f5565b60405163446a4d3160e11b81526001600160a01b0380831660048301529193507f0000000000000000000000000000000000000000000000000000000000000000909116906388d49a62906024016020604051808303816000875af115801561035e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038291906106f5565b60405163159c5ea160e01b81526001600160a01b0380831660048301529192509083169063159c5ea190602401600060405180830381600087803b1580156103c957600080fd5b505af11580156103dd573d6000803e3d6000fd5b505060405163f2fde38b60e01b81526001600160a01b0386811660048301528516925063f2fde38b9150602401600060405180830381600087803b15801561042457600080fd5b505af1158015610438573d6000803e3d6000fd5b50505050915091565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635a3f27d33061047e8787610646565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156104c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ed91906106f5565b604051632ab8b11560e01b81526001600160a01b038083166004830152602482018690529193507f000000000000000000000000000000000000000000000000000000000000000090911690632ab8b115906044016020604051808303816000875af1158015610561573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058591906106f5565b60405163159c5ea160e01b81526001600160a01b0380831660048301529192509083169063159c5ea190602401600060405180830381600087803b1580156105cc57600080fd5b505af11580156105e0573d6000803e3d6000fd5b505060405163f2fde38b60e01b81526001600160a01b0387811660048301528516925063f2fde38b9150602401600060405180830381600087803b15801561062757600080fd5b505af115801561063b573d6000803e3d6000fd5b505050509250929050565b6040516bffffffffffffffffffffffff19606084901b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905092915050565b6001600160a01b03811681146106a257600080fd5b50565b600080604083850312156106b857600080fd5b82356106c38161068d565b946020939093013593505050565b6000602082840312156106e357600080fd5b81356106ee8161068d565b9392505050565b60006020828403121561070757600080fd5b81516106ee8161068d56fea2646970667358221220c9ff4c136426d9ba4f5c3e496e98c529a164caa845ab19e63e0cbefb6f48838664736f6c63430008130033", - "devdoc": { - "events": { - "AuthorityHistoryPairFactoryCreated(address,address)": { - "details": "MUST be emitted on construction.", - "params": { - "authorityFactory": "The underlying `Authority` factory", - "historyFactory": "The underlying `History` factory" - } - } - }, - "kind": "dev", - "methods": { - "calculateAuthorityHistoryAddressPair(address,bytes32)": { - "details": "Beware that only the `newAuthorityHistoryPair` function with the `_salt` parameter is able to deterministically deploy an authority-history pair.", - "params": { - "_authorityOwner": "The initial authority owner", - "_salt": "The salt used to deterministically generate the authority-history address pair" - }, - "returns": { - "authorityAddress_": "The deterministic authority address", - "historyAddress_": "The deterministic history address" - } - }, - "constructor": { - "params": { - "_authorityFactory": "The `Authority` factory", - "_historyFactory": "The `History` factory" - } - }, - "getAuthorityFactory()": { - "returns": { - "_0": "The `Authority` factory" - } - }, - "getHistoryFactory()": { - "returns": { - "_0": "The `History` factory" - } - }, - "newAuthorityHistoryPair(address)": { - "params": { - "_authorityOwner": "The initial authority owner" - }, - "returns": { - "authority_": "The authority", - "history_": "The history" - } - }, - "newAuthorityHistoryPair(address,bytes32)": { - "params": { - "_authorityOwner": "The initial authority owner", - "_salt": "The salt used to deterministically generate the authority-history pair address" - }, - "returns": { - "authority_": "The authority", - "history_": "The history" - } - } - }, - "title": "Authority-History Pair Factory", - "version": 1 - }, - "userdoc": { - "events": { - "AuthorityHistoryPairFactoryCreated(address,address)": { - "notice": "The factory was created." - } - }, - "kind": "user", - "methods": { - "calculateAuthorityHistoryAddressPair(address,bytes32)": { - "notice": "Calculate the address of an authority-history pair to be deployed deterministically." - }, - "constructor": { - "notice": "Constructs the factory." - }, - "getAuthorityFactory()": { - "notice": "Get the factory used to deploy `Authority` contracts" - }, - "getHistoryFactory()": { - "notice": "Get the factory used to deploy `History` contracts" - }, - "newAuthorityHistoryPair(address)": { - "notice": "Deploy a new authority-history pair." - }, - "newAuthorityHistoryPair(address,bytes32)": { - "notice": "Deploy a new authority-history pair deterministically." - } - }, - "notice": "Allows anyone to reliably deploy a new Authority-History pair.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/onchain/rollups/deployments/arbitrum_goerli/AuthorityHistoryPairFactory.json b/onchain/rollups/deployments/arbitrum_goerli/AuthorityHistoryPairFactory.json deleted file mode 100644 index 683e9a7f..00000000 --- a/onchain/rollups/deployments/arbitrum_goerli/AuthorityHistoryPairFactory.json +++ /dev/null @@ -1,282 +0,0 @@ -{ - "address": "0x3890A047Cf9Af60731E80B2105362BbDCD70142D", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IAuthorityFactory", - "name": "_authorityFactory", - "type": "address" - }, - { - "internalType": "contract IHistoryFactory", - "name": "_historyFactory", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract IAuthorityFactory", - "name": "authorityFactory", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract IHistoryFactory", - "name": "historyFactory", - "type": "address" - } - ], - "name": "AuthorityHistoryPairFactoryCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateAuthorityHistoryAddressPair", - "outputs": [ - { - "internalType": "address", - "name": "authorityAddress_", - "type": "address" - }, - { - "internalType": "address", - "name": "historyAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getAuthorityFactory", - "outputs": [ - { - "internalType": "contract IAuthorityFactory", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getHistoryFactory", - "outputs": [ - { - "internalType": "contract IHistoryFactory", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - } - ], - "name": "newAuthorityHistoryPair", - "outputs": [ - { - "internalType": "contract Authority", - "name": "authority_", - "type": "address" - }, - { - "internalType": "contract History", - "name": "history_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newAuthorityHistoryPair", - "outputs": [ - { - "internalType": "contract Authority", - "name": "authority_", - "type": "address" - }, - { - "internalType": "contract History", - "name": "history_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0xa11205ec8b20098c6001fdb3c75cbee08dd437cb099217c5dee0d69025bcf626", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", - "contractAddress": null, - "transactionIndex": 1, - "gasUsed": "460288", - "logsBloom": "0x00000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000004000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x88b8f4569fa23088d41f5c64e124071954a663908b730a6a464faf6765376ae4", - "transactionHash": "0xa11205ec8b20098c6001fdb3c75cbee08dd437cb099217c5dee0d69025bcf626", - "logs": [ - { - "transactionIndex": 1, - "blockNumber": 45427561, - "transactionHash": "0xa11205ec8b20098c6001fdb3c75cbee08dd437cb099217c5dee0d69025bcf626", - "address": "0x3890A047Cf9Af60731E80B2105362BbDCD70142D", - "topics": [ - "0x030bcdc35fc24f8a53829b016647c842a9d981d1fed3783a7e282b6e6c9ea4a9" - ], - "data": "0x000000000000000000000000f26a5b278c25d8d41a136d22ad719eaced9c3e630000000000000000000000001f158b5320bbf677fda89f9a438df99bbe560a26", - "logIndex": 0, - "blockHash": "0x88b8f4569fa23088d41f5c64e124071954a663908b730a6a464faf6765376ae4" - } - ], - "blockNumber": 45427561, - "cumulativeGasUsed": "460288", - "status": 1, - "byzantium": true - }, - "args": [ - "0xf26a5b278C25D8D41A136d22Ad719EACEd9c3e63", - "0x1f158b5320BBf677FdA89F9a438df99BbE560A26" - ], - "numDeployments": 1, - "solcInputHash": "b1bc2a879218740e83dfbb7046a3cc8c", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IAuthorityFactory\",\"name\":\"_authorityFactory\",\"type\":\"address\"},{\"internalType\":\"contract IHistoryFactory\",\"name\":\"_historyFactory\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract IAuthorityFactory\",\"name\":\"authorityFactory\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract IHistoryFactory\",\"name\":\"historyFactory\",\"type\":\"address\"}],\"name\":\"AuthorityHistoryPairFactoryCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"calculateAuthorityHistoryAddressPair\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"authorityAddress_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"historyAddress_\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAuthorityFactory\",\"outputs\":[{\"internalType\":\"contract IAuthorityFactory\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getHistoryFactory\",\"outputs\":[{\"internalType\":\"contract IHistoryFactory\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"}],\"name\":\"newAuthorityHistoryPair\",\"outputs\":[{\"internalType\":\"contract Authority\",\"name\":\"authority_\",\"type\":\"address\"},{\"internalType\":\"contract History\",\"name\":\"history_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"newAuthorityHistoryPair\",\"outputs\":[{\"internalType\":\"contract Authority\",\"name\":\"authority_\",\"type\":\"address\"},{\"internalType\":\"contract History\",\"name\":\"history_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"AuthorityHistoryPairFactoryCreated(address,address)\":{\"details\":\"MUST be emitted on construction.\",\"params\":{\"authorityFactory\":\"The underlying `Authority` factory\",\"historyFactory\":\"The underlying `History` factory\"}}},\"kind\":\"dev\",\"methods\":{\"calculateAuthorityHistoryAddressPair(address,bytes32)\":{\"details\":\"Beware that only the `newAuthorityHistoryPair` function with the `_salt` parameter is able to deterministically deploy an authority-history pair.\",\"params\":{\"_authorityOwner\":\"The initial authority owner\",\"_salt\":\"The salt used to deterministically generate the authority-history address pair\"},\"returns\":{\"authorityAddress_\":\"The deterministic authority address\",\"historyAddress_\":\"The deterministic history address\"}},\"constructor\":{\"params\":{\"_authorityFactory\":\"The `Authority` factory\",\"_historyFactory\":\"The `History` factory\"}},\"getAuthorityFactory()\":{\"returns\":{\"_0\":\"The `Authority` factory\"}},\"getHistoryFactory()\":{\"returns\":{\"_0\":\"The `History` factory\"}},\"newAuthorityHistoryPair(address)\":{\"params\":{\"_authorityOwner\":\"The initial authority owner\"},\"returns\":{\"authority_\":\"The authority\",\"history_\":\"The history\"}},\"newAuthorityHistoryPair(address,bytes32)\":{\"params\":{\"_authorityOwner\":\"The initial authority owner\",\"_salt\":\"The salt used to deterministically generate the authority-history pair address\"},\"returns\":{\"authority_\":\"The authority\",\"history_\":\"The history\"}}},\"title\":\"Authority-History Pair Factory\",\"version\":1},\"userdoc\":{\"events\":{\"AuthorityHistoryPairFactoryCreated(address,address)\":{\"notice\":\"The factory was created.\"}},\"kind\":\"user\",\"methods\":{\"calculateAuthorityHistoryAddressPair(address,bytes32)\":{\"notice\":\"Calculate the address of an authority-history pair to be deployed deterministically.\"},\"constructor\":{\"notice\":\"Constructs the factory.\"},\"getAuthorityFactory()\":{\"notice\":\"Get the factory used to deploy `Authority` contracts\"},\"getHistoryFactory()\":{\"notice\":\"Get the factory used to deploy `History` contracts\"},\"newAuthorityHistoryPair(address)\":{\"notice\":\"Deploy a new authority-history pair.\"},\"newAuthorityHistoryPair(address,bytes32)\":{\"notice\":\"Deploy a new authority-history pair deterministically.\"}},\"notice\":\"Allows anyone to reliably deploy a new Authority-History pair.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/consensus/authority/AuthorityHistoryPairFactory.sol\":\"AuthorityHistoryPairFactory\"},\"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/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"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\"},\"contracts/consensus/AbstractConsensus.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 {IConsensus} from \\\"./IConsensus.sol\\\";\\n\\n/// @title Abstract Consensus\\n/// @notice An abstract contract that partially implements `IConsensus`.\\nabstract contract AbstractConsensus is IConsensus {\\n /// @notice Emits an `ApplicationJoined` event with the message sender.\\n function join() external override {\\n emit ApplicationJoined(msg.sender);\\n }\\n}\\n\",\"keccak256\":\"0xced9c940ccbbe81fbfcf3bc087c04b9ae90325d6bba68a8cee9ebfa3dd9d231d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/IConsensus.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 Consensus interface\\n///\\n/// @notice This contract defines a generic interface for consensuses.\\n/// We use the word \\\"consensus\\\" to designate a contract that provides claims\\n/// in the base layer regarding the state of off-chain machines running in\\n/// the execution layer. How this contract is able to reach consensus, who is\\n/// able to submit claims, and how are claims stored in the base layer are\\n/// some of the implementation details left unspecified by this interface.\\n///\\n/// From the point of view of a DApp, these claims are necessary to validate\\n/// on-chain action allowed by the off-chain machine in the form of vouchers\\n/// and notices. Each claim is composed of three parts: an epoch hash, a first\\n/// index, and a last index. We'll explain each of these parts below.\\n///\\n/// First, let us define the word \\\"epoch\\\". For finality reasons, we need to\\n/// divide the stream of inputs being fed into the off-chain machine into\\n/// batches of inputs, which we call \\\"epoches\\\". At the end of every epoch,\\n/// we summarize the state of the off-chain machine in a single hash, called\\n/// \\\"epoch hash\\\". Please note that this interface does not define how this\\n/// stream of inputs is being chopped up into epoches.\\n///\\n/// The other two parts are simply the indices of the first and last inputs\\n/// accepted during the epoch. Logically, the first index MUST BE less than\\n/// or equal to the last index. As a result, every epoch MUST accept at least\\n/// one input. This assumption stems from the fact that the state of a machine\\n/// can only change after an input is fed into it.\\n///\\n/// Examples of possible implementations of this interface include:\\n///\\n/// * An authority consensus, controlled by a single address who has full\\n/// control over epoch boundaries, claim submission, asset management, etc.\\n///\\n/// * A quorum consensus, controlled by a limited set of validators, that\\n/// vote on the state of the machine at the end of every epoch. Also, epoch\\n/// boundaries are determined by the timestamp in the base layer, and assets\\n/// are split equally amongst the validators.\\n///\\n/// * An NxN consensus, which allows anyone to submit and dispute claims\\n/// in the base layer. Epoch boundaries are determined in the same fashion\\n/// as in the quorum example.\\n///\\ninterface IConsensus {\\n /// @notice An application has joined the consensus' validation set.\\n /// @param application The application\\n /// @dev MUST be triggered on a successful call to `join`.\\n event ApplicationJoined(address application);\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// The encoding of `_proofContext` might vary\\n /// depending on the 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 /// @notice Signal the consensus that the message sender wants to join its validation set.\\n /// @dev MUST fire an `ApplicationJoined` event with the message sender as argument.\\n function join() external;\\n}\\n\",\"keccak256\":\"0xc9d295fada66eb0602e0f1e2e236708e52f959927abb4ab6b04173a98b92ac16\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/Authority.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\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {IConsensus} from \\\"../IConsensus.sol\\\";\\nimport {AbstractConsensus} from \\\"../AbstractConsensus.sol\\\";\\nimport {IHistory} from \\\"../../history/IHistory.sol\\\";\\n\\n/// @title Authority consensus\\n/// @notice A consensus model controlled by a single address, the owner.\\n/// Claims are stored in an auxiliary contract called `History`.\\n/// @dev This contract inherits `AbstractConsensus` and OpenZeppelin's `Ownable` contract.\\n/// For more information on `Ownable`, please consult OpenZeppelin's official documentation.\\ncontract Authority is AbstractConsensus, Ownable {\\n /// @notice The current history contract.\\n /// @dev See the `getHistory` and `setHistory` functions.\\n IHistory internal history;\\n\\n /// @notice A new history contract is used to store claims.\\n /// @param history The new history contract\\n /// @dev MUST be triggered on a successful call to `setHistory`.\\n event NewHistory(IHistory history);\\n\\n /// @notice Raised when a transfer of tokens from an authority to a recipient fails.\\n error AuthorityWithdrawalFailed();\\n\\n /// @notice Constructs an `Authority` contract.\\n /// @param _owner The initial contract 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 (msg.sender != _owner) {\\n transferOwnership(_owner);\\n }\\n }\\n\\n /// @notice Submits a claim to the current history contract.\\n /// The encoding of `_claimData` might vary depending on the\\n /// implementation of the current history contract.\\n /// @param _claimData Data for submitting a claim\\n /// @dev Can only be called by the `Authority` owner,\\n /// and the `Authority` contract must have ownership over\\n /// its current history contract.\\n function submitClaim(bytes calldata _claimData) external onlyOwner {\\n history.submitClaim(_claimData);\\n }\\n\\n /// @notice Transfer ownership over the current history contract to `_consensus`.\\n /// @param _consensus The new owner of the current history contract\\n /// @dev Can only be called by the `Authority` owner,\\n /// and the `Authority` contract must have ownership over\\n /// its current history contract.\\n function migrateHistoryToConsensus(address _consensus) external onlyOwner {\\n history.migrateToConsensus(_consensus);\\n }\\n\\n /// @notice Make `Authority` point to another history contract.\\n /// @param _history The new history contract\\n /// @dev Emits a `NewHistory` event.\\n /// Can only be called by the `Authority` owner.\\n function setHistory(IHistory _history) external onlyOwner {\\n history = _history;\\n emit NewHistory(_history);\\n }\\n\\n /// @notice Get the current history contract.\\n /// @return The current history contract\\n function getHistory() external view returns (IHistory) {\\n return history;\\n }\\n\\n /// @notice Get a claim from the current history.\\n /// The encoding of `_proofContext` might vary depending on the\\n /// implementation of the current history contract.\\n /// @inheritdoc IConsensus\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n ) external view override returns (bytes32, uint256, uint256) {\\n return history.getClaim(_dapp, _proofContext);\\n }\\n\\n /// @notice Transfer some amount of ERC-20 tokens to a recipient.\\n /// @param _token The token contract\\n /// @param _recipient The recipient address\\n /// @param _amount The amount of tokens to be withdrawn\\n /// @dev Can only be called by the `Authority` owner.\\n function withdrawERC20Tokens(\\n IERC20 _token,\\n address _recipient,\\n uint256 _amount\\n ) external onlyOwner {\\n bool success = _token.transfer(_recipient, _amount);\\n\\n if (!success) {\\n revert AuthorityWithdrawalFailed();\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc71ea13163833684ce576861fbb19dc40e7096a022c6976b61a99dfc9e1c0903\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/AuthorityHistoryPairFactory.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 {IAuthorityHistoryPairFactory} from \\\"./IAuthorityHistoryPairFactory.sol\\\";\\nimport {Authority} from \\\"./Authority.sol\\\";\\nimport {IAuthorityFactory} from \\\"./IAuthorityFactory.sol\\\";\\nimport {History} from \\\"../../history/History.sol\\\";\\nimport {IHistoryFactory} from \\\"../../history/IHistoryFactory.sol\\\";\\n\\n/// @title Authority-History Pair Factory\\n/// @notice Allows anyone to reliably deploy a new Authority-History pair.\\ncontract AuthorityHistoryPairFactory is IAuthorityHistoryPairFactory {\\n IAuthorityFactory immutable authorityFactory;\\n IHistoryFactory immutable historyFactory;\\n\\n /// @notice Constructs the factory.\\n /// @param _authorityFactory The `Authority` factory\\n /// @param _historyFactory The `History` factory\\n constructor(\\n IAuthorityFactory _authorityFactory,\\n IHistoryFactory _historyFactory\\n ) {\\n authorityFactory = _authorityFactory;\\n historyFactory = _historyFactory;\\n\\n emit AuthorityHistoryPairFactoryCreated(\\n _authorityFactory,\\n _historyFactory\\n );\\n }\\n\\n function getAuthorityFactory()\\n external\\n view\\n override\\n returns (IAuthorityFactory)\\n {\\n return authorityFactory;\\n }\\n\\n function getHistoryFactory()\\n external\\n view\\n override\\n returns (IHistoryFactory)\\n {\\n return historyFactory;\\n }\\n\\n function newAuthorityHistoryPair(\\n address _authorityOwner\\n ) external override returns (Authority authority_, History history_) {\\n authority_ = authorityFactory.newAuthority(address(this));\\n history_ = historyFactory.newHistory(address(authority_));\\n\\n authority_.setHistory(history_);\\n authority_.transferOwnership(_authorityOwner);\\n }\\n\\n function newAuthorityHistoryPair(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external override returns (Authority authority_, History history_) {\\n authority_ = authorityFactory.newAuthority(\\n address(this),\\n calculateCompoundSalt(_authorityOwner, _salt)\\n );\\n history_ = historyFactory.newHistory(address(authority_), _salt);\\n\\n authority_.setHistory(history_);\\n authority_.transferOwnership(_authorityOwner);\\n }\\n\\n function calculateAuthorityHistoryAddressPair(\\n address _authorityOwner,\\n bytes32 _salt\\n )\\n external\\n view\\n override\\n returns (address authorityAddress_, address historyAddress_)\\n {\\n authorityAddress_ = authorityFactory.calculateAuthorityAddress(\\n address(this),\\n calculateCompoundSalt(_authorityOwner, _salt)\\n );\\n\\n historyAddress_ = historyFactory.calculateHistoryAddress(\\n authorityAddress_,\\n _salt\\n );\\n }\\n\\n /// @notice Calculate the compound salt.\\n /// @param _authorityOwner authority owner\\n /// @param _salt salt\\n /// @return compound salt\\n /// @dev The purpose of calculating a compound salt is to\\n /// prevent attackers front-running the creation of an Authority\\n /// occupying the to-be-deployed address, but with a different owner.\\n function calculateCompoundSalt(\\n address _authorityOwner,\\n bytes32 _salt\\n ) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(_authorityOwner, _salt));\\n }\\n}\\n\",\"keccak256\":\"0x3ee10d66249cf837c51ba4fe082edb7cebf17466060c9fd405cba2861951690d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/IAuthorityFactory.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 {Authority} from \\\"./Authority.sol\\\";\\n\\n/// @title Authority Factory interface\\ninterface IAuthorityFactory {\\n // Events\\n\\n /// @notice A new authority was deployed.\\n /// @param authorityOwner The initial authority owner\\n /// @param authority The authority\\n /// @dev MUST be triggered on a successful call to `newAuthority`.\\n event AuthorityCreated(address authorityOwner, Authority authority);\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new authority.\\n /// @param _authorityOwner The initial authority owner\\n /// @return The authority\\n /// @dev On success, MUST emit an `AuthorityCreated` event.\\n function newAuthority(address _authorityOwner) external returns (Authority);\\n\\n /// @notice Deploy a new authority deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority address\\n /// @return The authority\\n /// @dev On success, MUST emit an `AuthorityCreated` event.\\n function newAuthority(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external returns (Authority);\\n\\n /// @notice Calculate the address of an authority to be deployed deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority address\\n /// @return The deterministic authority address\\n /// @dev Beware that only the `newAuthority` function with the `_salt` parameter\\n /// is able to deterministically deploy an authority.\\n function calculateAuthorityAddress(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x149bcdf9641b337836263196aabb655e69902212ede21becedd9c08b5b304717\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/IAuthorityHistoryPairFactory.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 {Authority} from \\\"./Authority.sol\\\";\\nimport {IAuthorityFactory} from \\\"./IAuthorityFactory.sol\\\";\\nimport {History} from \\\"../../history/History.sol\\\";\\nimport {IHistoryFactory} from \\\"../../history/IHistoryFactory.sol\\\";\\n\\n/// @title Authority-History Pair Factory interface\\ninterface IAuthorityHistoryPairFactory {\\n // Events\\n\\n /// @notice The factory was created.\\n /// @param authorityFactory The underlying `Authority` factory\\n /// @param historyFactory The underlying `History` factory\\n /// @dev MUST be emitted on construction.\\n event AuthorityHistoryPairFactoryCreated(\\n IAuthorityFactory authorityFactory,\\n IHistoryFactory historyFactory\\n );\\n\\n // Permissionless functions\\n\\n /// @notice Get the factory used to deploy `Authority` contracts\\n /// @return The `Authority` factory\\n function getAuthorityFactory() external view returns (IAuthorityFactory);\\n\\n /// @notice Get the factory used to deploy `History` contracts\\n /// @return The `History` factory\\n function getHistoryFactory() external view returns (IHistoryFactory);\\n\\n /// @notice Deploy a new authority-history pair.\\n /// @param _authorityOwner The initial authority owner\\n /// @return The authority\\n /// @return The history\\n function newAuthorityHistoryPair(\\n address _authorityOwner\\n ) external returns (Authority, History);\\n\\n /// @notice Deploy a new authority-history pair deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority-history pair address\\n /// @return The authority\\n /// @return The history\\n function newAuthorityHistoryPair(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external returns (Authority, History);\\n\\n /// @notice Calculate the address of an authority-history pair to be deployed deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority-history address pair\\n /// @return The deterministic authority address\\n /// @return The deterministic history address\\n /// @dev Beware that only the `newAuthorityHistoryPair` function with the `_salt` parameter\\n /// is able to deterministically deploy an authority-history pair.\\n function calculateAuthorityHistoryAddressPair(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external view returns (address, address);\\n}\\n\",\"keccak256\":\"0xd0e4b284ed461544e4d70c030900d0bb9a74c1eee14952c30e35856ce912fbb3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"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/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": "0x60c060405234801561001057600080fd5b5060405161086f38038061086f83398101604081905261002f916100a0565b6001600160a01b03828116608081905290821660a08190526040805192835260208301919091527f030bcdc35fc24f8a53829b016647c842a9d981d1fed3783a7e282b6e6c9ea4a9910160405180910390a150506100da565b6001600160a01b038116811461009d57600080fd5b50565b600080604083850312156100b357600080fd5b82516100be81610088565b60208401519092506100cf81610088565b809150509250929050565b60805160a0516107486101276000396000818160f6015281816101ec01528181610313015261051601526000818160960152818161011f01528181610284015261044601526107486000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c806339dcd4571461005c57806375689f8314610094578063b05cd1dc146100ce578063d73f347a146100e1578063f16b1a5c146100f4575b600080fd5b61006f61006a3660046106a5565b61011a565b604080516001600160a01b039384168152929091166020830152015b60405180910390f35b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b03909116815260200161008b565b61006f6100dc3660046106d1565b610262565b61006f6100ef3660046106a5565b610441565b7f00000000000000000000000000000000000000000000000000000000000000006100b6565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316629c5784306101568787610646565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381865afa15801561019f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c391906106f5565b60405163287ce2dd60e11b81526001600160a01b038083166004830152602482018690529193507f0000000000000000000000000000000000000000000000000000000000000000909116906350f9c5ba90604401602060405180830381865afa158015610235573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025991906106f5565b90509250929050565b604051632ce946e160e21b815230600482015260009081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063b3a51b84906024016020604051808303816000875af11580156102cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f191906106f5565b60405163446a4d3160e11b81526001600160a01b0380831660048301529193507f0000000000000000000000000000000000000000000000000000000000000000909116906388d49a62906024016020604051808303816000875af115801561035e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038291906106f5565b60405163159c5ea160e01b81526001600160a01b0380831660048301529192509083169063159c5ea190602401600060405180830381600087803b1580156103c957600080fd5b505af11580156103dd573d6000803e3d6000fd5b505060405163f2fde38b60e01b81526001600160a01b0386811660048301528516925063f2fde38b9150602401600060405180830381600087803b15801561042457600080fd5b505af1158015610438573d6000803e3d6000fd5b50505050915091565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635a3f27d33061047e8787610646565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156104c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ed91906106f5565b604051632ab8b11560e01b81526001600160a01b038083166004830152602482018690529193507f000000000000000000000000000000000000000000000000000000000000000090911690632ab8b115906044016020604051808303816000875af1158015610561573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058591906106f5565b60405163159c5ea160e01b81526001600160a01b0380831660048301529192509083169063159c5ea190602401600060405180830381600087803b1580156105cc57600080fd5b505af11580156105e0573d6000803e3d6000fd5b505060405163f2fde38b60e01b81526001600160a01b0387811660048301528516925063f2fde38b9150602401600060405180830381600087803b15801561062757600080fd5b505af115801561063b573d6000803e3d6000fd5b505050509250929050565b6040516bffffffffffffffffffffffff19606084901b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905092915050565b6001600160a01b03811681146106a257600080fd5b50565b600080604083850312156106b857600080fd5b82356106c38161068d565b946020939093013593505050565b6000602082840312156106e357600080fd5b81356106ee8161068d565b9392505050565b60006020828403121561070757600080fd5b81516106ee8161068d56fea2646970667358221220c9ff4c136426d9ba4f5c3e496e98c529a164caa845ab19e63e0cbefb6f48838664736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c806339dcd4571461005c57806375689f8314610094578063b05cd1dc146100ce578063d73f347a146100e1578063f16b1a5c146100f4575b600080fd5b61006f61006a3660046106a5565b61011a565b604080516001600160a01b039384168152929091166020830152015b60405180910390f35b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b03909116815260200161008b565b61006f6100dc3660046106d1565b610262565b61006f6100ef3660046106a5565b610441565b7f00000000000000000000000000000000000000000000000000000000000000006100b6565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316629c5784306101568787610646565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381865afa15801561019f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c391906106f5565b60405163287ce2dd60e11b81526001600160a01b038083166004830152602482018690529193507f0000000000000000000000000000000000000000000000000000000000000000909116906350f9c5ba90604401602060405180830381865afa158015610235573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025991906106f5565b90509250929050565b604051632ce946e160e21b815230600482015260009081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063b3a51b84906024016020604051808303816000875af11580156102cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f191906106f5565b60405163446a4d3160e11b81526001600160a01b0380831660048301529193507f0000000000000000000000000000000000000000000000000000000000000000909116906388d49a62906024016020604051808303816000875af115801561035e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038291906106f5565b60405163159c5ea160e01b81526001600160a01b0380831660048301529192509083169063159c5ea190602401600060405180830381600087803b1580156103c957600080fd5b505af11580156103dd573d6000803e3d6000fd5b505060405163f2fde38b60e01b81526001600160a01b0386811660048301528516925063f2fde38b9150602401600060405180830381600087803b15801561042457600080fd5b505af1158015610438573d6000803e3d6000fd5b50505050915091565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635a3f27d33061047e8787610646565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156104c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ed91906106f5565b604051632ab8b11560e01b81526001600160a01b038083166004830152602482018690529193507f000000000000000000000000000000000000000000000000000000000000000090911690632ab8b115906044016020604051808303816000875af1158015610561573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058591906106f5565b60405163159c5ea160e01b81526001600160a01b0380831660048301529192509083169063159c5ea190602401600060405180830381600087803b1580156105cc57600080fd5b505af11580156105e0573d6000803e3d6000fd5b505060405163f2fde38b60e01b81526001600160a01b0387811660048301528516925063f2fde38b9150602401600060405180830381600087803b15801561062757600080fd5b505af115801561063b573d6000803e3d6000fd5b505050509250929050565b6040516bffffffffffffffffffffffff19606084901b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905092915050565b6001600160a01b03811681146106a257600080fd5b50565b600080604083850312156106b857600080fd5b82356106c38161068d565b946020939093013593505050565b6000602082840312156106e357600080fd5b81356106ee8161068d565b9392505050565b60006020828403121561070757600080fd5b81516106ee8161068d56fea2646970667358221220c9ff4c136426d9ba4f5c3e496e98c529a164caa845ab19e63e0cbefb6f48838664736f6c63430008130033", - "devdoc": { - "events": { - "AuthorityHistoryPairFactoryCreated(address,address)": { - "details": "MUST be emitted on construction.", - "params": { - "authorityFactory": "The underlying `Authority` factory", - "historyFactory": "The underlying `History` factory" - } - } - }, - "kind": "dev", - "methods": { - "calculateAuthorityHistoryAddressPair(address,bytes32)": { - "details": "Beware that only the `newAuthorityHistoryPair` function with the `_salt` parameter is able to deterministically deploy an authority-history pair.", - "params": { - "_authorityOwner": "The initial authority owner", - "_salt": "The salt used to deterministically generate the authority-history address pair" - }, - "returns": { - "authorityAddress_": "The deterministic authority address", - "historyAddress_": "The deterministic history address" - } - }, - "constructor": { - "params": { - "_authorityFactory": "The `Authority` factory", - "_historyFactory": "The `History` factory" - } - }, - "getAuthorityFactory()": { - "returns": { - "_0": "The `Authority` factory" - } - }, - "getHistoryFactory()": { - "returns": { - "_0": "The `History` factory" - } - }, - "newAuthorityHistoryPair(address)": { - "params": { - "_authorityOwner": "The initial authority owner" - }, - "returns": { - "authority_": "The authority", - "history_": "The history" - } - }, - "newAuthorityHistoryPair(address,bytes32)": { - "params": { - "_authorityOwner": "The initial authority owner", - "_salt": "The salt used to deterministically generate the authority-history pair address" - }, - "returns": { - "authority_": "The authority", - "history_": "The history" - } - } - }, - "title": "Authority-History Pair Factory", - "version": 1 - }, - "userdoc": { - "events": { - "AuthorityHistoryPairFactoryCreated(address,address)": { - "notice": "The factory was created." - } - }, - "kind": "user", - "methods": { - "calculateAuthorityHistoryAddressPair(address,bytes32)": { - "notice": "Calculate the address of an authority-history pair to be deployed deterministically." - }, - "constructor": { - "notice": "Constructs the factory." - }, - "getAuthorityFactory()": { - "notice": "Get the factory used to deploy `Authority` contracts" - }, - "getHistoryFactory()": { - "notice": "Get the factory used to deploy `History` contracts" - }, - "newAuthorityHistoryPair(address)": { - "notice": "Deploy a new authority-history pair." - }, - "newAuthorityHistoryPair(address,bytes32)": { - "notice": "Deploy a new authority-history pair deterministically." - } - }, - "notice": "Allows anyone to reliably deploy a new Authority-History pair.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/onchain/rollups/deployments/mainnet/AuthorityHistoryPairFactory.json b/onchain/rollups/deployments/mainnet/AuthorityHistoryPairFactory.json deleted file mode 100644 index cbd8cc67..00000000 --- a/onchain/rollups/deployments/mainnet/AuthorityHistoryPairFactory.json +++ /dev/null @@ -1,282 +0,0 @@ -{ - "address": "0x3890A047Cf9Af60731E80B2105362BbDCD70142D", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IAuthorityFactory", - "name": "_authorityFactory", - "type": "address" - }, - { - "internalType": "contract IHistoryFactory", - "name": "_historyFactory", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract IAuthorityFactory", - "name": "authorityFactory", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract IHistoryFactory", - "name": "historyFactory", - "type": "address" - } - ], - "name": "AuthorityHistoryPairFactoryCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateAuthorityHistoryAddressPair", - "outputs": [ - { - "internalType": "address", - "name": "authorityAddress_", - "type": "address" - }, - { - "internalType": "address", - "name": "historyAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getAuthorityFactory", - "outputs": [ - { - "internalType": "contract IAuthorityFactory", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getHistoryFactory", - "outputs": [ - { - "internalType": "contract IHistoryFactory", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - } - ], - "name": "newAuthorityHistoryPair", - "outputs": [ - { - "internalType": "contract Authority", - "name": "authority_", - "type": "address" - }, - { - "internalType": "contract History", - "name": "history_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newAuthorityHistoryPair", - "outputs": [ - { - "internalType": "contract Authority", - "name": "authority_", - "type": "address" - }, - { - "internalType": "contract History", - "name": "history_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0xe3e75cad0015970afaaa29c241fd32ea02a32fb8662f01ac6111e350ab17bd30", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 113, - "gasUsed": "460428", - "logsBloom": "0x00000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000004000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x42d36b5a9a58d9fa18f915b9ccb847a3de6fb3e198055aa5eae393ebac819227", - "transactionHash": "0xe3e75cad0015970afaaa29c241fd32ea02a32fb8662f01ac6111e350ab17bd30", - "logs": [ - { - "transactionIndex": 113, - "blockNumber": 18277839, - "transactionHash": "0xe3e75cad0015970afaaa29c241fd32ea02a32fb8662f01ac6111e350ab17bd30", - "address": "0x3890A047Cf9Af60731E80B2105362BbDCD70142D", - "topics": [ - "0x030bcdc35fc24f8a53829b016647c842a9d981d1fed3783a7e282b6e6c9ea4a9" - ], - "data": "0x000000000000000000000000f26a5b278c25d8d41a136d22ad719eaced9c3e630000000000000000000000001f158b5320bbf677fda89f9a438df99bbe560a26", - "logIndex": 86, - "blockHash": "0x42d36b5a9a58d9fa18f915b9ccb847a3de6fb3e198055aa5eae393ebac819227" - } - ], - "blockNumber": 18277839, - "cumulativeGasUsed": "6932923", - "status": 1, - "byzantium": true - }, - "args": [ - "0xf26a5b278C25D8D41A136d22Ad719EACEd9c3e63", - "0x1f158b5320BBf677FdA89F9a438df99BbE560A26" - ], - "numDeployments": 1, - "solcInputHash": "b1bc2a879218740e83dfbb7046a3cc8c", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IAuthorityFactory\",\"name\":\"_authorityFactory\",\"type\":\"address\"},{\"internalType\":\"contract IHistoryFactory\",\"name\":\"_historyFactory\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract IAuthorityFactory\",\"name\":\"authorityFactory\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract IHistoryFactory\",\"name\":\"historyFactory\",\"type\":\"address\"}],\"name\":\"AuthorityHistoryPairFactoryCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"calculateAuthorityHistoryAddressPair\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"authorityAddress_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"historyAddress_\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAuthorityFactory\",\"outputs\":[{\"internalType\":\"contract IAuthorityFactory\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getHistoryFactory\",\"outputs\":[{\"internalType\":\"contract IHistoryFactory\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"}],\"name\":\"newAuthorityHistoryPair\",\"outputs\":[{\"internalType\":\"contract Authority\",\"name\":\"authority_\",\"type\":\"address\"},{\"internalType\":\"contract History\",\"name\":\"history_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"newAuthorityHistoryPair\",\"outputs\":[{\"internalType\":\"contract Authority\",\"name\":\"authority_\",\"type\":\"address\"},{\"internalType\":\"contract History\",\"name\":\"history_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"AuthorityHistoryPairFactoryCreated(address,address)\":{\"details\":\"MUST be emitted on construction.\",\"params\":{\"authorityFactory\":\"The underlying `Authority` factory\",\"historyFactory\":\"The underlying `History` factory\"}}},\"kind\":\"dev\",\"methods\":{\"calculateAuthorityHistoryAddressPair(address,bytes32)\":{\"details\":\"Beware that only the `newAuthorityHistoryPair` function with the `_salt` parameter is able to deterministically deploy an authority-history pair.\",\"params\":{\"_authorityOwner\":\"The initial authority owner\",\"_salt\":\"The salt used to deterministically generate the authority-history address pair\"},\"returns\":{\"authorityAddress_\":\"The deterministic authority address\",\"historyAddress_\":\"The deterministic history address\"}},\"constructor\":{\"params\":{\"_authorityFactory\":\"The `Authority` factory\",\"_historyFactory\":\"The `History` factory\"}},\"getAuthorityFactory()\":{\"returns\":{\"_0\":\"The `Authority` factory\"}},\"getHistoryFactory()\":{\"returns\":{\"_0\":\"The `History` factory\"}},\"newAuthorityHistoryPair(address)\":{\"params\":{\"_authorityOwner\":\"The initial authority owner\"},\"returns\":{\"authority_\":\"The authority\",\"history_\":\"The history\"}},\"newAuthorityHistoryPair(address,bytes32)\":{\"params\":{\"_authorityOwner\":\"The initial authority owner\",\"_salt\":\"The salt used to deterministically generate the authority-history pair address\"},\"returns\":{\"authority_\":\"The authority\",\"history_\":\"The history\"}}},\"title\":\"Authority-History Pair Factory\",\"version\":1},\"userdoc\":{\"events\":{\"AuthorityHistoryPairFactoryCreated(address,address)\":{\"notice\":\"The factory was created.\"}},\"kind\":\"user\",\"methods\":{\"calculateAuthorityHistoryAddressPair(address,bytes32)\":{\"notice\":\"Calculate the address of an authority-history pair to be deployed deterministically.\"},\"constructor\":{\"notice\":\"Constructs the factory.\"},\"getAuthorityFactory()\":{\"notice\":\"Get the factory used to deploy `Authority` contracts\"},\"getHistoryFactory()\":{\"notice\":\"Get the factory used to deploy `History` contracts\"},\"newAuthorityHistoryPair(address)\":{\"notice\":\"Deploy a new authority-history pair.\"},\"newAuthorityHistoryPair(address,bytes32)\":{\"notice\":\"Deploy a new authority-history pair deterministically.\"}},\"notice\":\"Allows anyone to reliably deploy a new Authority-History pair.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/consensus/authority/AuthorityHistoryPairFactory.sol\":\"AuthorityHistoryPairFactory\"},\"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/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"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\"},\"contracts/consensus/AbstractConsensus.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 {IConsensus} from \\\"./IConsensus.sol\\\";\\n\\n/// @title Abstract Consensus\\n/// @notice An abstract contract that partially implements `IConsensus`.\\nabstract contract AbstractConsensus is IConsensus {\\n /// @notice Emits an `ApplicationJoined` event with the message sender.\\n function join() external override {\\n emit ApplicationJoined(msg.sender);\\n }\\n}\\n\",\"keccak256\":\"0xced9c940ccbbe81fbfcf3bc087c04b9ae90325d6bba68a8cee9ebfa3dd9d231d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/IConsensus.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 Consensus interface\\n///\\n/// @notice This contract defines a generic interface for consensuses.\\n/// We use the word \\\"consensus\\\" to designate a contract that provides claims\\n/// in the base layer regarding the state of off-chain machines running in\\n/// the execution layer. How this contract is able to reach consensus, who is\\n/// able to submit claims, and how are claims stored in the base layer are\\n/// some of the implementation details left unspecified by this interface.\\n///\\n/// From the point of view of a DApp, these claims are necessary to validate\\n/// on-chain action allowed by the off-chain machine in the form of vouchers\\n/// and notices. Each claim is composed of three parts: an epoch hash, a first\\n/// index, and a last index. We'll explain each of these parts below.\\n///\\n/// First, let us define the word \\\"epoch\\\". For finality reasons, we need to\\n/// divide the stream of inputs being fed into the off-chain machine into\\n/// batches of inputs, which we call \\\"epoches\\\". At the end of every epoch,\\n/// we summarize the state of the off-chain machine in a single hash, called\\n/// \\\"epoch hash\\\". Please note that this interface does not define how this\\n/// stream of inputs is being chopped up into epoches.\\n///\\n/// The other two parts are simply the indices of the first and last inputs\\n/// accepted during the epoch. Logically, the first index MUST BE less than\\n/// or equal to the last index. As a result, every epoch MUST accept at least\\n/// one input. This assumption stems from the fact that the state of a machine\\n/// can only change after an input is fed into it.\\n///\\n/// Examples of possible implementations of this interface include:\\n///\\n/// * An authority consensus, controlled by a single address who has full\\n/// control over epoch boundaries, claim submission, asset management, etc.\\n///\\n/// * A quorum consensus, controlled by a limited set of validators, that\\n/// vote on the state of the machine at the end of every epoch. Also, epoch\\n/// boundaries are determined by the timestamp in the base layer, and assets\\n/// are split equally amongst the validators.\\n///\\n/// * An NxN consensus, which allows anyone to submit and dispute claims\\n/// in the base layer. Epoch boundaries are determined in the same fashion\\n/// as in the quorum example.\\n///\\ninterface IConsensus {\\n /// @notice An application has joined the consensus' validation set.\\n /// @param application The application\\n /// @dev MUST be triggered on a successful call to `join`.\\n event ApplicationJoined(address application);\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// The encoding of `_proofContext` might vary\\n /// depending on the 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 /// @notice Signal the consensus that the message sender wants to join its validation set.\\n /// @dev MUST fire an `ApplicationJoined` event with the message sender as argument.\\n function join() external;\\n}\\n\",\"keccak256\":\"0xc9d295fada66eb0602e0f1e2e236708e52f959927abb4ab6b04173a98b92ac16\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/Authority.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\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {IConsensus} from \\\"../IConsensus.sol\\\";\\nimport {AbstractConsensus} from \\\"../AbstractConsensus.sol\\\";\\nimport {IHistory} from \\\"../../history/IHistory.sol\\\";\\n\\n/// @title Authority consensus\\n/// @notice A consensus model controlled by a single address, the owner.\\n/// Claims are stored in an auxiliary contract called `History`.\\n/// @dev This contract inherits `AbstractConsensus` and OpenZeppelin's `Ownable` contract.\\n/// For more information on `Ownable`, please consult OpenZeppelin's official documentation.\\ncontract Authority is AbstractConsensus, Ownable {\\n /// @notice The current history contract.\\n /// @dev See the `getHistory` and `setHistory` functions.\\n IHistory internal history;\\n\\n /// @notice A new history contract is used to store claims.\\n /// @param history The new history contract\\n /// @dev MUST be triggered on a successful call to `setHistory`.\\n event NewHistory(IHistory history);\\n\\n /// @notice Raised when a transfer of tokens from an authority to a recipient fails.\\n error AuthorityWithdrawalFailed();\\n\\n /// @notice Constructs an `Authority` contract.\\n /// @param _owner The initial contract 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 (msg.sender != _owner) {\\n transferOwnership(_owner);\\n }\\n }\\n\\n /// @notice Submits a claim to the current history contract.\\n /// The encoding of `_claimData` might vary depending on the\\n /// implementation of the current history contract.\\n /// @param _claimData Data for submitting a claim\\n /// @dev Can only be called by the `Authority` owner,\\n /// and the `Authority` contract must have ownership over\\n /// its current history contract.\\n function submitClaim(bytes calldata _claimData) external onlyOwner {\\n history.submitClaim(_claimData);\\n }\\n\\n /// @notice Transfer ownership over the current history contract to `_consensus`.\\n /// @param _consensus The new owner of the current history contract\\n /// @dev Can only be called by the `Authority` owner,\\n /// and the `Authority` contract must have ownership over\\n /// its current history contract.\\n function migrateHistoryToConsensus(address _consensus) external onlyOwner {\\n history.migrateToConsensus(_consensus);\\n }\\n\\n /// @notice Make `Authority` point to another history contract.\\n /// @param _history The new history contract\\n /// @dev Emits a `NewHistory` event.\\n /// Can only be called by the `Authority` owner.\\n function setHistory(IHistory _history) external onlyOwner {\\n history = _history;\\n emit NewHistory(_history);\\n }\\n\\n /// @notice Get the current history contract.\\n /// @return The current history contract\\n function getHistory() external view returns (IHistory) {\\n return history;\\n }\\n\\n /// @notice Get a claim from the current history.\\n /// The encoding of `_proofContext` might vary depending on the\\n /// implementation of the current history contract.\\n /// @inheritdoc IConsensus\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n ) external view override returns (bytes32, uint256, uint256) {\\n return history.getClaim(_dapp, _proofContext);\\n }\\n\\n /// @notice Transfer some amount of ERC-20 tokens to a recipient.\\n /// @param _token The token contract\\n /// @param _recipient The recipient address\\n /// @param _amount The amount of tokens to be withdrawn\\n /// @dev Can only be called by the `Authority` owner.\\n function withdrawERC20Tokens(\\n IERC20 _token,\\n address _recipient,\\n uint256 _amount\\n ) external onlyOwner {\\n bool success = _token.transfer(_recipient, _amount);\\n\\n if (!success) {\\n revert AuthorityWithdrawalFailed();\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc71ea13163833684ce576861fbb19dc40e7096a022c6976b61a99dfc9e1c0903\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/AuthorityHistoryPairFactory.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 {IAuthorityHistoryPairFactory} from \\\"./IAuthorityHistoryPairFactory.sol\\\";\\nimport {Authority} from \\\"./Authority.sol\\\";\\nimport {IAuthorityFactory} from \\\"./IAuthorityFactory.sol\\\";\\nimport {History} from \\\"../../history/History.sol\\\";\\nimport {IHistoryFactory} from \\\"../../history/IHistoryFactory.sol\\\";\\n\\n/// @title Authority-History Pair Factory\\n/// @notice Allows anyone to reliably deploy a new Authority-History pair.\\ncontract AuthorityHistoryPairFactory is IAuthorityHistoryPairFactory {\\n IAuthorityFactory immutable authorityFactory;\\n IHistoryFactory immutable historyFactory;\\n\\n /// @notice Constructs the factory.\\n /// @param _authorityFactory The `Authority` factory\\n /// @param _historyFactory The `History` factory\\n constructor(\\n IAuthorityFactory _authorityFactory,\\n IHistoryFactory _historyFactory\\n ) {\\n authorityFactory = _authorityFactory;\\n historyFactory = _historyFactory;\\n\\n emit AuthorityHistoryPairFactoryCreated(\\n _authorityFactory,\\n _historyFactory\\n );\\n }\\n\\n function getAuthorityFactory()\\n external\\n view\\n override\\n returns (IAuthorityFactory)\\n {\\n return authorityFactory;\\n }\\n\\n function getHistoryFactory()\\n external\\n view\\n override\\n returns (IHistoryFactory)\\n {\\n return historyFactory;\\n }\\n\\n function newAuthorityHistoryPair(\\n address _authorityOwner\\n ) external override returns (Authority authority_, History history_) {\\n authority_ = authorityFactory.newAuthority(address(this));\\n history_ = historyFactory.newHistory(address(authority_));\\n\\n authority_.setHistory(history_);\\n authority_.transferOwnership(_authorityOwner);\\n }\\n\\n function newAuthorityHistoryPair(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external override returns (Authority authority_, History history_) {\\n authority_ = authorityFactory.newAuthority(\\n address(this),\\n calculateCompoundSalt(_authorityOwner, _salt)\\n );\\n history_ = historyFactory.newHistory(address(authority_), _salt);\\n\\n authority_.setHistory(history_);\\n authority_.transferOwnership(_authorityOwner);\\n }\\n\\n function calculateAuthorityHistoryAddressPair(\\n address _authorityOwner,\\n bytes32 _salt\\n )\\n external\\n view\\n override\\n returns (address authorityAddress_, address historyAddress_)\\n {\\n authorityAddress_ = authorityFactory.calculateAuthorityAddress(\\n address(this),\\n calculateCompoundSalt(_authorityOwner, _salt)\\n );\\n\\n historyAddress_ = historyFactory.calculateHistoryAddress(\\n authorityAddress_,\\n _salt\\n );\\n }\\n\\n /// @notice Calculate the compound salt.\\n /// @param _authorityOwner authority owner\\n /// @param _salt salt\\n /// @return compound salt\\n /// @dev The purpose of calculating a compound salt is to\\n /// prevent attackers front-running the creation of an Authority\\n /// occupying the to-be-deployed address, but with a different owner.\\n function calculateCompoundSalt(\\n address _authorityOwner,\\n bytes32 _salt\\n ) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(_authorityOwner, _salt));\\n }\\n}\\n\",\"keccak256\":\"0x3ee10d66249cf837c51ba4fe082edb7cebf17466060c9fd405cba2861951690d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/IAuthorityFactory.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 {Authority} from \\\"./Authority.sol\\\";\\n\\n/// @title Authority Factory interface\\ninterface IAuthorityFactory {\\n // Events\\n\\n /// @notice A new authority was deployed.\\n /// @param authorityOwner The initial authority owner\\n /// @param authority The authority\\n /// @dev MUST be triggered on a successful call to `newAuthority`.\\n event AuthorityCreated(address authorityOwner, Authority authority);\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new authority.\\n /// @param _authorityOwner The initial authority owner\\n /// @return The authority\\n /// @dev On success, MUST emit an `AuthorityCreated` event.\\n function newAuthority(address _authorityOwner) external returns (Authority);\\n\\n /// @notice Deploy a new authority deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority address\\n /// @return The authority\\n /// @dev On success, MUST emit an `AuthorityCreated` event.\\n function newAuthority(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external returns (Authority);\\n\\n /// @notice Calculate the address of an authority to be deployed deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority address\\n /// @return The deterministic authority address\\n /// @dev Beware that only the `newAuthority` function with the `_salt` parameter\\n /// is able to deterministically deploy an authority.\\n function calculateAuthorityAddress(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x149bcdf9641b337836263196aabb655e69902212ede21becedd9c08b5b304717\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/IAuthorityHistoryPairFactory.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 {Authority} from \\\"./Authority.sol\\\";\\nimport {IAuthorityFactory} from \\\"./IAuthorityFactory.sol\\\";\\nimport {History} from \\\"../../history/History.sol\\\";\\nimport {IHistoryFactory} from \\\"../../history/IHistoryFactory.sol\\\";\\n\\n/// @title Authority-History Pair Factory interface\\ninterface IAuthorityHistoryPairFactory {\\n // Events\\n\\n /// @notice The factory was created.\\n /// @param authorityFactory The underlying `Authority` factory\\n /// @param historyFactory The underlying `History` factory\\n /// @dev MUST be emitted on construction.\\n event AuthorityHistoryPairFactoryCreated(\\n IAuthorityFactory authorityFactory,\\n IHistoryFactory historyFactory\\n );\\n\\n // Permissionless functions\\n\\n /// @notice Get the factory used to deploy `Authority` contracts\\n /// @return The `Authority` factory\\n function getAuthorityFactory() external view returns (IAuthorityFactory);\\n\\n /// @notice Get the factory used to deploy `History` contracts\\n /// @return The `History` factory\\n function getHistoryFactory() external view returns (IHistoryFactory);\\n\\n /// @notice Deploy a new authority-history pair.\\n /// @param _authorityOwner The initial authority owner\\n /// @return The authority\\n /// @return The history\\n function newAuthorityHistoryPair(\\n address _authorityOwner\\n ) external returns (Authority, History);\\n\\n /// @notice Deploy a new authority-history pair deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority-history pair address\\n /// @return The authority\\n /// @return The history\\n function newAuthorityHistoryPair(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external returns (Authority, History);\\n\\n /// @notice Calculate the address of an authority-history pair to be deployed deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority-history address pair\\n /// @return The deterministic authority address\\n /// @return The deterministic history address\\n /// @dev Beware that only the `newAuthorityHistoryPair` function with the `_salt` parameter\\n /// is able to deterministically deploy an authority-history pair.\\n function calculateAuthorityHistoryAddressPair(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external view returns (address, address);\\n}\\n\",\"keccak256\":\"0xd0e4b284ed461544e4d70c030900d0bb9a74c1eee14952c30e35856ce912fbb3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"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/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": "0x60c060405234801561001057600080fd5b5060405161086f38038061086f83398101604081905261002f916100a0565b6001600160a01b03828116608081905290821660a08190526040805192835260208301919091527f030bcdc35fc24f8a53829b016647c842a9d981d1fed3783a7e282b6e6c9ea4a9910160405180910390a150506100da565b6001600160a01b038116811461009d57600080fd5b50565b600080604083850312156100b357600080fd5b82516100be81610088565b60208401519092506100cf81610088565b809150509250929050565b60805160a0516107486101276000396000818160f6015281816101ec01528181610313015261051601526000818160960152818161011f01528181610284015261044601526107486000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c806339dcd4571461005c57806375689f8314610094578063b05cd1dc146100ce578063d73f347a146100e1578063f16b1a5c146100f4575b600080fd5b61006f61006a3660046106a5565b61011a565b604080516001600160a01b039384168152929091166020830152015b60405180910390f35b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b03909116815260200161008b565b61006f6100dc3660046106d1565b610262565b61006f6100ef3660046106a5565b610441565b7f00000000000000000000000000000000000000000000000000000000000000006100b6565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316629c5784306101568787610646565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381865afa15801561019f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c391906106f5565b60405163287ce2dd60e11b81526001600160a01b038083166004830152602482018690529193507f0000000000000000000000000000000000000000000000000000000000000000909116906350f9c5ba90604401602060405180830381865afa158015610235573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025991906106f5565b90509250929050565b604051632ce946e160e21b815230600482015260009081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063b3a51b84906024016020604051808303816000875af11580156102cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f191906106f5565b60405163446a4d3160e11b81526001600160a01b0380831660048301529193507f0000000000000000000000000000000000000000000000000000000000000000909116906388d49a62906024016020604051808303816000875af115801561035e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038291906106f5565b60405163159c5ea160e01b81526001600160a01b0380831660048301529192509083169063159c5ea190602401600060405180830381600087803b1580156103c957600080fd5b505af11580156103dd573d6000803e3d6000fd5b505060405163f2fde38b60e01b81526001600160a01b0386811660048301528516925063f2fde38b9150602401600060405180830381600087803b15801561042457600080fd5b505af1158015610438573d6000803e3d6000fd5b50505050915091565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635a3f27d33061047e8787610646565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156104c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ed91906106f5565b604051632ab8b11560e01b81526001600160a01b038083166004830152602482018690529193507f000000000000000000000000000000000000000000000000000000000000000090911690632ab8b115906044016020604051808303816000875af1158015610561573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058591906106f5565b60405163159c5ea160e01b81526001600160a01b0380831660048301529192509083169063159c5ea190602401600060405180830381600087803b1580156105cc57600080fd5b505af11580156105e0573d6000803e3d6000fd5b505060405163f2fde38b60e01b81526001600160a01b0387811660048301528516925063f2fde38b9150602401600060405180830381600087803b15801561062757600080fd5b505af115801561063b573d6000803e3d6000fd5b505050509250929050565b6040516bffffffffffffffffffffffff19606084901b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905092915050565b6001600160a01b03811681146106a257600080fd5b50565b600080604083850312156106b857600080fd5b82356106c38161068d565b946020939093013593505050565b6000602082840312156106e357600080fd5b81356106ee8161068d565b9392505050565b60006020828403121561070757600080fd5b81516106ee8161068d56fea2646970667358221220c9ff4c136426d9ba4f5c3e496e98c529a164caa845ab19e63e0cbefb6f48838664736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c806339dcd4571461005c57806375689f8314610094578063b05cd1dc146100ce578063d73f347a146100e1578063f16b1a5c146100f4575b600080fd5b61006f61006a3660046106a5565b61011a565b604080516001600160a01b039384168152929091166020830152015b60405180910390f35b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b03909116815260200161008b565b61006f6100dc3660046106d1565b610262565b61006f6100ef3660046106a5565b610441565b7f00000000000000000000000000000000000000000000000000000000000000006100b6565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316629c5784306101568787610646565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381865afa15801561019f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c391906106f5565b60405163287ce2dd60e11b81526001600160a01b038083166004830152602482018690529193507f0000000000000000000000000000000000000000000000000000000000000000909116906350f9c5ba90604401602060405180830381865afa158015610235573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025991906106f5565b90509250929050565b604051632ce946e160e21b815230600482015260009081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063b3a51b84906024016020604051808303816000875af11580156102cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f191906106f5565b60405163446a4d3160e11b81526001600160a01b0380831660048301529193507f0000000000000000000000000000000000000000000000000000000000000000909116906388d49a62906024016020604051808303816000875af115801561035e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038291906106f5565b60405163159c5ea160e01b81526001600160a01b0380831660048301529192509083169063159c5ea190602401600060405180830381600087803b1580156103c957600080fd5b505af11580156103dd573d6000803e3d6000fd5b505060405163f2fde38b60e01b81526001600160a01b0386811660048301528516925063f2fde38b9150602401600060405180830381600087803b15801561042457600080fd5b505af1158015610438573d6000803e3d6000fd5b50505050915091565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635a3f27d33061047e8787610646565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156104c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ed91906106f5565b604051632ab8b11560e01b81526001600160a01b038083166004830152602482018690529193507f000000000000000000000000000000000000000000000000000000000000000090911690632ab8b115906044016020604051808303816000875af1158015610561573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058591906106f5565b60405163159c5ea160e01b81526001600160a01b0380831660048301529192509083169063159c5ea190602401600060405180830381600087803b1580156105cc57600080fd5b505af11580156105e0573d6000803e3d6000fd5b505060405163f2fde38b60e01b81526001600160a01b0387811660048301528516925063f2fde38b9150602401600060405180830381600087803b15801561062757600080fd5b505af115801561063b573d6000803e3d6000fd5b505050509250929050565b6040516bffffffffffffffffffffffff19606084901b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905092915050565b6001600160a01b03811681146106a257600080fd5b50565b600080604083850312156106b857600080fd5b82356106c38161068d565b946020939093013593505050565b6000602082840312156106e357600080fd5b81356106ee8161068d565b9392505050565b60006020828403121561070757600080fd5b81516106ee8161068d56fea2646970667358221220c9ff4c136426d9ba4f5c3e496e98c529a164caa845ab19e63e0cbefb6f48838664736f6c63430008130033", - "devdoc": { - "events": { - "AuthorityHistoryPairFactoryCreated(address,address)": { - "details": "MUST be emitted on construction.", - "params": { - "authorityFactory": "The underlying `Authority` factory", - "historyFactory": "The underlying `History` factory" - } - } - }, - "kind": "dev", - "methods": { - "calculateAuthorityHistoryAddressPair(address,bytes32)": { - "details": "Beware that only the `newAuthorityHistoryPair` function with the `_salt` parameter is able to deterministically deploy an authority-history pair.", - "params": { - "_authorityOwner": "The initial authority owner", - "_salt": "The salt used to deterministically generate the authority-history address pair" - }, - "returns": { - "authorityAddress_": "The deterministic authority address", - "historyAddress_": "The deterministic history address" - } - }, - "constructor": { - "params": { - "_authorityFactory": "The `Authority` factory", - "_historyFactory": "The `History` factory" - } - }, - "getAuthorityFactory()": { - "returns": { - "_0": "The `Authority` factory" - } - }, - "getHistoryFactory()": { - "returns": { - "_0": "The `History` factory" - } - }, - "newAuthorityHistoryPair(address)": { - "params": { - "_authorityOwner": "The initial authority owner" - }, - "returns": { - "authority_": "The authority", - "history_": "The history" - } - }, - "newAuthorityHistoryPair(address,bytes32)": { - "params": { - "_authorityOwner": "The initial authority owner", - "_salt": "The salt used to deterministically generate the authority-history pair address" - }, - "returns": { - "authority_": "The authority", - "history_": "The history" - } - } - }, - "title": "Authority-History Pair Factory", - "version": 1 - }, - "userdoc": { - "events": { - "AuthorityHistoryPairFactoryCreated(address,address)": { - "notice": "The factory was created." - } - }, - "kind": "user", - "methods": { - "calculateAuthorityHistoryAddressPair(address,bytes32)": { - "notice": "Calculate the address of an authority-history pair to be deployed deterministically." - }, - "constructor": { - "notice": "Constructs the factory." - }, - "getAuthorityFactory()": { - "notice": "Get the factory used to deploy `Authority` contracts" - }, - "getHistoryFactory()": { - "notice": "Get the factory used to deploy `History` contracts" - }, - "newAuthorityHistoryPair(address)": { - "notice": "Deploy a new authority-history pair." - }, - "newAuthorityHistoryPair(address,bytes32)": { - "notice": "Deploy a new authority-history pair deterministically." - } - }, - "notice": "Allows anyone to reliably deploy a new Authority-History pair.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/onchain/rollups/deployments/optimism/AuthorityHistoryPairFactory.json b/onchain/rollups/deployments/optimism/AuthorityHistoryPairFactory.json deleted file mode 100644 index 2d3d6dd9..00000000 --- a/onchain/rollups/deployments/optimism/AuthorityHistoryPairFactory.json +++ /dev/null @@ -1,282 +0,0 @@ -{ - "address": "0x3890A047Cf9Af60731E80B2105362BbDCD70142D", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IAuthorityFactory", - "name": "_authorityFactory", - "type": "address" - }, - { - "internalType": "contract IHistoryFactory", - "name": "_historyFactory", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract IAuthorityFactory", - "name": "authorityFactory", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract IHistoryFactory", - "name": "historyFactory", - "type": "address" - } - ], - "name": "AuthorityHistoryPairFactoryCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateAuthorityHistoryAddressPair", - "outputs": [ - { - "internalType": "address", - "name": "authorityAddress_", - "type": "address" - }, - { - "internalType": "address", - "name": "historyAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getAuthorityFactory", - "outputs": [ - { - "internalType": "contract IAuthorityFactory", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getHistoryFactory", - "outputs": [ - { - "internalType": "contract IHistoryFactory", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - } - ], - "name": "newAuthorityHistoryPair", - "outputs": [ - { - "internalType": "contract Authority", - "name": "authority_", - "type": "address" - }, - { - "internalType": "contract History", - "name": "history_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newAuthorityHistoryPair", - "outputs": [ - { - "internalType": "contract Authority", - "name": "authority_", - "type": "address" - }, - { - "internalType": "contract History", - "name": "history_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0xa7617ad79f0da69534f10680a0e3db7fcb6d643d40605f782e9d114e2ea2cdab", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 7, - "gasUsed": "460288", - "logsBloom": "0x00000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000004000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xa85e590c860b9a699820a857094eac7cd88e3f804f57e86220b16d9e689826b3", - "transactionHash": "0xa7617ad79f0da69534f10680a0e3db7fcb6d643d40605f782e9d114e2ea2cdab", - "logs": [ - { - "transactionIndex": 7, - "blockNumber": 110416004, - "transactionHash": "0xa7617ad79f0da69534f10680a0e3db7fcb6d643d40605f782e9d114e2ea2cdab", - "address": "0x3890A047Cf9Af60731E80B2105362BbDCD70142D", - "topics": [ - "0x030bcdc35fc24f8a53829b016647c842a9d981d1fed3783a7e282b6e6c9ea4a9" - ], - "data": "0x000000000000000000000000f26a5b278c25d8d41a136d22ad719eaced9c3e630000000000000000000000001f158b5320bbf677fda89f9a438df99bbe560a26", - "logIndex": 23, - "blockHash": "0xa85e590c860b9a699820a857094eac7cd88e3f804f57e86220b16d9e689826b3" - } - ], - "blockNumber": 110416004, - "cumulativeGasUsed": "1460672", - "status": 1, - "byzantium": true - }, - "args": [ - "0xf26a5b278C25D8D41A136d22Ad719EACEd9c3e63", - "0x1f158b5320BBf677FdA89F9a438df99BbE560A26" - ], - "numDeployments": 1, - "solcInputHash": "b1bc2a879218740e83dfbb7046a3cc8c", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IAuthorityFactory\",\"name\":\"_authorityFactory\",\"type\":\"address\"},{\"internalType\":\"contract IHistoryFactory\",\"name\":\"_historyFactory\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract IAuthorityFactory\",\"name\":\"authorityFactory\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract IHistoryFactory\",\"name\":\"historyFactory\",\"type\":\"address\"}],\"name\":\"AuthorityHistoryPairFactoryCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"calculateAuthorityHistoryAddressPair\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"authorityAddress_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"historyAddress_\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAuthorityFactory\",\"outputs\":[{\"internalType\":\"contract IAuthorityFactory\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getHistoryFactory\",\"outputs\":[{\"internalType\":\"contract IHistoryFactory\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"}],\"name\":\"newAuthorityHistoryPair\",\"outputs\":[{\"internalType\":\"contract Authority\",\"name\":\"authority_\",\"type\":\"address\"},{\"internalType\":\"contract History\",\"name\":\"history_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"newAuthorityHistoryPair\",\"outputs\":[{\"internalType\":\"contract Authority\",\"name\":\"authority_\",\"type\":\"address\"},{\"internalType\":\"contract History\",\"name\":\"history_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"AuthorityHistoryPairFactoryCreated(address,address)\":{\"details\":\"MUST be emitted on construction.\",\"params\":{\"authorityFactory\":\"The underlying `Authority` factory\",\"historyFactory\":\"The underlying `History` factory\"}}},\"kind\":\"dev\",\"methods\":{\"calculateAuthorityHistoryAddressPair(address,bytes32)\":{\"details\":\"Beware that only the `newAuthorityHistoryPair` function with the `_salt` parameter is able to deterministically deploy an authority-history pair.\",\"params\":{\"_authorityOwner\":\"The initial authority owner\",\"_salt\":\"The salt used to deterministically generate the authority-history address pair\"},\"returns\":{\"authorityAddress_\":\"The deterministic authority address\",\"historyAddress_\":\"The deterministic history address\"}},\"constructor\":{\"params\":{\"_authorityFactory\":\"The `Authority` factory\",\"_historyFactory\":\"The `History` factory\"}},\"getAuthorityFactory()\":{\"returns\":{\"_0\":\"The `Authority` factory\"}},\"getHistoryFactory()\":{\"returns\":{\"_0\":\"The `History` factory\"}},\"newAuthorityHistoryPair(address)\":{\"params\":{\"_authorityOwner\":\"The initial authority owner\"},\"returns\":{\"authority_\":\"The authority\",\"history_\":\"The history\"}},\"newAuthorityHistoryPair(address,bytes32)\":{\"params\":{\"_authorityOwner\":\"The initial authority owner\",\"_salt\":\"The salt used to deterministically generate the authority-history pair address\"},\"returns\":{\"authority_\":\"The authority\",\"history_\":\"The history\"}}},\"title\":\"Authority-History Pair Factory\",\"version\":1},\"userdoc\":{\"events\":{\"AuthorityHistoryPairFactoryCreated(address,address)\":{\"notice\":\"The factory was created.\"}},\"kind\":\"user\",\"methods\":{\"calculateAuthorityHistoryAddressPair(address,bytes32)\":{\"notice\":\"Calculate the address of an authority-history pair to be deployed deterministically.\"},\"constructor\":{\"notice\":\"Constructs the factory.\"},\"getAuthorityFactory()\":{\"notice\":\"Get the factory used to deploy `Authority` contracts\"},\"getHistoryFactory()\":{\"notice\":\"Get the factory used to deploy `History` contracts\"},\"newAuthorityHistoryPair(address)\":{\"notice\":\"Deploy a new authority-history pair.\"},\"newAuthorityHistoryPair(address,bytes32)\":{\"notice\":\"Deploy a new authority-history pair deterministically.\"}},\"notice\":\"Allows anyone to reliably deploy a new Authority-History pair.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/consensus/authority/AuthorityHistoryPairFactory.sol\":\"AuthorityHistoryPairFactory\"},\"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/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"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\"},\"contracts/consensus/AbstractConsensus.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 {IConsensus} from \\\"./IConsensus.sol\\\";\\n\\n/// @title Abstract Consensus\\n/// @notice An abstract contract that partially implements `IConsensus`.\\nabstract contract AbstractConsensus is IConsensus {\\n /// @notice Emits an `ApplicationJoined` event with the message sender.\\n function join() external override {\\n emit ApplicationJoined(msg.sender);\\n }\\n}\\n\",\"keccak256\":\"0xced9c940ccbbe81fbfcf3bc087c04b9ae90325d6bba68a8cee9ebfa3dd9d231d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/IConsensus.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 Consensus interface\\n///\\n/// @notice This contract defines a generic interface for consensuses.\\n/// We use the word \\\"consensus\\\" to designate a contract that provides claims\\n/// in the base layer regarding the state of off-chain machines running in\\n/// the execution layer. How this contract is able to reach consensus, who is\\n/// able to submit claims, and how are claims stored in the base layer are\\n/// some of the implementation details left unspecified by this interface.\\n///\\n/// From the point of view of a DApp, these claims are necessary to validate\\n/// on-chain action allowed by the off-chain machine in the form of vouchers\\n/// and notices. Each claim is composed of three parts: an epoch hash, a first\\n/// index, and a last index. We'll explain each of these parts below.\\n///\\n/// First, let us define the word \\\"epoch\\\". For finality reasons, we need to\\n/// divide the stream of inputs being fed into the off-chain machine into\\n/// batches of inputs, which we call \\\"epoches\\\". At the end of every epoch,\\n/// we summarize the state of the off-chain machine in a single hash, called\\n/// \\\"epoch hash\\\". Please note that this interface does not define how this\\n/// stream of inputs is being chopped up into epoches.\\n///\\n/// The other two parts are simply the indices of the first and last inputs\\n/// accepted during the epoch. Logically, the first index MUST BE less than\\n/// or equal to the last index. As a result, every epoch MUST accept at least\\n/// one input. This assumption stems from the fact that the state of a machine\\n/// can only change after an input is fed into it.\\n///\\n/// Examples of possible implementations of this interface include:\\n///\\n/// * An authority consensus, controlled by a single address who has full\\n/// control over epoch boundaries, claim submission, asset management, etc.\\n///\\n/// * A quorum consensus, controlled by a limited set of validators, that\\n/// vote on the state of the machine at the end of every epoch. Also, epoch\\n/// boundaries are determined by the timestamp in the base layer, and assets\\n/// are split equally amongst the validators.\\n///\\n/// * An NxN consensus, which allows anyone to submit and dispute claims\\n/// in the base layer. Epoch boundaries are determined in the same fashion\\n/// as in the quorum example.\\n///\\ninterface IConsensus {\\n /// @notice An application has joined the consensus' validation set.\\n /// @param application The application\\n /// @dev MUST be triggered on a successful call to `join`.\\n event ApplicationJoined(address application);\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// The encoding of `_proofContext` might vary\\n /// depending on the 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 /// @notice Signal the consensus that the message sender wants to join its validation set.\\n /// @dev MUST fire an `ApplicationJoined` event with the message sender as argument.\\n function join() external;\\n}\\n\",\"keccak256\":\"0xc9d295fada66eb0602e0f1e2e236708e52f959927abb4ab6b04173a98b92ac16\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/Authority.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\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {IConsensus} from \\\"../IConsensus.sol\\\";\\nimport {AbstractConsensus} from \\\"../AbstractConsensus.sol\\\";\\nimport {IHistory} from \\\"../../history/IHistory.sol\\\";\\n\\n/// @title Authority consensus\\n/// @notice A consensus model controlled by a single address, the owner.\\n/// Claims are stored in an auxiliary contract called `History`.\\n/// @dev This contract inherits `AbstractConsensus` and OpenZeppelin's `Ownable` contract.\\n/// For more information on `Ownable`, please consult OpenZeppelin's official documentation.\\ncontract Authority is AbstractConsensus, Ownable {\\n /// @notice The current history contract.\\n /// @dev See the `getHistory` and `setHistory` functions.\\n IHistory internal history;\\n\\n /// @notice A new history contract is used to store claims.\\n /// @param history The new history contract\\n /// @dev MUST be triggered on a successful call to `setHistory`.\\n event NewHistory(IHistory history);\\n\\n /// @notice Raised when a transfer of tokens from an authority to a recipient fails.\\n error AuthorityWithdrawalFailed();\\n\\n /// @notice Constructs an `Authority` contract.\\n /// @param _owner The initial contract 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 (msg.sender != _owner) {\\n transferOwnership(_owner);\\n }\\n }\\n\\n /// @notice Submits a claim to the current history contract.\\n /// The encoding of `_claimData` might vary depending on the\\n /// implementation of the current history contract.\\n /// @param _claimData Data for submitting a claim\\n /// @dev Can only be called by the `Authority` owner,\\n /// and the `Authority` contract must have ownership over\\n /// its current history contract.\\n function submitClaim(bytes calldata _claimData) external onlyOwner {\\n history.submitClaim(_claimData);\\n }\\n\\n /// @notice Transfer ownership over the current history contract to `_consensus`.\\n /// @param _consensus The new owner of the current history contract\\n /// @dev Can only be called by the `Authority` owner,\\n /// and the `Authority` contract must have ownership over\\n /// its current history contract.\\n function migrateHistoryToConsensus(address _consensus) external onlyOwner {\\n history.migrateToConsensus(_consensus);\\n }\\n\\n /// @notice Make `Authority` point to another history contract.\\n /// @param _history The new history contract\\n /// @dev Emits a `NewHistory` event.\\n /// Can only be called by the `Authority` owner.\\n function setHistory(IHistory _history) external onlyOwner {\\n history = _history;\\n emit NewHistory(_history);\\n }\\n\\n /// @notice Get the current history contract.\\n /// @return The current history contract\\n function getHistory() external view returns (IHistory) {\\n return history;\\n }\\n\\n /// @notice Get a claim from the current history.\\n /// The encoding of `_proofContext` might vary depending on the\\n /// implementation of the current history contract.\\n /// @inheritdoc IConsensus\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n ) external view override returns (bytes32, uint256, uint256) {\\n return history.getClaim(_dapp, _proofContext);\\n }\\n\\n /// @notice Transfer some amount of ERC-20 tokens to a recipient.\\n /// @param _token The token contract\\n /// @param _recipient The recipient address\\n /// @param _amount The amount of tokens to be withdrawn\\n /// @dev Can only be called by the `Authority` owner.\\n function withdrawERC20Tokens(\\n IERC20 _token,\\n address _recipient,\\n uint256 _amount\\n ) external onlyOwner {\\n bool success = _token.transfer(_recipient, _amount);\\n\\n if (!success) {\\n revert AuthorityWithdrawalFailed();\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc71ea13163833684ce576861fbb19dc40e7096a022c6976b61a99dfc9e1c0903\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/AuthorityHistoryPairFactory.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 {IAuthorityHistoryPairFactory} from \\\"./IAuthorityHistoryPairFactory.sol\\\";\\nimport {Authority} from \\\"./Authority.sol\\\";\\nimport {IAuthorityFactory} from \\\"./IAuthorityFactory.sol\\\";\\nimport {History} from \\\"../../history/History.sol\\\";\\nimport {IHistoryFactory} from \\\"../../history/IHistoryFactory.sol\\\";\\n\\n/// @title Authority-History Pair Factory\\n/// @notice Allows anyone to reliably deploy a new Authority-History pair.\\ncontract AuthorityHistoryPairFactory is IAuthorityHistoryPairFactory {\\n IAuthorityFactory immutable authorityFactory;\\n IHistoryFactory immutable historyFactory;\\n\\n /// @notice Constructs the factory.\\n /// @param _authorityFactory The `Authority` factory\\n /// @param _historyFactory The `History` factory\\n constructor(\\n IAuthorityFactory _authorityFactory,\\n IHistoryFactory _historyFactory\\n ) {\\n authorityFactory = _authorityFactory;\\n historyFactory = _historyFactory;\\n\\n emit AuthorityHistoryPairFactoryCreated(\\n _authorityFactory,\\n _historyFactory\\n );\\n }\\n\\n function getAuthorityFactory()\\n external\\n view\\n override\\n returns (IAuthorityFactory)\\n {\\n return authorityFactory;\\n }\\n\\n function getHistoryFactory()\\n external\\n view\\n override\\n returns (IHistoryFactory)\\n {\\n return historyFactory;\\n }\\n\\n function newAuthorityHistoryPair(\\n address _authorityOwner\\n ) external override returns (Authority authority_, History history_) {\\n authority_ = authorityFactory.newAuthority(address(this));\\n history_ = historyFactory.newHistory(address(authority_));\\n\\n authority_.setHistory(history_);\\n authority_.transferOwnership(_authorityOwner);\\n }\\n\\n function newAuthorityHistoryPair(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external override returns (Authority authority_, History history_) {\\n authority_ = authorityFactory.newAuthority(\\n address(this),\\n calculateCompoundSalt(_authorityOwner, _salt)\\n );\\n history_ = historyFactory.newHistory(address(authority_), _salt);\\n\\n authority_.setHistory(history_);\\n authority_.transferOwnership(_authorityOwner);\\n }\\n\\n function calculateAuthorityHistoryAddressPair(\\n address _authorityOwner,\\n bytes32 _salt\\n )\\n external\\n view\\n override\\n returns (address authorityAddress_, address historyAddress_)\\n {\\n authorityAddress_ = authorityFactory.calculateAuthorityAddress(\\n address(this),\\n calculateCompoundSalt(_authorityOwner, _salt)\\n );\\n\\n historyAddress_ = historyFactory.calculateHistoryAddress(\\n authorityAddress_,\\n _salt\\n );\\n }\\n\\n /// @notice Calculate the compound salt.\\n /// @param _authorityOwner authority owner\\n /// @param _salt salt\\n /// @return compound salt\\n /// @dev The purpose of calculating a compound salt is to\\n /// prevent attackers front-running the creation of an Authority\\n /// occupying the to-be-deployed address, but with a different owner.\\n function calculateCompoundSalt(\\n address _authorityOwner,\\n bytes32 _salt\\n ) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(_authorityOwner, _salt));\\n }\\n}\\n\",\"keccak256\":\"0x3ee10d66249cf837c51ba4fe082edb7cebf17466060c9fd405cba2861951690d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/IAuthorityFactory.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 {Authority} from \\\"./Authority.sol\\\";\\n\\n/// @title Authority Factory interface\\ninterface IAuthorityFactory {\\n // Events\\n\\n /// @notice A new authority was deployed.\\n /// @param authorityOwner The initial authority owner\\n /// @param authority The authority\\n /// @dev MUST be triggered on a successful call to `newAuthority`.\\n event AuthorityCreated(address authorityOwner, Authority authority);\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new authority.\\n /// @param _authorityOwner The initial authority owner\\n /// @return The authority\\n /// @dev On success, MUST emit an `AuthorityCreated` event.\\n function newAuthority(address _authorityOwner) external returns (Authority);\\n\\n /// @notice Deploy a new authority deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority address\\n /// @return The authority\\n /// @dev On success, MUST emit an `AuthorityCreated` event.\\n function newAuthority(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external returns (Authority);\\n\\n /// @notice Calculate the address of an authority to be deployed deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority address\\n /// @return The deterministic authority address\\n /// @dev Beware that only the `newAuthority` function with the `_salt` parameter\\n /// is able to deterministically deploy an authority.\\n function calculateAuthorityAddress(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x149bcdf9641b337836263196aabb655e69902212ede21becedd9c08b5b304717\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/IAuthorityHistoryPairFactory.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 {Authority} from \\\"./Authority.sol\\\";\\nimport {IAuthorityFactory} from \\\"./IAuthorityFactory.sol\\\";\\nimport {History} from \\\"../../history/History.sol\\\";\\nimport {IHistoryFactory} from \\\"../../history/IHistoryFactory.sol\\\";\\n\\n/// @title Authority-History Pair Factory interface\\ninterface IAuthorityHistoryPairFactory {\\n // Events\\n\\n /// @notice The factory was created.\\n /// @param authorityFactory The underlying `Authority` factory\\n /// @param historyFactory The underlying `History` factory\\n /// @dev MUST be emitted on construction.\\n event AuthorityHistoryPairFactoryCreated(\\n IAuthorityFactory authorityFactory,\\n IHistoryFactory historyFactory\\n );\\n\\n // Permissionless functions\\n\\n /// @notice Get the factory used to deploy `Authority` contracts\\n /// @return The `Authority` factory\\n function getAuthorityFactory() external view returns (IAuthorityFactory);\\n\\n /// @notice Get the factory used to deploy `History` contracts\\n /// @return The `History` factory\\n function getHistoryFactory() external view returns (IHistoryFactory);\\n\\n /// @notice Deploy a new authority-history pair.\\n /// @param _authorityOwner The initial authority owner\\n /// @return The authority\\n /// @return The history\\n function newAuthorityHistoryPair(\\n address _authorityOwner\\n ) external returns (Authority, History);\\n\\n /// @notice Deploy a new authority-history pair deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority-history pair address\\n /// @return The authority\\n /// @return The history\\n function newAuthorityHistoryPair(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external returns (Authority, History);\\n\\n /// @notice Calculate the address of an authority-history pair to be deployed deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority-history address pair\\n /// @return The deterministic authority address\\n /// @return The deterministic history address\\n /// @dev Beware that only the `newAuthorityHistoryPair` function with the `_salt` parameter\\n /// is able to deterministically deploy an authority-history pair.\\n function calculateAuthorityHistoryAddressPair(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external view returns (address, address);\\n}\\n\",\"keccak256\":\"0xd0e4b284ed461544e4d70c030900d0bb9a74c1eee14952c30e35856ce912fbb3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"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/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": "0x60c060405234801561001057600080fd5b5060405161086f38038061086f83398101604081905261002f916100a0565b6001600160a01b03828116608081905290821660a08190526040805192835260208301919091527f030bcdc35fc24f8a53829b016647c842a9d981d1fed3783a7e282b6e6c9ea4a9910160405180910390a150506100da565b6001600160a01b038116811461009d57600080fd5b50565b600080604083850312156100b357600080fd5b82516100be81610088565b60208401519092506100cf81610088565b809150509250929050565b60805160a0516107486101276000396000818160f6015281816101ec01528181610313015261051601526000818160960152818161011f01528181610284015261044601526107486000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c806339dcd4571461005c57806375689f8314610094578063b05cd1dc146100ce578063d73f347a146100e1578063f16b1a5c146100f4575b600080fd5b61006f61006a3660046106a5565b61011a565b604080516001600160a01b039384168152929091166020830152015b60405180910390f35b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b03909116815260200161008b565b61006f6100dc3660046106d1565b610262565b61006f6100ef3660046106a5565b610441565b7f00000000000000000000000000000000000000000000000000000000000000006100b6565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316629c5784306101568787610646565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381865afa15801561019f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c391906106f5565b60405163287ce2dd60e11b81526001600160a01b038083166004830152602482018690529193507f0000000000000000000000000000000000000000000000000000000000000000909116906350f9c5ba90604401602060405180830381865afa158015610235573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025991906106f5565b90509250929050565b604051632ce946e160e21b815230600482015260009081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063b3a51b84906024016020604051808303816000875af11580156102cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f191906106f5565b60405163446a4d3160e11b81526001600160a01b0380831660048301529193507f0000000000000000000000000000000000000000000000000000000000000000909116906388d49a62906024016020604051808303816000875af115801561035e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038291906106f5565b60405163159c5ea160e01b81526001600160a01b0380831660048301529192509083169063159c5ea190602401600060405180830381600087803b1580156103c957600080fd5b505af11580156103dd573d6000803e3d6000fd5b505060405163f2fde38b60e01b81526001600160a01b0386811660048301528516925063f2fde38b9150602401600060405180830381600087803b15801561042457600080fd5b505af1158015610438573d6000803e3d6000fd5b50505050915091565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635a3f27d33061047e8787610646565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156104c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ed91906106f5565b604051632ab8b11560e01b81526001600160a01b038083166004830152602482018690529193507f000000000000000000000000000000000000000000000000000000000000000090911690632ab8b115906044016020604051808303816000875af1158015610561573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058591906106f5565b60405163159c5ea160e01b81526001600160a01b0380831660048301529192509083169063159c5ea190602401600060405180830381600087803b1580156105cc57600080fd5b505af11580156105e0573d6000803e3d6000fd5b505060405163f2fde38b60e01b81526001600160a01b0387811660048301528516925063f2fde38b9150602401600060405180830381600087803b15801561062757600080fd5b505af115801561063b573d6000803e3d6000fd5b505050509250929050565b6040516bffffffffffffffffffffffff19606084901b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905092915050565b6001600160a01b03811681146106a257600080fd5b50565b600080604083850312156106b857600080fd5b82356106c38161068d565b946020939093013593505050565b6000602082840312156106e357600080fd5b81356106ee8161068d565b9392505050565b60006020828403121561070757600080fd5b81516106ee8161068d56fea2646970667358221220c9ff4c136426d9ba4f5c3e496e98c529a164caa845ab19e63e0cbefb6f48838664736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c806339dcd4571461005c57806375689f8314610094578063b05cd1dc146100ce578063d73f347a146100e1578063f16b1a5c146100f4575b600080fd5b61006f61006a3660046106a5565b61011a565b604080516001600160a01b039384168152929091166020830152015b60405180910390f35b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b03909116815260200161008b565b61006f6100dc3660046106d1565b610262565b61006f6100ef3660046106a5565b610441565b7f00000000000000000000000000000000000000000000000000000000000000006100b6565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316629c5784306101568787610646565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381865afa15801561019f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c391906106f5565b60405163287ce2dd60e11b81526001600160a01b038083166004830152602482018690529193507f0000000000000000000000000000000000000000000000000000000000000000909116906350f9c5ba90604401602060405180830381865afa158015610235573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025991906106f5565b90509250929050565b604051632ce946e160e21b815230600482015260009081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063b3a51b84906024016020604051808303816000875af11580156102cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f191906106f5565b60405163446a4d3160e11b81526001600160a01b0380831660048301529193507f0000000000000000000000000000000000000000000000000000000000000000909116906388d49a62906024016020604051808303816000875af115801561035e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038291906106f5565b60405163159c5ea160e01b81526001600160a01b0380831660048301529192509083169063159c5ea190602401600060405180830381600087803b1580156103c957600080fd5b505af11580156103dd573d6000803e3d6000fd5b505060405163f2fde38b60e01b81526001600160a01b0386811660048301528516925063f2fde38b9150602401600060405180830381600087803b15801561042457600080fd5b505af1158015610438573d6000803e3d6000fd5b50505050915091565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635a3f27d33061047e8787610646565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156104c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ed91906106f5565b604051632ab8b11560e01b81526001600160a01b038083166004830152602482018690529193507f000000000000000000000000000000000000000000000000000000000000000090911690632ab8b115906044016020604051808303816000875af1158015610561573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058591906106f5565b60405163159c5ea160e01b81526001600160a01b0380831660048301529192509083169063159c5ea190602401600060405180830381600087803b1580156105cc57600080fd5b505af11580156105e0573d6000803e3d6000fd5b505060405163f2fde38b60e01b81526001600160a01b0387811660048301528516925063f2fde38b9150602401600060405180830381600087803b15801561062757600080fd5b505af115801561063b573d6000803e3d6000fd5b505050509250929050565b6040516bffffffffffffffffffffffff19606084901b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905092915050565b6001600160a01b03811681146106a257600080fd5b50565b600080604083850312156106b857600080fd5b82356106c38161068d565b946020939093013593505050565b6000602082840312156106e357600080fd5b81356106ee8161068d565b9392505050565b60006020828403121561070757600080fd5b81516106ee8161068d56fea2646970667358221220c9ff4c136426d9ba4f5c3e496e98c529a164caa845ab19e63e0cbefb6f48838664736f6c63430008130033", - "devdoc": { - "events": { - "AuthorityHistoryPairFactoryCreated(address,address)": { - "details": "MUST be emitted on construction.", - "params": { - "authorityFactory": "The underlying `Authority` factory", - "historyFactory": "The underlying `History` factory" - } - } - }, - "kind": "dev", - "methods": { - "calculateAuthorityHistoryAddressPair(address,bytes32)": { - "details": "Beware that only the `newAuthorityHistoryPair` function with the `_salt` parameter is able to deterministically deploy an authority-history pair.", - "params": { - "_authorityOwner": "The initial authority owner", - "_salt": "The salt used to deterministically generate the authority-history address pair" - }, - "returns": { - "authorityAddress_": "The deterministic authority address", - "historyAddress_": "The deterministic history address" - } - }, - "constructor": { - "params": { - "_authorityFactory": "The `Authority` factory", - "_historyFactory": "The `History` factory" - } - }, - "getAuthorityFactory()": { - "returns": { - "_0": "The `Authority` factory" - } - }, - "getHistoryFactory()": { - "returns": { - "_0": "The `History` factory" - } - }, - "newAuthorityHistoryPair(address)": { - "params": { - "_authorityOwner": "The initial authority owner" - }, - "returns": { - "authority_": "The authority", - "history_": "The history" - } - }, - "newAuthorityHistoryPair(address,bytes32)": { - "params": { - "_authorityOwner": "The initial authority owner", - "_salt": "The salt used to deterministically generate the authority-history pair address" - }, - "returns": { - "authority_": "The authority", - "history_": "The history" - } - } - }, - "title": "Authority-History Pair Factory", - "version": 1 - }, - "userdoc": { - "events": { - "AuthorityHistoryPairFactoryCreated(address,address)": { - "notice": "The factory was created." - } - }, - "kind": "user", - "methods": { - "calculateAuthorityHistoryAddressPair(address,bytes32)": { - "notice": "Calculate the address of an authority-history pair to be deployed deterministically." - }, - "constructor": { - "notice": "Constructs the factory." - }, - "getAuthorityFactory()": { - "notice": "Get the factory used to deploy `Authority` contracts" - }, - "getHistoryFactory()": { - "notice": "Get the factory used to deploy `History` contracts" - }, - "newAuthorityHistoryPair(address)": { - "notice": "Deploy a new authority-history pair." - }, - "newAuthorityHistoryPair(address,bytes32)": { - "notice": "Deploy a new authority-history pair deterministically." - } - }, - "notice": "Allows anyone to reliably deploy a new Authority-History pair.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/onchain/rollups/deployments/optimism_goerli/AuthorityHistoryPairFactory.json b/onchain/rollups/deployments/optimism_goerli/AuthorityHistoryPairFactory.json deleted file mode 100644 index f9bc6a1f..00000000 --- a/onchain/rollups/deployments/optimism_goerli/AuthorityHistoryPairFactory.json +++ /dev/null @@ -1,282 +0,0 @@ -{ - "address": "0x3890A047Cf9Af60731E80B2105362BbDCD70142D", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IAuthorityFactory", - "name": "_authorityFactory", - "type": "address" - }, - { - "internalType": "contract IHistoryFactory", - "name": "_historyFactory", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract IAuthorityFactory", - "name": "authorityFactory", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract IHistoryFactory", - "name": "historyFactory", - "type": "address" - } - ], - "name": "AuthorityHistoryPairFactoryCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateAuthorityHistoryAddressPair", - "outputs": [ - { - "internalType": "address", - "name": "authorityAddress_", - "type": "address" - }, - { - "internalType": "address", - "name": "historyAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getAuthorityFactory", - "outputs": [ - { - "internalType": "contract IAuthorityFactory", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getHistoryFactory", - "outputs": [ - { - "internalType": "contract IHistoryFactory", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - } - ], - "name": "newAuthorityHistoryPair", - "outputs": [ - { - "internalType": "contract Authority", - "name": "authority_", - "type": "address" - }, - { - "internalType": "contract History", - "name": "history_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newAuthorityHistoryPair", - "outputs": [ - { - "internalType": "contract Authority", - "name": "authority_", - "type": "address" - }, - { - "internalType": "contract History", - "name": "history_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0xb403f44f01a8685d7286285626442a2108de572175a876eb70aa8d913623a130", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", - "contractAddress": null, - "transactionIndex": 1, - "gasUsed": "460288", - "logsBloom": "0x00000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000004000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x4671282fbeb7f2197aaef654c7a698dd9a7ce67f9892b9fd156252acb76d9e30", - "transactionHash": "0xb403f44f01a8685d7286285626442a2108de572175a876eb70aa8d913623a130", - "logs": [ - { - "transactionIndex": 1, - "blockNumber": 15500548, - "transactionHash": "0xb403f44f01a8685d7286285626442a2108de572175a876eb70aa8d913623a130", - "address": "0x3890A047Cf9Af60731E80B2105362BbDCD70142D", - "topics": [ - "0x030bcdc35fc24f8a53829b016647c842a9d981d1fed3783a7e282b6e6c9ea4a9" - ], - "data": "0x000000000000000000000000f26a5b278c25d8d41a136d22ad719eaced9c3e630000000000000000000000001f158b5320bbf677fda89f9a438df99bbe560a26", - "logIndex": 0, - "blockHash": "0x4671282fbeb7f2197aaef654c7a698dd9a7ce67f9892b9fd156252acb76d9e30" - } - ], - "blockNumber": 15500548, - "cumulativeGasUsed": "507153", - "status": 1, - "byzantium": true - }, - "args": [ - "0xf26a5b278C25D8D41A136d22Ad719EACEd9c3e63", - "0x1f158b5320BBf677FdA89F9a438df99BbE560A26" - ], - "numDeployments": 1, - "solcInputHash": "b1bc2a879218740e83dfbb7046a3cc8c", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IAuthorityFactory\",\"name\":\"_authorityFactory\",\"type\":\"address\"},{\"internalType\":\"contract IHistoryFactory\",\"name\":\"_historyFactory\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract IAuthorityFactory\",\"name\":\"authorityFactory\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract IHistoryFactory\",\"name\":\"historyFactory\",\"type\":\"address\"}],\"name\":\"AuthorityHistoryPairFactoryCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"calculateAuthorityHistoryAddressPair\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"authorityAddress_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"historyAddress_\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAuthorityFactory\",\"outputs\":[{\"internalType\":\"contract IAuthorityFactory\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getHistoryFactory\",\"outputs\":[{\"internalType\":\"contract IHistoryFactory\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"}],\"name\":\"newAuthorityHistoryPair\",\"outputs\":[{\"internalType\":\"contract Authority\",\"name\":\"authority_\",\"type\":\"address\"},{\"internalType\":\"contract History\",\"name\":\"history_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"newAuthorityHistoryPair\",\"outputs\":[{\"internalType\":\"contract Authority\",\"name\":\"authority_\",\"type\":\"address\"},{\"internalType\":\"contract History\",\"name\":\"history_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"AuthorityHistoryPairFactoryCreated(address,address)\":{\"details\":\"MUST be emitted on construction.\",\"params\":{\"authorityFactory\":\"The underlying `Authority` factory\",\"historyFactory\":\"The underlying `History` factory\"}}},\"kind\":\"dev\",\"methods\":{\"calculateAuthorityHistoryAddressPair(address,bytes32)\":{\"details\":\"Beware that only the `newAuthorityHistoryPair` function with the `_salt` parameter is able to deterministically deploy an authority-history pair.\",\"params\":{\"_authorityOwner\":\"The initial authority owner\",\"_salt\":\"The salt used to deterministically generate the authority-history address pair\"},\"returns\":{\"authorityAddress_\":\"The deterministic authority address\",\"historyAddress_\":\"The deterministic history address\"}},\"constructor\":{\"params\":{\"_authorityFactory\":\"The `Authority` factory\",\"_historyFactory\":\"The `History` factory\"}},\"getAuthorityFactory()\":{\"returns\":{\"_0\":\"The `Authority` factory\"}},\"getHistoryFactory()\":{\"returns\":{\"_0\":\"The `History` factory\"}},\"newAuthorityHistoryPair(address)\":{\"params\":{\"_authorityOwner\":\"The initial authority owner\"},\"returns\":{\"authority_\":\"The authority\",\"history_\":\"The history\"}},\"newAuthorityHistoryPair(address,bytes32)\":{\"params\":{\"_authorityOwner\":\"The initial authority owner\",\"_salt\":\"The salt used to deterministically generate the authority-history pair address\"},\"returns\":{\"authority_\":\"The authority\",\"history_\":\"The history\"}}},\"title\":\"Authority-History Pair Factory\",\"version\":1},\"userdoc\":{\"events\":{\"AuthorityHistoryPairFactoryCreated(address,address)\":{\"notice\":\"The factory was created.\"}},\"kind\":\"user\",\"methods\":{\"calculateAuthorityHistoryAddressPair(address,bytes32)\":{\"notice\":\"Calculate the address of an authority-history pair to be deployed deterministically.\"},\"constructor\":{\"notice\":\"Constructs the factory.\"},\"getAuthorityFactory()\":{\"notice\":\"Get the factory used to deploy `Authority` contracts\"},\"getHistoryFactory()\":{\"notice\":\"Get the factory used to deploy `History` contracts\"},\"newAuthorityHistoryPair(address)\":{\"notice\":\"Deploy a new authority-history pair.\"},\"newAuthorityHistoryPair(address,bytes32)\":{\"notice\":\"Deploy a new authority-history pair deterministically.\"}},\"notice\":\"Allows anyone to reliably deploy a new Authority-History pair.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/consensus/authority/AuthorityHistoryPairFactory.sol\":\"AuthorityHistoryPairFactory\"},\"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/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"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\"},\"contracts/consensus/AbstractConsensus.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 {IConsensus} from \\\"./IConsensus.sol\\\";\\n\\n/// @title Abstract Consensus\\n/// @notice An abstract contract that partially implements `IConsensus`.\\nabstract contract AbstractConsensus is IConsensus {\\n /// @notice Emits an `ApplicationJoined` event with the message sender.\\n function join() external override {\\n emit ApplicationJoined(msg.sender);\\n }\\n}\\n\",\"keccak256\":\"0xced9c940ccbbe81fbfcf3bc087c04b9ae90325d6bba68a8cee9ebfa3dd9d231d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/IConsensus.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 Consensus interface\\n///\\n/// @notice This contract defines a generic interface for consensuses.\\n/// We use the word \\\"consensus\\\" to designate a contract that provides claims\\n/// in the base layer regarding the state of off-chain machines running in\\n/// the execution layer. How this contract is able to reach consensus, who is\\n/// able to submit claims, and how are claims stored in the base layer are\\n/// some of the implementation details left unspecified by this interface.\\n///\\n/// From the point of view of a DApp, these claims are necessary to validate\\n/// on-chain action allowed by the off-chain machine in the form of vouchers\\n/// and notices. Each claim is composed of three parts: an epoch hash, a first\\n/// index, and a last index. We'll explain each of these parts below.\\n///\\n/// First, let us define the word \\\"epoch\\\". For finality reasons, we need to\\n/// divide the stream of inputs being fed into the off-chain machine into\\n/// batches of inputs, which we call \\\"epoches\\\". At the end of every epoch,\\n/// we summarize the state of the off-chain machine in a single hash, called\\n/// \\\"epoch hash\\\". Please note that this interface does not define how this\\n/// stream of inputs is being chopped up into epoches.\\n///\\n/// The other two parts are simply the indices of the first and last inputs\\n/// accepted during the epoch. Logically, the first index MUST BE less than\\n/// or equal to the last index. As a result, every epoch MUST accept at least\\n/// one input. This assumption stems from the fact that the state of a machine\\n/// can only change after an input is fed into it.\\n///\\n/// Examples of possible implementations of this interface include:\\n///\\n/// * An authority consensus, controlled by a single address who has full\\n/// control over epoch boundaries, claim submission, asset management, etc.\\n///\\n/// * A quorum consensus, controlled by a limited set of validators, that\\n/// vote on the state of the machine at the end of every epoch. Also, epoch\\n/// boundaries are determined by the timestamp in the base layer, and assets\\n/// are split equally amongst the validators.\\n///\\n/// * An NxN consensus, which allows anyone to submit and dispute claims\\n/// in the base layer. Epoch boundaries are determined in the same fashion\\n/// as in the quorum example.\\n///\\ninterface IConsensus {\\n /// @notice An application has joined the consensus' validation set.\\n /// @param application The application\\n /// @dev MUST be triggered on a successful call to `join`.\\n event ApplicationJoined(address application);\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// The encoding of `_proofContext` might vary\\n /// depending on the 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 /// @notice Signal the consensus that the message sender wants to join its validation set.\\n /// @dev MUST fire an `ApplicationJoined` event with the message sender as argument.\\n function join() external;\\n}\\n\",\"keccak256\":\"0xc9d295fada66eb0602e0f1e2e236708e52f959927abb4ab6b04173a98b92ac16\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/Authority.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\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {IConsensus} from \\\"../IConsensus.sol\\\";\\nimport {AbstractConsensus} from \\\"../AbstractConsensus.sol\\\";\\nimport {IHistory} from \\\"../../history/IHistory.sol\\\";\\n\\n/// @title Authority consensus\\n/// @notice A consensus model controlled by a single address, the owner.\\n/// Claims are stored in an auxiliary contract called `History`.\\n/// @dev This contract inherits `AbstractConsensus` and OpenZeppelin's `Ownable` contract.\\n/// For more information on `Ownable`, please consult OpenZeppelin's official documentation.\\ncontract Authority is AbstractConsensus, Ownable {\\n /// @notice The current history contract.\\n /// @dev See the `getHistory` and `setHistory` functions.\\n IHistory internal history;\\n\\n /// @notice A new history contract is used to store claims.\\n /// @param history The new history contract\\n /// @dev MUST be triggered on a successful call to `setHistory`.\\n event NewHistory(IHistory history);\\n\\n /// @notice Raised when a transfer of tokens from an authority to a recipient fails.\\n error AuthorityWithdrawalFailed();\\n\\n /// @notice Constructs an `Authority` contract.\\n /// @param _owner The initial contract 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 (msg.sender != _owner) {\\n transferOwnership(_owner);\\n }\\n }\\n\\n /// @notice Submits a claim to the current history contract.\\n /// The encoding of `_claimData` might vary depending on the\\n /// implementation of the current history contract.\\n /// @param _claimData Data for submitting a claim\\n /// @dev Can only be called by the `Authority` owner,\\n /// and the `Authority` contract must have ownership over\\n /// its current history contract.\\n function submitClaim(bytes calldata _claimData) external onlyOwner {\\n history.submitClaim(_claimData);\\n }\\n\\n /// @notice Transfer ownership over the current history contract to `_consensus`.\\n /// @param _consensus The new owner of the current history contract\\n /// @dev Can only be called by the `Authority` owner,\\n /// and the `Authority` contract must have ownership over\\n /// its current history contract.\\n function migrateHistoryToConsensus(address _consensus) external onlyOwner {\\n history.migrateToConsensus(_consensus);\\n }\\n\\n /// @notice Make `Authority` point to another history contract.\\n /// @param _history The new history contract\\n /// @dev Emits a `NewHistory` event.\\n /// Can only be called by the `Authority` owner.\\n function setHistory(IHistory _history) external onlyOwner {\\n history = _history;\\n emit NewHistory(_history);\\n }\\n\\n /// @notice Get the current history contract.\\n /// @return The current history contract\\n function getHistory() external view returns (IHistory) {\\n return history;\\n }\\n\\n /// @notice Get a claim from the current history.\\n /// The encoding of `_proofContext` might vary depending on the\\n /// implementation of the current history contract.\\n /// @inheritdoc IConsensus\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n ) external view override returns (bytes32, uint256, uint256) {\\n return history.getClaim(_dapp, _proofContext);\\n }\\n\\n /// @notice Transfer some amount of ERC-20 tokens to a recipient.\\n /// @param _token The token contract\\n /// @param _recipient The recipient address\\n /// @param _amount The amount of tokens to be withdrawn\\n /// @dev Can only be called by the `Authority` owner.\\n function withdrawERC20Tokens(\\n IERC20 _token,\\n address _recipient,\\n uint256 _amount\\n ) external onlyOwner {\\n bool success = _token.transfer(_recipient, _amount);\\n\\n if (!success) {\\n revert AuthorityWithdrawalFailed();\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc71ea13163833684ce576861fbb19dc40e7096a022c6976b61a99dfc9e1c0903\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/AuthorityHistoryPairFactory.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 {IAuthorityHistoryPairFactory} from \\\"./IAuthorityHistoryPairFactory.sol\\\";\\nimport {Authority} from \\\"./Authority.sol\\\";\\nimport {IAuthorityFactory} from \\\"./IAuthorityFactory.sol\\\";\\nimport {History} from \\\"../../history/History.sol\\\";\\nimport {IHistoryFactory} from \\\"../../history/IHistoryFactory.sol\\\";\\n\\n/// @title Authority-History Pair Factory\\n/// @notice Allows anyone to reliably deploy a new Authority-History pair.\\ncontract AuthorityHistoryPairFactory is IAuthorityHistoryPairFactory {\\n IAuthorityFactory immutable authorityFactory;\\n IHistoryFactory immutable historyFactory;\\n\\n /// @notice Constructs the factory.\\n /// @param _authorityFactory The `Authority` factory\\n /// @param _historyFactory The `History` factory\\n constructor(\\n IAuthorityFactory _authorityFactory,\\n IHistoryFactory _historyFactory\\n ) {\\n authorityFactory = _authorityFactory;\\n historyFactory = _historyFactory;\\n\\n emit AuthorityHistoryPairFactoryCreated(\\n _authorityFactory,\\n _historyFactory\\n );\\n }\\n\\n function getAuthorityFactory()\\n external\\n view\\n override\\n returns (IAuthorityFactory)\\n {\\n return authorityFactory;\\n }\\n\\n function getHistoryFactory()\\n external\\n view\\n override\\n returns (IHistoryFactory)\\n {\\n return historyFactory;\\n }\\n\\n function newAuthorityHistoryPair(\\n address _authorityOwner\\n ) external override returns (Authority authority_, History history_) {\\n authority_ = authorityFactory.newAuthority(address(this));\\n history_ = historyFactory.newHistory(address(authority_));\\n\\n authority_.setHistory(history_);\\n authority_.transferOwnership(_authorityOwner);\\n }\\n\\n function newAuthorityHistoryPair(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external override returns (Authority authority_, History history_) {\\n authority_ = authorityFactory.newAuthority(\\n address(this),\\n calculateCompoundSalt(_authorityOwner, _salt)\\n );\\n history_ = historyFactory.newHistory(address(authority_), _salt);\\n\\n authority_.setHistory(history_);\\n authority_.transferOwnership(_authorityOwner);\\n }\\n\\n function calculateAuthorityHistoryAddressPair(\\n address _authorityOwner,\\n bytes32 _salt\\n )\\n external\\n view\\n override\\n returns (address authorityAddress_, address historyAddress_)\\n {\\n authorityAddress_ = authorityFactory.calculateAuthorityAddress(\\n address(this),\\n calculateCompoundSalt(_authorityOwner, _salt)\\n );\\n\\n historyAddress_ = historyFactory.calculateHistoryAddress(\\n authorityAddress_,\\n _salt\\n );\\n }\\n\\n /// @notice Calculate the compound salt.\\n /// @param _authorityOwner authority owner\\n /// @param _salt salt\\n /// @return compound salt\\n /// @dev The purpose of calculating a compound salt is to\\n /// prevent attackers front-running the creation of an Authority\\n /// occupying the to-be-deployed address, but with a different owner.\\n function calculateCompoundSalt(\\n address _authorityOwner,\\n bytes32 _salt\\n ) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(_authorityOwner, _salt));\\n }\\n}\\n\",\"keccak256\":\"0x3ee10d66249cf837c51ba4fe082edb7cebf17466060c9fd405cba2861951690d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/IAuthorityFactory.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 {Authority} from \\\"./Authority.sol\\\";\\n\\n/// @title Authority Factory interface\\ninterface IAuthorityFactory {\\n // Events\\n\\n /// @notice A new authority was deployed.\\n /// @param authorityOwner The initial authority owner\\n /// @param authority The authority\\n /// @dev MUST be triggered on a successful call to `newAuthority`.\\n event AuthorityCreated(address authorityOwner, Authority authority);\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new authority.\\n /// @param _authorityOwner The initial authority owner\\n /// @return The authority\\n /// @dev On success, MUST emit an `AuthorityCreated` event.\\n function newAuthority(address _authorityOwner) external returns (Authority);\\n\\n /// @notice Deploy a new authority deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority address\\n /// @return The authority\\n /// @dev On success, MUST emit an `AuthorityCreated` event.\\n function newAuthority(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external returns (Authority);\\n\\n /// @notice Calculate the address of an authority to be deployed deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority address\\n /// @return The deterministic authority address\\n /// @dev Beware that only the `newAuthority` function with the `_salt` parameter\\n /// is able to deterministically deploy an authority.\\n function calculateAuthorityAddress(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x149bcdf9641b337836263196aabb655e69902212ede21becedd9c08b5b304717\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/IAuthorityHistoryPairFactory.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 {Authority} from \\\"./Authority.sol\\\";\\nimport {IAuthorityFactory} from \\\"./IAuthorityFactory.sol\\\";\\nimport {History} from \\\"../../history/History.sol\\\";\\nimport {IHistoryFactory} from \\\"../../history/IHistoryFactory.sol\\\";\\n\\n/// @title Authority-History Pair Factory interface\\ninterface IAuthorityHistoryPairFactory {\\n // Events\\n\\n /// @notice The factory was created.\\n /// @param authorityFactory The underlying `Authority` factory\\n /// @param historyFactory The underlying `History` factory\\n /// @dev MUST be emitted on construction.\\n event AuthorityHistoryPairFactoryCreated(\\n IAuthorityFactory authorityFactory,\\n IHistoryFactory historyFactory\\n );\\n\\n // Permissionless functions\\n\\n /// @notice Get the factory used to deploy `Authority` contracts\\n /// @return The `Authority` factory\\n function getAuthorityFactory() external view returns (IAuthorityFactory);\\n\\n /// @notice Get the factory used to deploy `History` contracts\\n /// @return The `History` factory\\n function getHistoryFactory() external view returns (IHistoryFactory);\\n\\n /// @notice Deploy a new authority-history pair.\\n /// @param _authorityOwner The initial authority owner\\n /// @return The authority\\n /// @return The history\\n function newAuthorityHistoryPair(\\n address _authorityOwner\\n ) external returns (Authority, History);\\n\\n /// @notice Deploy a new authority-history pair deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority-history pair address\\n /// @return The authority\\n /// @return The history\\n function newAuthorityHistoryPair(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external returns (Authority, History);\\n\\n /// @notice Calculate the address of an authority-history pair to be deployed deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority-history address pair\\n /// @return The deterministic authority address\\n /// @return The deterministic history address\\n /// @dev Beware that only the `newAuthorityHistoryPair` function with the `_salt` parameter\\n /// is able to deterministically deploy an authority-history pair.\\n function calculateAuthorityHistoryAddressPair(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external view returns (address, address);\\n}\\n\",\"keccak256\":\"0xd0e4b284ed461544e4d70c030900d0bb9a74c1eee14952c30e35856ce912fbb3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"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/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": "0x60c060405234801561001057600080fd5b5060405161086f38038061086f83398101604081905261002f916100a0565b6001600160a01b03828116608081905290821660a08190526040805192835260208301919091527f030bcdc35fc24f8a53829b016647c842a9d981d1fed3783a7e282b6e6c9ea4a9910160405180910390a150506100da565b6001600160a01b038116811461009d57600080fd5b50565b600080604083850312156100b357600080fd5b82516100be81610088565b60208401519092506100cf81610088565b809150509250929050565b60805160a0516107486101276000396000818160f6015281816101ec01528181610313015261051601526000818160960152818161011f01528181610284015261044601526107486000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c806339dcd4571461005c57806375689f8314610094578063b05cd1dc146100ce578063d73f347a146100e1578063f16b1a5c146100f4575b600080fd5b61006f61006a3660046106a5565b61011a565b604080516001600160a01b039384168152929091166020830152015b60405180910390f35b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b03909116815260200161008b565b61006f6100dc3660046106d1565b610262565b61006f6100ef3660046106a5565b610441565b7f00000000000000000000000000000000000000000000000000000000000000006100b6565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316629c5784306101568787610646565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381865afa15801561019f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c391906106f5565b60405163287ce2dd60e11b81526001600160a01b038083166004830152602482018690529193507f0000000000000000000000000000000000000000000000000000000000000000909116906350f9c5ba90604401602060405180830381865afa158015610235573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025991906106f5565b90509250929050565b604051632ce946e160e21b815230600482015260009081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063b3a51b84906024016020604051808303816000875af11580156102cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f191906106f5565b60405163446a4d3160e11b81526001600160a01b0380831660048301529193507f0000000000000000000000000000000000000000000000000000000000000000909116906388d49a62906024016020604051808303816000875af115801561035e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038291906106f5565b60405163159c5ea160e01b81526001600160a01b0380831660048301529192509083169063159c5ea190602401600060405180830381600087803b1580156103c957600080fd5b505af11580156103dd573d6000803e3d6000fd5b505060405163f2fde38b60e01b81526001600160a01b0386811660048301528516925063f2fde38b9150602401600060405180830381600087803b15801561042457600080fd5b505af1158015610438573d6000803e3d6000fd5b50505050915091565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635a3f27d33061047e8787610646565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156104c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ed91906106f5565b604051632ab8b11560e01b81526001600160a01b038083166004830152602482018690529193507f000000000000000000000000000000000000000000000000000000000000000090911690632ab8b115906044016020604051808303816000875af1158015610561573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058591906106f5565b60405163159c5ea160e01b81526001600160a01b0380831660048301529192509083169063159c5ea190602401600060405180830381600087803b1580156105cc57600080fd5b505af11580156105e0573d6000803e3d6000fd5b505060405163f2fde38b60e01b81526001600160a01b0387811660048301528516925063f2fde38b9150602401600060405180830381600087803b15801561062757600080fd5b505af115801561063b573d6000803e3d6000fd5b505050509250929050565b6040516bffffffffffffffffffffffff19606084901b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905092915050565b6001600160a01b03811681146106a257600080fd5b50565b600080604083850312156106b857600080fd5b82356106c38161068d565b946020939093013593505050565b6000602082840312156106e357600080fd5b81356106ee8161068d565b9392505050565b60006020828403121561070757600080fd5b81516106ee8161068d56fea2646970667358221220c9ff4c136426d9ba4f5c3e496e98c529a164caa845ab19e63e0cbefb6f48838664736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c806339dcd4571461005c57806375689f8314610094578063b05cd1dc146100ce578063d73f347a146100e1578063f16b1a5c146100f4575b600080fd5b61006f61006a3660046106a5565b61011a565b604080516001600160a01b039384168152929091166020830152015b60405180910390f35b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b03909116815260200161008b565b61006f6100dc3660046106d1565b610262565b61006f6100ef3660046106a5565b610441565b7f00000000000000000000000000000000000000000000000000000000000000006100b6565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316629c5784306101568787610646565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381865afa15801561019f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c391906106f5565b60405163287ce2dd60e11b81526001600160a01b038083166004830152602482018690529193507f0000000000000000000000000000000000000000000000000000000000000000909116906350f9c5ba90604401602060405180830381865afa158015610235573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025991906106f5565b90509250929050565b604051632ce946e160e21b815230600482015260009081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063b3a51b84906024016020604051808303816000875af11580156102cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f191906106f5565b60405163446a4d3160e11b81526001600160a01b0380831660048301529193507f0000000000000000000000000000000000000000000000000000000000000000909116906388d49a62906024016020604051808303816000875af115801561035e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038291906106f5565b60405163159c5ea160e01b81526001600160a01b0380831660048301529192509083169063159c5ea190602401600060405180830381600087803b1580156103c957600080fd5b505af11580156103dd573d6000803e3d6000fd5b505060405163f2fde38b60e01b81526001600160a01b0386811660048301528516925063f2fde38b9150602401600060405180830381600087803b15801561042457600080fd5b505af1158015610438573d6000803e3d6000fd5b50505050915091565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635a3f27d33061047e8787610646565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156104c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ed91906106f5565b604051632ab8b11560e01b81526001600160a01b038083166004830152602482018690529193507f000000000000000000000000000000000000000000000000000000000000000090911690632ab8b115906044016020604051808303816000875af1158015610561573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058591906106f5565b60405163159c5ea160e01b81526001600160a01b0380831660048301529192509083169063159c5ea190602401600060405180830381600087803b1580156105cc57600080fd5b505af11580156105e0573d6000803e3d6000fd5b505060405163f2fde38b60e01b81526001600160a01b0387811660048301528516925063f2fde38b9150602401600060405180830381600087803b15801561062757600080fd5b505af115801561063b573d6000803e3d6000fd5b505050509250929050565b6040516bffffffffffffffffffffffff19606084901b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905092915050565b6001600160a01b03811681146106a257600080fd5b50565b600080604083850312156106b857600080fd5b82356106c38161068d565b946020939093013593505050565b6000602082840312156106e357600080fd5b81356106ee8161068d565b9392505050565b60006020828403121561070757600080fd5b81516106ee8161068d56fea2646970667358221220c9ff4c136426d9ba4f5c3e496e98c529a164caa845ab19e63e0cbefb6f48838664736f6c63430008130033", - "devdoc": { - "events": { - "AuthorityHistoryPairFactoryCreated(address,address)": { - "details": "MUST be emitted on construction.", - "params": { - "authorityFactory": "The underlying `Authority` factory", - "historyFactory": "The underlying `History` factory" - } - } - }, - "kind": "dev", - "methods": { - "calculateAuthorityHistoryAddressPair(address,bytes32)": { - "details": "Beware that only the `newAuthorityHistoryPair` function with the `_salt` parameter is able to deterministically deploy an authority-history pair.", - "params": { - "_authorityOwner": "The initial authority owner", - "_salt": "The salt used to deterministically generate the authority-history address pair" - }, - "returns": { - "authorityAddress_": "The deterministic authority address", - "historyAddress_": "The deterministic history address" - } - }, - "constructor": { - "params": { - "_authorityFactory": "The `Authority` factory", - "_historyFactory": "The `History` factory" - } - }, - "getAuthorityFactory()": { - "returns": { - "_0": "The `Authority` factory" - } - }, - "getHistoryFactory()": { - "returns": { - "_0": "The `History` factory" - } - }, - "newAuthorityHistoryPair(address)": { - "params": { - "_authorityOwner": "The initial authority owner" - }, - "returns": { - "authority_": "The authority", - "history_": "The history" - } - }, - "newAuthorityHistoryPair(address,bytes32)": { - "params": { - "_authorityOwner": "The initial authority owner", - "_salt": "The salt used to deterministically generate the authority-history pair address" - }, - "returns": { - "authority_": "The authority", - "history_": "The history" - } - } - }, - "title": "Authority-History Pair Factory", - "version": 1 - }, - "userdoc": { - "events": { - "AuthorityHistoryPairFactoryCreated(address,address)": { - "notice": "The factory was created." - } - }, - "kind": "user", - "methods": { - "calculateAuthorityHistoryAddressPair(address,bytes32)": { - "notice": "Calculate the address of an authority-history pair to be deployed deterministically." - }, - "constructor": { - "notice": "Constructs the factory." - }, - "getAuthorityFactory()": { - "notice": "Get the factory used to deploy `Authority` contracts" - }, - "getHistoryFactory()": { - "notice": "Get the factory used to deploy `History` contracts" - }, - "newAuthorityHistoryPair(address)": { - "notice": "Deploy a new authority-history pair." - }, - "newAuthorityHistoryPair(address,bytes32)": { - "notice": "Deploy a new authority-history pair deterministically." - } - }, - "notice": "Allows anyone to reliably deploy a new Authority-History pair.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/onchain/rollups/deployments/sepolia/AuthorityHistoryPairFactory.json b/onchain/rollups/deployments/sepolia/AuthorityHistoryPairFactory.json deleted file mode 100644 index 746ec50d..00000000 --- a/onchain/rollups/deployments/sepolia/AuthorityHistoryPairFactory.json +++ /dev/null @@ -1,282 +0,0 @@ -{ - "address": "0x3890A047Cf9Af60731E80B2105362BbDCD70142D", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IAuthorityFactory", - "name": "_authorityFactory", - "type": "address" - }, - { - "internalType": "contract IHistoryFactory", - "name": "_historyFactory", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract IAuthorityFactory", - "name": "authorityFactory", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract IHistoryFactory", - "name": "historyFactory", - "type": "address" - } - ], - "name": "AuthorityHistoryPairFactoryCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateAuthorityHistoryAddressPair", - "outputs": [ - { - "internalType": "address", - "name": "authorityAddress_", - "type": "address" - }, - { - "internalType": "address", - "name": "historyAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getAuthorityFactory", - "outputs": [ - { - "internalType": "contract IAuthorityFactory", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getHistoryFactory", - "outputs": [ - { - "internalType": "contract IHistoryFactory", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - } - ], - "name": "newAuthorityHistoryPair", - "outputs": [ - { - "internalType": "contract Authority", - "name": "authority_", - "type": "address" - }, - { - "internalType": "contract History", - "name": "history_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newAuthorityHistoryPair", - "outputs": [ - { - "internalType": "contract Authority", - "name": "authority_", - "type": "address" - }, - { - "internalType": "contract History", - "name": "history_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0x662f28f82941106b9ddc98c474ba67126d71e3e39e169fe72b668f473319a6ed", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", - "contractAddress": null, - "transactionIndex": 134, - "gasUsed": "460428", - "logsBloom": "0x00000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000004000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xe7990556059fc76ec6ede6b1ffbc80f736882d745f70e9960f456fe07094acdb", - "transactionHash": "0x662f28f82941106b9ddc98c474ba67126d71e3e39e169fe72b668f473319a6ed", - "logs": [ - { - "transactionIndex": 134, - "blockNumber": 4423552, - "transactionHash": "0x662f28f82941106b9ddc98c474ba67126d71e3e39e169fe72b668f473319a6ed", - "address": "0x3890A047Cf9Af60731E80B2105362BbDCD70142D", - "topics": [ - "0x030bcdc35fc24f8a53829b016647c842a9d981d1fed3783a7e282b6e6c9ea4a9" - ], - "data": "0x000000000000000000000000f26a5b278c25d8d41a136d22ad719eaced9c3e630000000000000000000000001f158b5320bbf677fda89f9a438df99bbe560a26", - "logIndex": 307, - "blockHash": "0xe7990556059fc76ec6ede6b1ffbc80f736882d745f70e9960f456fe07094acdb" - } - ], - "blockNumber": 4423552, - "cumulativeGasUsed": "24591318", - "status": 1, - "byzantium": true - }, - "args": [ - "0xf26a5b278C25D8D41A136d22Ad719EACEd9c3e63", - "0x1f158b5320BBf677FdA89F9a438df99BbE560A26" - ], - "numDeployments": 1, - "solcInputHash": "b1bc2a879218740e83dfbb7046a3cc8c", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IAuthorityFactory\",\"name\":\"_authorityFactory\",\"type\":\"address\"},{\"internalType\":\"contract IHistoryFactory\",\"name\":\"_historyFactory\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract IAuthorityFactory\",\"name\":\"authorityFactory\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract IHistoryFactory\",\"name\":\"historyFactory\",\"type\":\"address\"}],\"name\":\"AuthorityHistoryPairFactoryCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"calculateAuthorityHistoryAddressPair\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"authorityAddress_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"historyAddress_\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAuthorityFactory\",\"outputs\":[{\"internalType\":\"contract IAuthorityFactory\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getHistoryFactory\",\"outputs\":[{\"internalType\":\"contract IHistoryFactory\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"}],\"name\":\"newAuthorityHistoryPair\",\"outputs\":[{\"internalType\":\"contract Authority\",\"name\":\"authority_\",\"type\":\"address\"},{\"internalType\":\"contract History\",\"name\":\"history_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"newAuthorityHistoryPair\",\"outputs\":[{\"internalType\":\"contract Authority\",\"name\":\"authority_\",\"type\":\"address\"},{\"internalType\":\"contract History\",\"name\":\"history_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"AuthorityHistoryPairFactoryCreated(address,address)\":{\"details\":\"MUST be emitted on construction.\",\"params\":{\"authorityFactory\":\"The underlying `Authority` factory\",\"historyFactory\":\"The underlying `History` factory\"}}},\"kind\":\"dev\",\"methods\":{\"calculateAuthorityHistoryAddressPair(address,bytes32)\":{\"details\":\"Beware that only the `newAuthorityHistoryPair` function with the `_salt` parameter is able to deterministically deploy an authority-history pair.\",\"params\":{\"_authorityOwner\":\"The initial authority owner\",\"_salt\":\"The salt used to deterministically generate the authority-history address pair\"},\"returns\":{\"authorityAddress_\":\"The deterministic authority address\",\"historyAddress_\":\"The deterministic history address\"}},\"constructor\":{\"params\":{\"_authorityFactory\":\"The `Authority` factory\",\"_historyFactory\":\"The `History` factory\"}},\"getAuthorityFactory()\":{\"returns\":{\"_0\":\"The `Authority` factory\"}},\"getHistoryFactory()\":{\"returns\":{\"_0\":\"The `History` factory\"}},\"newAuthorityHistoryPair(address)\":{\"params\":{\"_authorityOwner\":\"The initial authority owner\"},\"returns\":{\"authority_\":\"The authority\",\"history_\":\"The history\"}},\"newAuthorityHistoryPair(address,bytes32)\":{\"params\":{\"_authorityOwner\":\"The initial authority owner\",\"_salt\":\"The salt used to deterministically generate the authority-history pair address\"},\"returns\":{\"authority_\":\"The authority\",\"history_\":\"The history\"}}},\"title\":\"Authority-History Pair Factory\",\"version\":1},\"userdoc\":{\"events\":{\"AuthorityHistoryPairFactoryCreated(address,address)\":{\"notice\":\"The factory was created.\"}},\"kind\":\"user\",\"methods\":{\"calculateAuthorityHistoryAddressPair(address,bytes32)\":{\"notice\":\"Calculate the address of an authority-history pair to be deployed deterministically.\"},\"constructor\":{\"notice\":\"Constructs the factory.\"},\"getAuthorityFactory()\":{\"notice\":\"Get the factory used to deploy `Authority` contracts\"},\"getHistoryFactory()\":{\"notice\":\"Get the factory used to deploy `History` contracts\"},\"newAuthorityHistoryPair(address)\":{\"notice\":\"Deploy a new authority-history pair.\"},\"newAuthorityHistoryPair(address,bytes32)\":{\"notice\":\"Deploy a new authority-history pair deterministically.\"}},\"notice\":\"Allows anyone to reliably deploy a new Authority-History pair.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/consensus/authority/AuthorityHistoryPairFactory.sol\":\"AuthorityHistoryPairFactory\"},\"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/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"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\"},\"contracts/consensus/AbstractConsensus.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 {IConsensus} from \\\"./IConsensus.sol\\\";\\n\\n/// @title Abstract Consensus\\n/// @notice An abstract contract that partially implements `IConsensus`.\\nabstract contract AbstractConsensus is IConsensus {\\n /// @notice Emits an `ApplicationJoined` event with the message sender.\\n function join() external override {\\n emit ApplicationJoined(msg.sender);\\n }\\n}\\n\",\"keccak256\":\"0xced9c940ccbbe81fbfcf3bc087c04b9ae90325d6bba68a8cee9ebfa3dd9d231d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/IConsensus.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 Consensus interface\\n///\\n/// @notice This contract defines a generic interface for consensuses.\\n/// We use the word \\\"consensus\\\" to designate a contract that provides claims\\n/// in the base layer regarding the state of off-chain machines running in\\n/// the execution layer. How this contract is able to reach consensus, who is\\n/// able to submit claims, and how are claims stored in the base layer are\\n/// some of the implementation details left unspecified by this interface.\\n///\\n/// From the point of view of a DApp, these claims are necessary to validate\\n/// on-chain action allowed by the off-chain machine in the form of vouchers\\n/// and notices. Each claim is composed of three parts: an epoch hash, a first\\n/// index, and a last index. We'll explain each of these parts below.\\n///\\n/// First, let us define the word \\\"epoch\\\". For finality reasons, we need to\\n/// divide the stream of inputs being fed into the off-chain machine into\\n/// batches of inputs, which we call \\\"epoches\\\". At the end of every epoch,\\n/// we summarize the state of the off-chain machine in a single hash, called\\n/// \\\"epoch hash\\\". Please note that this interface does not define how this\\n/// stream of inputs is being chopped up into epoches.\\n///\\n/// The other two parts are simply the indices of the first and last inputs\\n/// accepted during the epoch. Logically, the first index MUST BE less than\\n/// or equal to the last index. As a result, every epoch MUST accept at least\\n/// one input. This assumption stems from the fact that the state of a machine\\n/// can only change after an input is fed into it.\\n///\\n/// Examples of possible implementations of this interface include:\\n///\\n/// * An authority consensus, controlled by a single address who has full\\n/// control over epoch boundaries, claim submission, asset management, etc.\\n///\\n/// * A quorum consensus, controlled by a limited set of validators, that\\n/// vote on the state of the machine at the end of every epoch. Also, epoch\\n/// boundaries are determined by the timestamp in the base layer, and assets\\n/// are split equally amongst the validators.\\n///\\n/// * An NxN consensus, which allows anyone to submit and dispute claims\\n/// in the base layer. Epoch boundaries are determined in the same fashion\\n/// as in the quorum example.\\n///\\ninterface IConsensus {\\n /// @notice An application has joined the consensus' validation set.\\n /// @param application The application\\n /// @dev MUST be triggered on a successful call to `join`.\\n event ApplicationJoined(address application);\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// The encoding of `_proofContext` might vary\\n /// depending on the 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 /// @notice Signal the consensus that the message sender wants to join its validation set.\\n /// @dev MUST fire an `ApplicationJoined` event with the message sender as argument.\\n function join() external;\\n}\\n\",\"keccak256\":\"0xc9d295fada66eb0602e0f1e2e236708e52f959927abb4ab6b04173a98b92ac16\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/Authority.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\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {IConsensus} from \\\"../IConsensus.sol\\\";\\nimport {AbstractConsensus} from \\\"../AbstractConsensus.sol\\\";\\nimport {IHistory} from \\\"../../history/IHistory.sol\\\";\\n\\n/// @title Authority consensus\\n/// @notice A consensus model controlled by a single address, the owner.\\n/// Claims are stored in an auxiliary contract called `History`.\\n/// @dev This contract inherits `AbstractConsensus` and OpenZeppelin's `Ownable` contract.\\n/// For more information on `Ownable`, please consult OpenZeppelin's official documentation.\\ncontract Authority is AbstractConsensus, Ownable {\\n /// @notice The current history contract.\\n /// @dev See the `getHistory` and `setHistory` functions.\\n IHistory internal history;\\n\\n /// @notice A new history contract is used to store claims.\\n /// @param history The new history contract\\n /// @dev MUST be triggered on a successful call to `setHistory`.\\n event NewHistory(IHistory history);\\n\\n /// @notice Raised when a transfer of tokens from an authority to a recipient fails.\\n error AuthorityWithdrawalFailed();\\n\\n /// @notice Constructs an `Authority` contract.\\n /// @param _owner The initial contract 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 (msg.sender != _owner) {\\n transferOwnership(_owner);\\n }\\n }\\n\\n /// @notice Submits a claim to the current history contract.\\n /// The encoding of `_claimData` might vary depending on the\\n /// implementation of the current history contract.\\n /// @param _claimData Data for submitting a claim\\n /// @dev Can only be called by the `Authority` owner,\\n /// and the `Authority` contract must have ownership over\\n /// its current history contract.\\n function submitClaim(bytes calldata _claimData) external onlyOwner {\\n history.submitClaim(_claimData);\\n }\\n\\n /// @notice Transfer ownership over the current history contract to `_consensus`.\\n /// @param _consensus The new owner of the current history contract\\n /// @dev Can only be called by the `Authority` owner,\\n /// and the `Authority` contract must have ownership over\\n /// its current history contract.\\n function migrateHistoryToConsensus(address _consensus) external onlyOwner {\\n history.migrateToConsensus(_consensus);\\n }\\n\\n /// @notice Make `Authority` point to another history contract.\\n /// @param _history The new history contract\\n /// @dev Emits a `NewHistory` event.\\n /// Can only be called by the `Authority` owner.\\n function setHistory(IHistory _history) external onlyOwner {\\n history = _history;\\n emit NewHistory(_history);\\n }\\n\\n /// @notice Get the current history contract.\\n /// @return The current history contract\\n function getHistory() external view returns (IHistory) {\\n return history;\\n }\\n\\n /// @notice Get a claim from the current history.\\n /// The encoding of `_proofContext` might vary depending on the\\n /// implementation of the current history contract.\\n /// @inheritdoc IConsensus\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n ) external view override returns (bytes32, uint256, uint256) {\\n return history.getClaim(_dapp, _proofContext);\\n }\\n\\n /// @notice Transfer some amount of ERC-20 tokens to a recipient.\\n /// @param _token The token contract\\n /// @param _recipient The recipient address\\n /// @param _amount The amount of tokens to be withdrawn\\n /// @dev Can only be called by the `Authority` owner.\\n function withdrawERC20Tokens(\\n IERC20 _token,\\n address _recipient,\\n uint256 _amount\\n ) external onlyOwner {\\n bool success = _token.transfer(_recipient, _amount);\\n\\n if (!success) {\\n revert AuthorityWithdrawalFailed();\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc71ea13163833684ce576861fbb19dc40e7096a022c6976b61a99dfc9e1c0903\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/AuthorityHistoryPairFactory.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 {IAuthorityHistoryPairFactory} from \\\"./IAuthorityHistoryPairFactory.sol\\\";\\nimport {Authority} from \\\"./Authority.sol\\\";\\nimport {IAuthorityFactory} from \\\"./IAuthorityFactory.sol\\\";\\nimport {History} from \\\"../../history/History.sol\\\";\\nimport {IHistoryFactory} from \\\"../../history/IHistoryFactory.sol\\\";\\n\\n/// @title Authority-History Pair Factory\\n/// @notice Allows anyone to reliably deploy a new Authority-History pair.\\ncontract AuthorityHistoryPairFactory is IAuthorityHistoryPairFactory {\\n IAuthorityFactory immutable authorityFactory;\\n IHistoryFactory immutable historyFactory;\\n\\n /// @notice Constructs the factory.\\n /// @param _authorityFactory The `Authority` factory\\n /// @param _historyFactory The `History` factory\\n constructor(\\n IAuthorityFactory _authorityFactory,\\n IHistoryFactory _historyFactory\\n ) {\\n authorityFactory = _authorityFactory;\\n historyFactory = _historyFactory;\\n\\n emit AuthorityHistoryPairFactoryCreated(\\n _authorityFactory,\\n _historyFactory\\n );\\n }\\n\\n function getAuthorityFactory()\\n external\\n view\\n override\\n returns (IAuthorityFactory)\\n {\\n return authorityFactory;\\n }\\n\\n function getHistoryFactory()\\n external\\n view\\n override\\n returns (IHistoryFactory)\\n {\\n return historyFactory;\\n }\\n\\n function newAuthorityHistoryPair(\\n address _authorityOwner\\n ) external override returns (Authority authority_, History history_) {\\n authority_ = authorityFactory.newAuthority(address(this));\\n history_ = historyFactory.newHistory(address(authority_));\\n\\n authority_.setHistory(history_);\\n authority_.transferOwnership(_authorityOwner);\\n }\\n\\n function newAuthorityHistoryPair(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external override returns (Authority authority_, History history_) {\\n authority_ = authorityFactory.newAuthority(\\n address(this),\\n calculateCompoundSalt(_authorityOwner, _salt)\\n );\\n history_ = historyFactory.newHistory(address(authority_), _salt);\\n\\n authority_.setHistory(history_);\\n authority_.transferOwnership(_authorityOwner);\\n }\\n\\n function calculateAuthorityHistoryAddressPair(\\n address _authorityOwner,\\n bytes32 _salt\\n )\\n external\\n view\\n override\\n returns (address authorityAddress_, address historyAddress_)\\n {\\n authorityAddress_ = authorityFactory.calculateAuthorityAddress(\\n address(this),\\n calculateCompoundSalt(_authorityOwner, _salt)\\n );\\n\\n historyAddress_ = historyFactory.calculateHistoryAddress(\\n authorityAddress_,\\n _salt\\n );\\n }\\n\\n /// @notice Calculate the compound salt.\\n /// @param _authorityOwner authority owner\\n /// @param _salt salt\\n /// @return compound salt\\n /// @dev The purpose of calculating a compound salt is to\\n /// prevent attackers front-running the creation of an Authority\\n /// occupying the to-be-deployed address, but with a different owner.\\n function calculateCompoundSalt(\\n address _authorityOwner,\\n bytes32 _salt\\n ) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(_authorityOwner, _salt));\\n }\\n}\\n\",\"keccak256\":\"0x3ee10d66249cf837c51ba4fe082edb7cebf17466060c9fd405cba2861951690d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/IAuthorityFactory.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 {Authority} from \\\"./Authority.sol\\\";\\n\\n/// @title Authority Factory interface\\ninterface IAuthorityFactory {\\n // Events\\n\\n /// @notice A new authority was deployed.\\n /// @param authorityOwner The initial authority owner\\n /// @param authority The authority\\n /// @dev MUST be triggered on a successful call to `newAuthority`.\\n event AuthorityCreated(address authorityOwner, Authority authority);\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new authority.\\n /// @param _authorityOwner The initial authority owner\\n /// @return The authority\\n /// @dev On success, MUST emit an `AuthorityCreated` event.\\n function newAuthority(address _authorityOwner) external returns (Authority);\\n\\n /// @notice Deploy a new authority deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority address\\n /// @return The authority\\n /// @dev On success, MUST emit an `AuthorityCreated` event.\\n function newAuthority(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external returns (Authority);\\n\\n /// @notice Calculate the address of an authority to be deployed deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority address\\n /// @return The deterministic authority address\\n /// @dev Beware that only the `newAuthority` function with the `_salt` parameter\\n /// is able to deterministically deploy an authority.\\n function calculateAuthorityAddress(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x149bcdf9641b337836263196aabb655e69902212ede21becedd9c08b5b304717\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/IAuthorityHistoryPairFactory.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 {Authority} from \\\"./Authority.sol\\\";\\nimport {IAuthorityFactory} from \\\"./IAuthorityFactory.sol\\\";\\nimport {History} from \\\"../../history/History.sol\\\";\\nimport {IHistoryFactory} from \\\"../../history/IHistoryFactory.sol\\\";\\n\\n/// @title Authority-History Pair Factory interface\\ninterface IAuthorityHistoryPairFactory {\\n // Events\\n\\n /// @notice The factory was created.\\n /// @param authorityFactory The underlying `Authority` factory\\n /// @param historyFactory The underlying `History` factory\\n /// @dev MUST be emitted on construction.\\n event AuthorityHistoryPairFactoryCreated(\\n IAuthorityFactory authorityFactory,\\n IHistoryFactory historyFactory\\n );\\n\\n // Permissionless functions\\n\\n /// @notice Get the factory used to deploy `Authority` contracts\\n /// @return The `Authority` factory\\n function getAuthorityFactory() external view returns (IAuthorityFactory);\\n\\n /// @notice Get the factory used to deploy `History` contracts\\n /// @return The `History` factory\\n function getHistoryFactory() external view returns (IHistoryFactory);\\n\\n /// @notice Deploy a new authority-history pair.\\n /// @param _authorityOwner The initial authority owner\\n /// @return The authority\\n /// @return The history\\n function newAuthorityHistoryPair(\\n address _authorityOwner\\n ) external returns (Authority, History);\\n\\n /// @notice Deploy a new authority-history pair deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority-history pair address\\n /// @return The authority\\n /// @return The history\\n function newAuthorityHistoryPair(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external returns (Authority, History);\\n\\n /// @notice Calculate the address of an authority-history pair to be deployed deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority-history address pair\\n /// @return The deterministic authority address\\n /// @return The deterministic history address\\n /// @dev Beware that only the `newAuthorityHistoryPair` function with the `_salt` parameter\\n /// is able to deterministically deploy an authority-history pair.\\n function calculateAuthorityHistoryAddressPair(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external view returns (address, address);\\n}\\n\",\"keccak256\":\"0xd0e4b284ed461544e4d70c030900d0bb9a74c1eee14952c30e35856ce912fbb3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"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/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": "0x60c060405234801561001057600080fd5b5060405161086f38038061086f83398101604081905261002f916100a0565b6001600160a01b03828116608081905290821660a08190526040805192835260208301919091527f030bcdc35fc24f8a53829b016647c842a9d981d1fed3783a7e282b6e6c9ea4a9910160405180910390a150506100da565b6001600160a01b038116811461009d57600080fd5b50565b600080604083850312156100b357600080fd5b82516100be81610088565b60208401519092506100cf81610088565b809150509250929050565b60805160a0516107486101276000396000818160f6015281816101ec01528181610313015261051601526000818160960152818161011f01528181610284015261044601526107486000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c806339dcd4571461005c57806375689f8314610094578063b05cd1dc146100ce578063d73f347a146100e1578063f16b1a5c146100f4575b600080fd5b61006f61006a3660046106a5565b61011a565b604080516001600160a01b039384168152929091166020830152015b60405180910390f35b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b03909116815260200161008b565b61006f6100dc3660046106d1565b610262565b61006f6100ef3660046106a5565b610441565b7f00000000000000000000000000000000000000000000000000000000000000006100b6565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316629c5784306101568787610646565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381865afa15801561019f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c391906106f5565b60405163287ce2dd60e11b81526001600160a01b038083166004830152602482018690529193507f0000000000000000000000000000000000000000000000000000000000000000909116906350f9c5ba90604401602060405180830381865afa158015610235573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025991906106f5565b90509250929050565b604051632ce946e160e21b815230600482015260009081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063b3a51b84906024016020604051808303816000875af11580156102cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f191906106f5565b60405163446a4d3160e11b81526001600160a01b0380831660048301529193507f0000000000000000000000000000000000000000000000000000000000000000909116906388d49a62906024016020604051808303816000875af115801561035e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038291906106f5565b60405163159c5ea160e01b81526001600160a01b0380831660048301529192509083169063159c5ea190602401600060405180830381600087803b1580156103c957600080fd5b505af11580156103dd573d6000803e3d6000fd5b505060405163f2fde38b60e01b81526001600160a01b0386811660048301528516925063f2fde38b9150602401600060405180830381600087803b15801561042457600080fd5b505af1158015610438573d6000803e3d6000fd5b50505050915091565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635a3f27d33061047e8787610646565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156104c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ed91906106f5565b604051632ab8b11560e01b81526001600160a01b038083166004830152602482018690529193507f000000000000000000000000000000000000000000000000000000000000000090911690632ab8b115906044016020604051808303816000875af1158015610561573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058591906106f5565b60405163159c5ea160e01b81526001600160a01b0380831660048301529192509083169063159c5ea190602401600060405180830381600087803b1580156105cc57600080fd5b505af11580156105e0573d6000803e3d6000fd5b505060405163f2fde38b60e01b81526001600160a01b0387811660048301528516925063f2fde38b9150602401600060405180830381600087803b15801561062757600080fd5b505af115801561063b573d6000803e3d6000fd5b505050509250929050565b6040516bffffffffffffffffffffffff19606084901b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905092915050565b6001600160a01b03811681146106a257600080fd5b50565b600080604083850312156106b857600080fd5b82356106c38161068d565b946020939093013593505050565b6000602082840312156106e357600080fd5b81356106ee8161068d565b9392505050565b60006020828403121561070757600080fd5b81516106ee8161068d56fea2646970667358221220c9ff4c136426d9ba4f5c3e496e98c529a164caa845ab19e63e0cbefb6f48838664736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c806339dcd4571461005c57806375689f8314610094578063b05cd1dc146100ce578063d73f347a146100e1578063f16b1a5c146100f4575b600080fd5b61006f61006a3660046106a5565b61011a565b604080516001600160a01b039384168152929091166020830152015b60405180910390f35b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b03909116815260200161008b565b61006f6100dc3660046106d1565b610262565b61006f6100ef3660046106a5565b610441565b7f00000000000000000000000000000000000000000000000000000000000000006100b6565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316629c5784306101568787610646565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381865afa15801561019f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c391906106f5565b60405163287ce2dd60e11b81526001600160a01b038083166004830152602482018690529193507f0000000000000000000000000000000000000000000000000000000000000000909116906350f9c5ba90604401602060405180830381865afa158015610235573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025991906106f5565b90509250929050565b604051632ce946e160e21b815230600482015260009081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063b3a51b84906024016020604051808303816000875af11580156102cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f191906106f5565b60405163446a4d3160e11b81526001600160a01b0380831660048301529193507f0000000000000000000000000000000000000000000000000000000000000000909116906388d49a62906024016020604051808303816000875af115801561035e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038291906106f5565b60405163159c5ea160e01b81526001600160a01b0380831660048301529192509083169063159c5ea190602401600060405180830381600087803b1580156103c957600080fd5b505af11580156103dd573d6000803e3d6000fd5b505060405163f2fde38b60e01b81526001600160a01b0386811660048301528516925063f2fde38b9150602401600060405180830381600087803b15801561042457600080fd5b505af1158015610438573d6000803e3d6000fd5b50505050915091565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635a3f27d33061047e8787610646565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156104c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ed91906106f5565b604051632ab8b11560e01b81526001600160a01b038083166004830152602482018690529193507f000000000000000000000000000000000000000000000000000000000000000090911690632ab8b115906044016020604051808303816000875af1158015610561573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058591906106f5565b60405163159c5ea160e01b81526001600160a01b0380831660048301529192509083169063159c5ea190602401600060405180830381600087803b1580156105cc57600080fd5b505af11580156105e0573d6000803e3d6000fd5b505060405163f2fde38b60e01b81526001600160a01b0387811660048301528516925063f2fde38b9150602401600060405180830381600087803b15801561062757600080fd5b505af115801561063b573d6000803e3d6000fd5b505050509250929050565b6040516bffffffffffffffffffffffff19606084901b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905092915050565b6001600160a01b03811681146106a257600080fd5b50565b600080604083850312156106b857600080fd5b82356106c38161068d565b946020939093013593505050565b6000602082840312156106e357600080fd5b81356106ee8161068d565b9392505050565b60006020828403121561070757600080fd5b81516106ee8161068d56fea2646970667358221220c9ff4c136426d9ba4f5c3e496e98c529a164caa845ab19e63e0cbefb6f48838664736f6c63430008130033", - "devdoc": { - "events": { - "AuthorityHistoryPairFactoryCreated(address,address)": { - "details": "MUST be emitted on construction.", - "params": { - "authorityFactory": "The underlying `Authority` factory", - "historyFactory": "The underlying `History` factory" - } - } - }, - "kind": "dev", - "methods": { - "calculateAuthorityHistoryAddressPair(address,bytes32)": { - "details": "Beware that only the `newAuthorityHistoryPair` function with the `_salt` parameter is able to deterministically deploy an authority-history pair.", - "params": { - "_authorityOwner": "The initial authority owner", - "_salt": "The salt used to deterministically generate the authority-history address pair" - }, - "returns": { - "authorityAddress_": "The deterministic authority address", - "historyAddress_": "The deterministic history address" - } - }, - "constructor": { - "params": { - "_authorityFactory": "The `Authority` factory", - "_historyFactory": "The `History` factory" - } - }, - "getAuthorityFactory()": { - "returns": { - "_0": "The `Authority` factory" - } - }, - "getHistoryFactory()": { - "returns": { - "_0": "The `History` factory" - } - }, - "newAuthorityHistoryPair(address)": { - "params": { - "_authorityOwner": "The initial authority owner" - }, - "returns": { - "authority_": "The authority", - "history_": "The history" - } - }, - "newAuthorityHistoryPair(address,bytes32)": { - "params": { - "_authorityOwner": "The initial authority owner", - "_salt": "The salt used to deterministically generate the authority-history pair address" - }, - "returns": { - "authority_": "The authority", - "history_": "The history" - } - } - }, - "title": "Authority-History Pair Factory", - "version": 1 - }, - "userdoc": { - "events": { - "AuthorityHistoryPairFactoryCreated(address,address)": { - "notice": "The factory was created." - } - }, - "kind": "user", - "methods": { - "calculateAuthorityHistoryAddressPair(address,bytes32)": { - "notice": "Calculate the address of an authority-history pair to be deployed deterministically." - }, - "constructor": { - "notice": "Constructs the factory." - }, - "getAuthorityFactory()": { - "notice": "Get the factory used to deploy `Authority` contracts" - }, - "getHistoryFactory()": { - "notice": "Get the factory used to deploy `History` contracts" - }, - "newAuthorityHistoryPair(address)": { - "notice": "Deploy a new authority-history pair." - }, - "newAuthorityHistoryPair(address,bytes32)": { - "notice": "Deploy a new authority-history pair deterministically." - } - }, - "notice": "Allows anyone to reliably deploy a new Authority-History pair.", - "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 e2a7b2d1..c05766e3 100644 --- a/onchain/rollups/export/abi/arbitrum.json +++ b/onchain/rollups/export/abi/arbitrum.json @@ -1048,154 +1048,6 @@ "type": "function" } ] - }, - "AuthorityHistoryPairFactory": { - "address": "0x3890A047Cf9Af60731E80B2105362BbDCD70142D", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IAuthorityFactory", - "name": "_authorityFactory", - "type": "address" - }, - { - "internalType": "contract IHistoryFactory", - "name": "_historyFactory", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract IAuthorityFactory", - "name": "authorityFactory", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract IHistoryFactory", - "name": "historyFactory", - "type": "address" - } - ], - "name": "AuthorityHistoryPairFactoryCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateAuthorityHistoryAddressPair", - "outputs": [ - { - "internalType": "address", - "name": "authorityAddress_", - "type": "address" - }, - { - "internalType": "address", - "name": "historyAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getAuthorityFactory", - "outputs": [ - { - "internalType": "contract IAuthorityFactory", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getHistoryFactory", - "outputs": [ - { - "internalType": "contract IHistoryFactory", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - } - ], - "name": "newAuthorityHistoryPair", - "outputs": [ - { - "internalType": "contract Authority", - "name": "authority_", - "type": "address" - }, - { - "internalType": "contract History", - "name": "history_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newAuthorityHistoryPair", - "outputs": [ - { - "internalType": "contract Authority", - "name": "authority_", - "type": "address" - }, - { - "internalType": "contract History", - "name": "history_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ] } } -} \ No newline at end of file +} diff --git a/onchain/rollups/export/abi/arbitrum_goerli.json b/onchain/rollups/export/abi/arbitrum_goerli.json index 4be4404b..62dcaf40 100644 --- a/onchain/rollups/export/abi/arbitrum_goerli.json +++ b/onchain/rollups/export/abi/arbitrum_goerli.json @@ -93,154 +93,6 @@ } ] }, - "AuthorityHistoryPairFactory": { - "address": "0x3890A047Cf9Af60731E80B2105362BbDCD70142D", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IAuthorityFactory", - "name": "_authorityFactory", - "type": "address" - }, - { - "internalType": "contract IHistoryFactory", - "name": "_historyFactory", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract IAuthorityFactory", - "name": "authorityFactory", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract IHistoryFactory", - "name": "historyFactory", - "type": "address" - } - ], - "name": "AuthorityHistoryPairFactoryCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateAuthorityHistoryAddressPair", - "outputs": [ - { - "internalType": "address", - "name": "authorityAddress_", - "type": "address" - }, - { - "internalType": "address", - "name": "historyAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getAuthorityFactory", - "outputs": [ - { - "internalType": "contract IAuthorityFactory", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getHistoryFactory", - "outputs": [ - { - "internalType": "contract IHistoryFactory", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - } - ], - "name": "newAuthorityHistoryPair", - "outputs": [ - { - "internalType": "contract Authority", - "name": "authority_", - "type": "address" - }, - { - "internalType": "contract History", - "name": "history_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newAuthorityHistoryPair", - "outputs": [ - { - "internalType": "contract Authority", - "name": "authority_", - "type": "address" - }, - { - "internalType": "contract History", - "name": "history_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ] - }, "CartesiDAppFactory": { "address": "0x7122cd1221C20892234186facfE8615e6743Ab02", "abi": [ @@ -1198,4 +1050,4 @@ ] } } -} \ No newline at end of file +} diff --git a/onchain/rollups/export/abi/mainnet.json b/onchain/rollups/export/abi/mainnet.json index 171f6464..49b60bbe 100644 --- a/onchain/rollups/export/abi/mainnet.json +++ b/onchain/rollups/export/abi/mainnet.json @@ -1048,154 +1048,6 @@ "type": "function" } ] - }, - "AuthorityHistoryPairFactory": { - "address": "0x3890A047Cf9Af60731E80B2105362BbDCD70142D", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IAuthorityFactory", - "name": "_authorityFactory", - "type": "address" - }, - { - "internalType": "contract IHistoryFactory", - "name": "_historyFactory", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract IAuthorityFactory", - "name": "authorityFactory", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract IHistoryFactory", - "name": "historyFactory", - "type": "address" - } - ], - "name": "AuthorityHistoryPairFactoryCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateAuthorityHistoryAddressPair", - "outputs": [ - { - "internalType": "address", - "name": "authorityAddress_", - "type": "address" - }, - { - "internalType": "address", - "name": "historyAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getAuthorityFactory", - "outputs": [ - { - "internalType": "contract IAuthorityFactory", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getHistoryFactory", - "outputs": [ - { - "internalType": "contract IHistoryFactory", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - } - ], - "name": "newAuthorityHistoryPair", - "outputs": [ - { - "internalType": "contract Authority", - "name": "authority_", - "type": "address" - }, - { - "internalType": "contract History", - "name": "history_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newAuthorityHistoryPair", - "outputs": [ - { - "internalType": "contract Authority", - "name": "authority_", - "type": "address" - }, - { - "internalType": "contract History", - "name": "history_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ] } } -} \ No newline at end of file +} diff --git a/onchain/rollups/export/abi/optimism.json b/onchain/rollups/export/abi/optimism.json index fe0483e8..cdf65661 100644 --- a/onchain/rollups/export/abi/optimism.json +++ b/onchain/rollups/export/abi/optimism.json @@ -1048,154 +1048,6 @@ "type": "function" } ] - }, - "AuthorityHistoryPairFactory": { - "address": "0x3890A047Cf9Af60731E80B2105362BbDCD70142D", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IAuthorityFactory", - "name": "_authorityFactory", - "type": "address" - }, - { - "internalType": "contract IHistoryFactory", - "name": "_historyFactory", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract IAuthorityFactory", - "name": "authorityFactory", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract IHistoryFactory", - "name": "historyFactory", - "type": "address" - } - ], - "name": "AuthorityHistoryPairFactoryCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateAuthorityHistoryAddressPair", - "outputs": [ - { - "internalType": "address", - "name": "authorityAddress_", - "type": "address" - }, - { - "internalType": "address", - "name": "historyAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getAuthorityFactory", - "outputs": [ - { - "internalType": "contract IAuthorityFactory", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getHistoryFactory", - "outputs": [ - { - "internalType": "contract IHistoryFactory", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - } - ], - "name": "newAuthorityHistoryPair", - "outputs": [ - { - "internalType": "contract Authority", - "name": "authority_", - "type": "address" - }, - { - "internalType": "contract History", - "name": "history_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newAuthorityHistoryPair", - "outputs": [ - { - "internalType": "contract Authority", - "name": "authority_", - "type": "address" - }, - { - "internalType": "contract History", - "name": "history_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ] } } -} \ No newline at end of file +} diff --git a/onchain/rollups/export/abi/optimism_goerli.json b/onchain/rollups/export/abi/optimism_goerli.json index f7fed2f9..34ac1348 100644 --- a/onchain/rollups/export/abi/optimism_goerli.json +++ b/onchain/rollups/export/abi/optimism_goerli.json @@ -93,154 +93,6 @@ } ] }, - "AuthorityHistoryPairFactory": { - "address": "0x3890A047Cf9Af60731E80B2105362BbDCD70142D", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IAuthorityFactory", - "name": "_authorityFactory", - "type": "address" - }, - { - "internalType": "contract IHistoryFactory", - "name": "_historyFactory", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract IAuthorityFactory", - "name": "authorityFactory", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract IHistoryFactory", - "name": "historyFactory", - "type": "address" - } - ], - "name": "AuthorityHistoryPairFactoryCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateAuthorityHistoryAddressPair", - "outputs": [ - { - "internalType": "address", - "name": "authorityAddress_", - "type": "address" - }, - { - "internalType": "address", - "name": "historyAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getAuthorityFactory", - "outputs": [ - { - "internalType": "contract IAuthorityFactory", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getHistoryFactory", - "outputs": [ - { - "internalType": "contract IHistoryFactory", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - } - ], - "name": "newAuthorityHistoryPair", - "outputs": [ - { - "internalType": "contract Authority", - "name": "authority_", - "type": "address" - }, - { - "internalType": "contract History", - "name": "history_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newAuthorityHistoryPair", - "outputs": [ - { - "internalType": "contract Authority", - "name": "authority_", - "type": "address" - }, - { - "internalType": "contract History", - "name": "history_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ] - }, "CartesiDAppFactory": { "address": "0x7122cd1221C20892234186facfE8615e6743Ab02", "abi": [ @@ -1198,4 +1050,4 @@ ] } } -} \ No newline at end of file +} diff --git a/onchain/rollups/export/abi/sepolia.json b/onchain/rollups/export/abi/sepolia.json index d9e043e9..ea85cb84 100644 --- a/onchain/rollups/export/abi/sepolia.json +++ b/onchain/rollups/export/abi/sepolia.json @@ -93,154 +93,6 @@ } ] }, - "AuthorityHistoryPairFactory": { - "address": "0x3890A047Cf9Af60731E80B2105362BbDCD70142D", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IAuthorityFactory", - "name": "_authorityFactory", - "type": "address" - }, - { - "internalType": "contract IHistoryFactory", - "name": "_historyFactory", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract IAuthorityFactory", - "name": "authorityFactory", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract IHistoryFactory", - "name": "historyFactory", - "type": "address" - } - ], - "name": "AuthorityHistoryPairFactoryCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateAuthorityHistoryAddressPair", - "outputs": [ - { - "internalType": "address", - "name": "authorityAddress_", - "type": "address" - }, - { - "internalType": "address", - "name": "historyAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getAuthorityFactory", - "outputs": [ - { - "internalType": "contract IAuthorityFactory", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getHistoryFactory", - "outputs": [ - { - "internalType": "contract IHistoryFactory", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - } - ], - "name": "newAuthorityHistoryPair", - "outputs": [ - { - "internalType": "contract Authority", - "name": "authority_", - "type": "address" - }, - { - "internalType": "contract History", - "name": "history_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newAuthorityHistoryPair", - "outputs": [ - { - "internalType": "contract Authority", - "name": "authority_", - "type": "address" - }, - { - "internalType": "contract History", - "name": "history_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ] - }, "CartesiDAppFactory": { "address": "0x7122cd1221C20892234186facfE8615e6743Ab02", "abi": [ @@ -1198,4 +1050,4 @@ ] } } -} \ No newline at end of file +} diff --git a/onchain/rollups/test/foundry/consensus/authority/AuthorityHistoryPairFactory.t.sol b/onchain/rollups/test/foundry/consensus/authority/AuthorityHistoryPairFactory.t.sol deleted file mode 100644 index 6eb60f2a..00000000 --- a/onchain/rollups/test/foundry/consensus/authority/AuthorityHistoryPairFactory.t.sol +++ /dev/null @@ -1,256 +0,0 @@ -// (c) Cartesi and individual authors (see AUTHORS) -// SPDX-License-Identifier: Apache-2.0 (see LICENSE) - -/// @title Authority-History Pair Factory Test -pragma solidity ^0.8.8; - -import {Test} from "forge-std/Test.sol"; -import {AuthorityHistoryPairFactory} from "contracts/consensus/authority/AuthorityHistoryPairFactory.sol"; -import {IAuthorityFactory} from "contracts/consensus/authority/IAuthorityFactory.sol"; -import {AuthorityFactory} from "contracts/consensus/authority/AuthorityFactory.sol"; -import {Authority} from "contracts/consensus/authority/Authority.sol"; -import {IHistoryFactory} from "contracts/history/IHistoryFactory.sol"; -import {HistoryFactory} from "contracts/history/HistoryFactory.sol"; -import {History} from "contracts/history/History.sol"; -import {IHistory} from "contracts/history/IHistory.sol"; -import {Vm} from "forge-std/Vm.sol"; - -contract AuthorityHistoryPairFactoryTest is Test { - AuthorityFactory authorityFactory; - HistoryFactory historyFactory; - AuthorityHistoryPairFactory factory; - - event AuthorityHistoryPairFactoryCreated( - IAuthorityFactory authorityFactory, - IHistoryFactory historyFactory - ); - - struct FactoryCreatedEventData { - IAuthorityFactory authorityFactory; - IHistoryFactory historyFactory; - } - - event AuthorityCreated(address authorityOwner, Authority authority); - - struct AuthorityCreatedEventData { - address authorityOwner; - Authority authority; - } - - event HistoryCreated(address historyOwner, History history); - - struct HistoryCreatedEventData { - address historyOwner; - History history; - } - - event NewHistory(IHistory history); - - event OwnershipTransferred( - address indexed previousOwner, - address indexed newOwner - ); - - function setUp() public { - authorityFactory = new AuthorityFactory(); - historyFactory = new HistoryFactory(); - factory = new AuthorityHistoryPairFactory( - authorityFactory, - historyFactory - ); - } - - function testFactoryCreation() public { - vm.recordLogs(); - - factory = new AuthorityHistoryPairFactory( - authorityFactory, - historyFactory - ); - - Vm.Log[] memory entries = vm.getRecordedLogs(); - - uint256 numOfFactoryCreated; - - for (uint256 i; i < entries.length; ++i) { - Vm.Log memory entry = entries[i]; - - if ( - entry.emitter == address(factory) && - entry.topics[0] == AuthorityHistoryPairFactoryCreated.selector - ) { - ++numOfFactoryCreated; - - FactoryCreatedEventData memory eventData; - - eventData = abi.decode(entry.data, (FactoryCreatedEventData)); - - assertEq( - address(authorityFactory), - address(eventData.authorityFactory) - ); - assertEq( - address(historyFactory), - address(eventData.historyFactory) - ); - } - } - - assertEq(numOfFactoryCreated, 1); - - assertEq( - address(factory.getAuthorityFactory()), - address(authorityFactory) - ); - assertEq(address(factory.getHistoryFactory()), address(historyFactory)); - } - - function testNewAuthorityHistoryPair(address _authorityOwner) public { - vm.assume(_authorityOwner != address(0)); - - vm.recordLogs(); - - (Authority authority, History history) = factory - .newAuthorityHistoryPair(_authorityOwner); - - testNewAuthorityHistoryPairAux(_authorityOwner, authority, history); - } - - function testNewAuthorityHistoryPairAux( - address _authorityOwner, - Authority _authority, - History _history - ) internal { - Vm.Log[] memory entries = vm.getRecordedLogs(); - - uint256 numOfAuthorityCreated; - uint256 numOfHistoryCreated; - uint256 numOfNewHistory; - uint256 numOfAuthorityOwnershipTransferred; - uint256 numOfHistoryOwnershipTransferred; - - for (uint256 i; i < entries.length; ++i) { - Vm.Log memory entry = entries[i]; - - if ( - entry.emitter == address(authorityFactory) && - entry.topics[0] == AuthorityCreated.selector - ) { - ++numOfAuthorityCreated; - - AuthorityCreatedEventData memory eventData; - - eventData = abi.decode(entry.data, (AuthorityCreatedEventData)); - - assertEq(address(factory), eventData.authorityOwner); - assertEq(address(_authority), address(eventData.authority)); - } - - if ( - entry.emitter == address(historyFactory) && - entry.topics[0] == HistoryCreated.selector - ) { - ++numOfHistoryCreated; - - HistoryCreatedEventData memory eventData; - - eventData = abi.decode(entry.data, (HistoryCreatedEventData)); - - assertEq(address(_authority), eventData.historyOwner); - assertEq(address(_history), address(eventData.history)); - } - - if ( - entry.emitter == address(_authority) && - entry.topics[0] == NewHistory.selector - ) { - ++numOfNewHistory; - - IHistory history = abi.decode(entry.data, (IHistory)); - - assertEq(address(_history), address(history)); - } - - if ( - entry.emitter == address(_authority) && - entry.topics[0] == OwnershipTransferred.selector - ) { - ++numOfAuthorityOwnershipTransferred; - - address a = address(uint160(uint256(entry.topics[1]))); - address b = address(uint160(uint256(entry.topics[2]))); - - if (numOfAuthorityOwnershipTransferred == 1) { - assertEq(address(0), a); - assertEq(address(authorityFactory), b); - } else if (numOfAuthorityOwnershipTransferred == 2) { - assertEq(address(authorityFactory), a); - assertEq(address(factory), b); - } else if (numOfAuthorityOwnershipTransferred == 3) { - assertEq(address(factory), a); - assertEq(address(_authorityOwner), b); - } - } - - if ( - entry.emitter == address(_history) && - entry.topics[0] == OwnershipTransferred.selector - ) { - ++numOfHistoryOwnershipTransferred; - - address a = address(uint160(uint256(entry.topics[1]))); - address b = address(uint160(uint256(entry.topics[2]))); - - if (numOfHistoryOwnershipTransferred == 1) { - assertEq(address(0), a); - assertEq(address(historyFactory), b); - } else if (numOfHistoryOwnershipTransferred == 2) { - assertEq(address(historyFactory), a); - assertEq(address(_authority), b); - } - } - } - - assertEq(numOfAuthorityCreated, 1); - assertEq(numOfHistoryCreated, 1); - assertEq(numOfNewHistory, 1); - assertEq(numOfAuthorityOwnershipTransferred, 3); - assertEq(numOfHistoryOwnershipTransferred, 2); - - assertEq(address(_authority.owner()), _authorityOwner); - assertEq(address(_authority.getHistory()), address(_history)); - assertEq(address(_history.owner()), address(_authority)); - } - - function testNewAuthorityHistoryPairDeterministic( - address _authorityOwner, - bytes32 _salt - ) public { - vm.assume(_authorityOwner != address(0)); - - (address authorityAddress, address historyAddress) = factory - .calculateAuthorityHistoryAddressPair(_authorityOwner, _salt); - - vm.recordLogs(); - - (Authority authority, History history) = factory - .newAuthorityHistoryPair(_authorityOwner, _salt); - - testNewAuthorityHistoryPairAux(_authorityOwner, authority, history); - - // Precalculated addresses must match actual addresses - assertEq(authorityAddress, address(authority)); - assertEq(historyAddress, address(history)); - - (authorityAddress, historyAddress) = factory - .calculateAuthorityHistoryAddressPair(_authorityOwner, _salt); - - // Precalculated addresses must STILL match actual addresses - assertEq(authorityAddress, address(authority)); - assertEq(historyAddress, address(history)); - - // Cannot deploy an authority-history pair with the same salt twice - vm.expectRevert(); - factory.newAuthorityHistoryPair(_authorityOwner, _salt); - } -}