From 8772f7db8ce77aa49f6756d6ee788a8e4f7bc98b Mon Sep 17 00:00:00 2001 From: Guilherme Dantas Date: Thu, 10 Oct 2024 12:09:42 -0300 Subject: [PATCH] feat: deploy contracts to Ethereum Sepolia --- deployments/sepolia/ApplicationFactory.json | 106 +-- deployments/sepolia/AuthorityFactory.json | 91 +- deployments/sepolia/ERC1155BatchPortal.json | 49 +- deployments/sepolia/ERC1155SinglePortal.json | 49 +- deployments/sepolia/ERC20Portal.json | 49 +- deployments/sepolia/ERC721Portal.json | 49 +- deployments/sepolia/EtherPortal.json | 49 +- deployments/sepolia/InputBox.json | 28 +- deployments/sepolia/QuorumFactory.json | 76 +- .../sepolia/SelfHostedApplicationFactory.json | 83 +- export/abi/sepolia.json | 840 +++++------------- 11 files changed, 471 insertions(+), 998 deletions(-) diff --git a/deployments/sepolia/ApplicationFactory.json b/deployments/sepolia/ApplicationFactory.json index 62a40ddb..11b177a0 100644 --- a/deployments/sepolia/ApplicationFactory.json +++ b/deployments/sepolia/ApplicationFactory.json @@ -1,5 +1,5 @@ { - "address": "0x159876e08d642c2Fe9a52804756189E1DbF497F0", + "address": "0x1d4CfBD2622d802A07CeB4C3401Bbb455c9dbdC3", "abi": [ { "anonymous": false, @@ -10,18 +10,6 @@ "name": "consensus", "type": "address" }, - { - "indexed": false, - "internalType": "contract IInputBox", - "name": "inputBox", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract IPortal[]", - "name": "portals", - "type": "address[]" - }, { "indexed": false, "internalType": "address", @@ -36,7 +24,7 @@ }, { "indexed": false, - "internalType": "contract Application", + "internalType": "contract IApplication", "name": "appContract", "type": "address" } @@ -51,16 +39,6 @@ "name": "consensus", "type": "address" }, - { - "internalType": "contract IInputBox", - "name": "inputBox", - "type": "address" - }, - { - "internalType": "contract IPortal[]", - "name": "portals", - "type": "address[]" - }, { "internalType": "address", "name": "appOwner", @@ -95,16 +73,6 @@ "name": "consensus", "type": "address" }, - { - "internalType": "contract IInputBox", - "name": "inputBox", - "type": "address" - }, - { - "internalType": "contract IPortal[]", - "name": "portals", - "type": "address[]" - }, { "internalType": "address", "name": "appOwner", @@ -124,7 +92,7 @@ "name": "newApplication", "outputs": [ { - "internalType": "contract Application", + "internalType": "contract IApplication", "name": "", "type": "address" } @@ -139,16 +107,6 @@ "name": "consensus", "type": "address" }, - { - "internalType": "contract IInputBox", - "name": "inputBox", - "type": "address" - }, - { - "internalType": "contract IPortal[]", - "name": "portals", - "type": "address[]" - }, { "internalType": "address", "name": "appOwner", @@ -163,7 +121,7 @@ "name": "newApplication", "outputs": [ { - "internalType": "contract Application", + "internalType": "contract IApplication", "name": "", "type": "address" } @@ -172,51 +130,47 @@ "type": "function" } ], - "transactionHash": "0x891a20cc787aac3a57112a1a075ca1f068a680d647a9f3ac6b613375425d2789", + "transactionHash": "0x86d4f4a15458acf7fcf1754371b2e9f5747203fb09ae4212675adebeec51afca", "receipt": { "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0xB25D9D56f5877Ca869A0362c324aCC2F1465AF1B", + "from": "0xeA4037a524309056545fbAd9A688f449E7e05ffB", "contractAddress": null, - "transactionIndex": 82, - "gasUsed": "1652273", + "transactionIndex": 39, + "gasUsed": "1273228", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x8f2ebe13f36963c528b5de44db3fbde087f2b109468588611ac507d19593309f", - "transactionHash": "0x891a20cc787aac3a57112a1a075ca1f068a680d647a9f3ac6b613375425d2789", + "blockHash": "0xe35ca2e4bc8f9596af24a8760b613116d3281f8703cb85ba87d7540ea905f87c", + "transactionHash": "0x86d4f4a15458acf7fcf1754371b2e9f5747203fb09ae4212675adebeec51afca", "logs": [], - "blockNumber": 6099864, - "cumulativeGasUsed": "14848930", + "blockNumber": 6850943, + "cumulativeGasUsed": "8920846", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 1, - "solcInputHash": "d5e580c56a1973c1da5089d8c687e7bd", - "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IConsensus\",\"name\":\"consensus\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract IInputBox\",\"name\":\"inputBox\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract IPortal[]\",\"name\":\"portals\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"appOwner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"templateHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"contract Application\",\"name\":\"appContract\",\"type\":\"address\"}],\"name\":\"ApplicationCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"contract IConsensus\",\"name\":\"consensus\",\"type\":\"address\"},{\"internalType\":\"contract IInputBox\",\"name\":\"inputBox\",\"type\":\"address\"},{\"internalType\":\"contract IPortal[]\",\"name\":\"portals\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"appOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"templateHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"}],\"name\":\"calculateApplicationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IConsensus\",\"name\":\"consensus\",\"type\":\"address\"},{\"internalType\":\"contract IInputBox\",\"name\":\"inputBox\",\"type\":\"address\"},{\"internalType\":\"contract IPortal[]\",\"name\":\"portals\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"appOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"templateHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"}],\"name\":\"newApplication\",\"outputs\":[{\"internalType\":\"contract Application\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IConsensus\",\"name\":\"consensus\",\"type\":\"address\"},{\"internalType\":\"contract IInputBox\",\"name\":\"inputBox\",\"type\":\"address\"},{\"internalType\":\"contract IPortal[]\",\"name\":\"portals\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"appOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"templateHash\",\"type\":\"bytes32\"}],\"name\":\"newApplication\",\"outputs\":[{\"internalType\":\"contract Application\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"ApplicationCreated(address,address,address[],address,bytes32,address)\":{\"details\":\"MUST be triggered on a successful call to `newApplication`.\",\"params\":{\"appContract\":\"The application contract\",\"appOwner\":\"The initial application owner\",\"consensus\":\"The initial consensus contract\",\"inputBox\":\"The input box contract\",\"portals\":\"The portals supported by the application\",\"templateHash\":\"The initial machine state hash\"}}},\"kind\":\"dev\",\"methods\":{\"calculateApplicationAddress(address,address,address[],address,bytes32,bytes32)\":{\"details\":\"Beware that only the `newApplication` function with the `salt` parameter is able to deterministically deploy an application.\",\"params\":{\"appOwner\":\"The initial application owner\",\"consensus\":\"The initial consensus contract\",\"inputBox\":\"The input box contract\",\"portals\":\"The portals supported by the application\",\"salt\":\"The salt used to deterministically generate the application contract address\",\"templateHash\":\"The initial machine state hash\"},\"returns\":{\"_0\":\"The deterministic application contract address\"}},\"newApplication(address,address,address[],address,bytes32)\":{\"details\":\"On success, MUST emit an `ApplicationCreated` event.\",\"params\":{\"appOwner\":\"The initial application owner\",\"consensus\":\"The initial consensus contract\",\"inputBox\":\"The input box contract\",\"portals\":\"The portals supported by the application\",\"templateHash\":\"The initial machine state hash\"},\"returns\":{\"_0\":\"The application\"}},\"newApplication(address,address,address[],address,bytes32,bytes32)\":{\"details\":\"On success, MUST emit an `ApplicationCreated` event.\",\"params\":{\"appOwner\":\"The initial application owner\",\"consensus\":\"The initial consensus contract\",\"inputBox\":\"The input box contract\",\"portals\":\"The portals supported by the application\",\"salt\":\"The salt used to deterministically generate the application contract address\",\"templateHash\":\"The initial machine state hash\"},\"returns\":{\"_0\":\"The application\"}}},\"title\":\"Application Factory\",\"version\":1},\"userdoc\":{\"events\":{\"ApplicationCreated(address,address,address[],address,bytes32,address)\":{\"notice\":\"A new application was deployed.\"}},\"kind\":\"user\",\"methods\":{\"calculateApplicationAddress(address,address,address[],address,bytes32,bytes32)\":{\"notice\":\"Calculate the address of an application contract to be deployed deterministically.\"},\"newApplication(address,address,address[],address,bytes32)\":{\"notice\":\"Deploy a new application.\"},\"newApplication(address,address,address[],address,bytes32,bytes32)\":{\"notice\":\"Deploy a new application deterministically.\"}},\"notice\":\"Allows anyone to reliably deploy a new `Application` contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dapp/ApplicationFactory.sol\":\"ApplicationFactory\"},\"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 v5.0.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {Context} from \\\"../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 * The initial owner is set to the address provided by the deployer. This can\\n * 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 /**\\n * @dev The caller account is not authorized to perform an operation.\\n */\\n error OwnableUnauthorizedAccount(address account);\\n\\n /**\\n * @dev The owner is not a valid owner account. (eg. `address(0)`)\\n */\\n error OwnableInvalidOwner(address owner);\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\\n */\\n constructor(address initialOwner) {\\n if (initialOwner == address(0)) {\\n revert OwnableInvalidOwner(address(0));\\n }\\n _transferOwnership(initialOwner);\\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 if (owner() != _msgSender()) {\\n revert OwnableUnauthorizedAccount(_msgSender());\\n }\\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 if (newOwner == address(0)) {\\n revert OwnableInvalidOwner(address(0));\\n }\\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\":\"0xff6d0bb2e285473e5311d9d3caacb525ae3538a80758c10649a4d61029b017bb\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155Receiver.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Interface that must be implemented by smart contracts in order to receive\\n * ERC-1155 token transfers.\\n */\\ninterface IERC1155Receiver is IERC165 {\\n /**\\n * @dev Handles the receipt of a single ERC1155 token type. This function is\\n * called at the end of a `safeTransferFrom` after the balance has been updated.\\n *\\n * NOTE: To accept the transfer, this must return\\n * `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))`\\n * (i.e. 0xf23a6e61, or its own function selector).\\n *\\n * @param operator The address which initiated the transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param id The ID of the token being transferred\\n * @param value The amount of tokens being transferred\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155Received(\\n address operator,\\n address from,\\n uint256 id,\\n uint256 value,\\n bytes calldata data\\n ) external returns (bytes4);\\n\\n /**\\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\\n * is called at the end of a `safeBatchTransferFrom` after the balances have\\n * been updated.\\n *\\n * NOTE: To accept the transfer(s), this must return\\n * `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))`\\n * (i.e. 0xbc197c81, or its own function selector).\\n *\\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155BatchReceived(\\n address operator,\\n address from,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xb69597a63b202e28401128bed6a6d259e8730191274471af7303eafb247881a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/utils/ERC1155Holder.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165, ERC165} from \\\"../../../utils/introspection/ERC165.sol\\\";\\nimport {IERC1155Receiver} from \\\"../IERC1155Receiver.sol\\\";\\n\\n/**\\n * @dev Simple implementation of `IERC1155Receiver` that will allow a contract to hold ERC1155 tokens.\\n *\\n * IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be\\n * stuck.\\n */\\nabstract contract ERC1155Holder is ERC165, IERC1155Receiver {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\\n return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n function onERC1155Received(\\n address,\\n address,\\n uint256,\\n uint256,\\n bytes memory\\n ) public virtual override returns (bytes4) {\\n return this.onERC1155Received.selector;\\n }\\n\\n function onERC1155BatchReceived(\\n address,\\n address,\\n uint256[] memory,\\n uint256[] memory,\\n bytes memory\\n ) public virtual override returns (bytes4) {\\n return this.onERC1155BatchReceived.selector;\\n }\\n}\\n\",\"keccak256\":\"0xc26cd2e2bcf59b87c986fc653545b35010db9c585a3f3312fe61d7b1b3805735\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be\\n * reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0x7f7a26306c79a65fb8b3b6c757cd74660c532cd8a02e165488e30027dd34ca49\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/utils/ERC721Holder.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC721Receiver} from \\\"../IERC721Receiver.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC721Receiver} interface.\\n *\\n * Accepts all token transfers.\\n * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or\\n * {IERC721-setApprovalForAll}.\\n */\\nabstract contract ERC721Holder is IERC721Receiver {\\n /**\\n * @dev See {IERC721Receiver-onERC721Received}.\\n *\\n * Always returns `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(address, address, uint256, bytes memory) public virtual returns (bytes4) {\\n return this.onERC721Received.selector;\\n }\\n}\\n\",\"keccak256\":\"0xaad20f8713b5cd98114278482d5d91b9758f9727048527d582e8e88fd4901fd8\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\\n\\npragma solidity ^0.8.20;\\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 function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Not enough balance for performing a CREATE2 deploy.\\n */\\n error Create2InsufficientBalance(uint256 balance, uint256 needed);\\n\\n /**\\n * @dev There's no code to deploy.\\n */\\n error Create2EmptyBytecode();\\n\\n /**\\n * @dev The deployment failed.\\n */\\n error Create2FailedDeployment();\\n\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\\n if (address(this).balance < amount) {\\n revert Create2InsufficientBalance(address(this).balance, amount);\\n }\\n if (bytecode.length == 0) {\\n revert Create2EmptyBytecode();\\n }\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n if (addr == address(0)) {\\n revert Create2FailedDeployment();\\n }\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2b9807d194b92f1068d868e9587d27037264a9a067c778486f86ae21c61cbd5e\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant NOT_ENTERED = 1;\\n uint256 private constant ENTERED = 2;\\n\\n uint256 private _status;\\n\\n /**\\n * @dev Unauthorized reentrant call.\\n */\\n error ReentrancyGuardReentrantCall();\\n\\n constructor() {\\n _status = NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and making it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n _nonReentrantBefore();\\n _;\\n _nonReentrantAfter();\\n }\\n\\n function _nonReentrantBefore() private {\\n // On the first call to nonReentrant, _status will be NOT_ENTERED\\n if (_status == ENTERED) {\\n revert ReentrancyGuardReentrantCall();\\n }\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = ENTERED;\\n }\\n\\n function _nonReentrantAfter() private {\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Returns true if the reentrancy guard is currently set to \\\"entered\\\", which indicates there is a\\n * `nonReentrant` function in the call stack.\\n */\\n function _reentrancyGuardEntered() internal view returns (bool) {\\n return _status == ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0xf980daa263b661ab8ddee7d4fd833c7da7e7995e2c359ff1f17e67e4112f2236\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0x9e8778b14317ba9e256c30a76fd6c32b960af621987f56069e1e819c77c6a133\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x4296879f55019b23e135000eb36896057e7101fb7fb859c5ef690cf14643757b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/structs/BitMaps.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/BitMaps.sol)\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Library for managing uint256 to bool mapping in a compact and efficient way, provided the keys are sequential.\\n * Largely inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor].\\n *\\n * BitMaps pack 256 booleans across each bit of a single 256-bit slot of `uint256` type.\\n * Hence booleans corresponding to 256 _sequential_ indices would only consume a single slot,\\n * unlike the regular `bool` which would consume an entire slot for a single value.\\n *\\n * This results in gas savings in two ways:\\n *\\n * - Setting a zero value to non-zero only once every 256 times\\n * - Accessing the same warm slot for every 256 _sequential_ indices\\n */\\nlibrary BitMaps {\\n struct BitMap {\\n mapping(uint256 bucket => uint256) _data;\\n }\\n\\n /**\\n * @dev Returns whether the bit at `index` is set.\\n */\\n function get(BitMap storage bitmap, uint256 index) internal view returns (bool) {\\n uint256 bucket = index >> 8;\\n uint256 mask = 1 << (index & 0xff);\\n return bitmap._data[bucket] & mask != 0;\\n }\\n\\n /**\\n * @dev Sets the bit at `index` to the boolean `value`.\\n */\\n function setTo(BitMap storage bitmap, uint256 index, bool value) internal {\\n if (value) {\\n set(bitmap, index);\\n } else {\\n unset(bitmap, index);\\n }\\n }\\n\\n /**\\n * @dev Sets the bit at `index`.\\n */\\n function set(BitMap storage bitmap, uint256 index) internal {\\n uint256 bucket = index >> 8;\\n uint256 mask = 1 << (index & 0xff);\\n bitmap._data[bucket] |= mask;\\n }\\n\\n /**\\n * @dev Unsets the bit at `index`.\\n */\\n function unset(BitMap storage bitmap, uint256 index) internal {\\n uint256 bucket = index >> 8;\\n uint256 mask = 1 << (index & 0xff);\\n bitmap._data[bucket] &= ~mask;\\n }\\n}\\n\",\"keccak256\":\"0x3616f1b0d0a9ee1ca8f0953ecaceb9230e36f691c7974d30f964212acff52d2b\",\"license\":\"MIT\"},\"contracts/common/CanonicalMachine.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 Canonical Machine Constants Library\\n///\\n/// @notice Defines several constants related to the reference implementation\\n/// of the RISC-V machine that runs Linux, also known as the \\\"Cartesi Machine\\\".\\nlibrary CanonicalMachine {\\n /// @notice Maximum input size (2 megabytes).\\n uint256 constant INPUT_MAX_SIZE = 1 << 21;\\n\\n /// @notice Log of maximum number of inputs per epoch.\\n uint256 constant LOG2_MAX_INPUTS_PER_EPOCH = 32;\\n\\n /// @notice Log of maximum number of outputs per input.\\n uint256 constant LOG2_MAX_OUTPUTS_PER_INPUT = 16;\\n}\\n\",\"keccak256\":\"0xad91c1e0080fd40f53def31cb87106dedef26fc506aa569f43a77b8fcdc53a77\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/common/InputRange.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/// @notice A range of input indices.\\n/// @param firstIndex The index of the first input\\n/// @param lastIndex The index of the last input\\nstruct InputRange {\\n uint64 firstIndex;\\n uint64 lastIndex;\\n}\\n\",\"keccak256\":\"0x4825516380f1fb39d5b15e99c1b08e07c636dc062ad3036093e78ba8e624cd33\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/common/OutputValidityProof.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 {InputRange} from \\\"./InputRange.sol\\\";\\n\\n/// @param inputRange The range of inputs accepted during the epoch\\n/// @param inputIndexWithinEpoch Which input, inside the epoch, the output belongs to\\n/// @param outputIndexWithinInput Index of output emitted by the input\\n/// @param outputHashesRootHash Merkle root of hashes of outputs emitted by the input\\n/// @param outputsEpochRootHash Merkle root of all epoch's outputs metadata hashes\\n/// @param machineStateHash Hash of the machine state claimed this epoch\\n/// @param outputHashInOutputHashesSiblings Proof that this output metadata is in metadata memory range\\n/// @param outputHashesInEpochSiblings Proof that this output metadata is in epoch's output memory range\\nstruct OutputValidityProof {\\n InputRange inputRange;\\n uint64 inputIndexWithinEpoch;\\n uint64 outputIndexWithinInput;\\n bytes32 outputHashesRootHash;\\n bytes32 outputsEpochRootHash;\\n bytes32 machineStateHash;\\n bytes32[] outputHashInOutputHashesSiblings;\\n bytes32[] outputHashesInEpochSiblings;\\n}\\n\",\"keccak256\":\"0xf60efcea5b54d6b5c659460fc205ae04b16d89c72dee86e7b2c1e1edb6a52d65\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/common/Outputs.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 Outputs\\n/// @notice Defines the signatures of outputs that can be generated by the\\n/// off-chain machine and verified by the on-chain contracts.\\ninterface Outputs {\\n /// @notice A piece of verifiable information.\\n /// @param payload An arbitrary payload.\\n function Notice(bytes calldata payload) external;\\n\\n /// @notice A single-use permission to execute a specific message call\\n /// from the context of the application contract.\\n /// @param destination The address that will be called\\n /// @param value The amount of Wei to be transferred through the call\\n /// @param payload The payload, which\\u2014in the case of Solidity\\n /// contracts\\u2014encodes a function call\\n function Voucher(\\n address destination,\\n uint256 value,\\n bytes calldata payload\\n ) external;\\n\\n /// @notice A single-use permission to execute a specific delegate call\\n /// from the context of the application contract.\\n /// @param destination The address that will be called\\n /// @param payload The payload, which\\u2014in the case of Solidity\\n /// libraries\\u2014encodes a function call\\n function DelegateCallVoucher(\\n address destination,\\n bytes calldata payload\\n ) external;\\n}\\n\",\"keccak256\":\"0xaee9d71104bfe2fab21d4e26f3ed802439d6c2e1bc5aeb9bfc5090f4083bd542\",\"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\\nimport {InputRange} from \\\"../common/InputRange.sol\\\";\\n\\n/// @notice Provides data availability of epoch hashes for applications.\\n/// @notice An epoch hash is produced after the machine processes a range of inputs and the epoch is finalized.\\n/// This hash can be later used to prove that any given output was produced by the machine during the epoch.\\n/// @notice After an epoch is finalized, a validator may submit a claim containing the application contract address,\\n/// the range of inputs accepted during the epoch, and the epoch hash.\\n/// @notice Validators may synchronize epoch finalization, but such mechanism is not specified by this interface.\\n/// @notice A validator should be able to save transaction fees by not submitting a claim if it was...\\n/// - already submitted by the validator (see the `ClaimSubmission` event) or;\\n/// - already accepted by the consensus (see the `ClaimAcceptance` event).\\n/// @notice The acceptance criteria for claims may depend on the type of consensus, and is not specified by this interface.\\n/// For example, a claim may be accepted if it was...\\n/// - submitted by an authority or;\\n/// - submitted by the majority of a quorum or;\\n/// - submitted and not proven wrong after some period of time.\\ninterface IConsensus {\\n /// @notice MUST trigger when a claim is submitted.\\n /// @param submitter The submitter address\\n /// @param appContract The application contract address\\n /// @param inputRange The input range\\n /// @param epochHash The epoch hash\\n /// @dev Overwrites any previous submissions regarding `submitter`, `appContract` and `inputRange`.\\n event ClaimSubmission(\\n address indexed submitter,\\n address indexed appContract,\\n InputRange inputRange,\\n bytes32 epochHash\\n );\\n\\n /// @notice MUST trigger when a claim is accepted.\\n /// @param appContract The application contract address\\n /// @param inputRange The input range\\n /// @param epochHash The epoch hash\\n /// @dev MUST be triggered after some `ClaimSubmission` event regarding `appContract`, `inputRange` and `epochHash`.\\n /// @dev Overwrites any previous acceptances regarding `appContract` and `inputRange`.\\n event ClaimAcceptance(\\n address indexed appContract,\\n InputRange inputRange,\\n bytes32 epochHash\\n );\\n\\n /// @notice Submit a claim to the consensus.\\n /// @param appContract The application contract address\\n /// @param inputRange The input range\\n /// @param epochHash The epoch hash\\n /// @dev MUST fire a `ClaimSubmission` event.\\n /// @dev MAY fire a `ClaimAcceptance` event, if the acceptance criteria is met.\\n function submitClaim(\\n address appContract,\\n InputRange calldata inputRange,\\n bytes32 epochHash\\n ) external;\\n\\n /// @notice Get the epoch hash for a certain application and input range.\\n /// @param appContract The application contract address\\n /// @param inputRange The input range\\n /// @return epochHash The epoch hash\\n /// @dev For claimed epochs, must return the epoch hash of the last accepted claim.\\n /// @dev For unclaimed epochs, MUST either revert or return `bytes32(0)`.\\n function getEpochHash(\\n address appContract,\\n InputRange calldata inputRange\\n ) external view returns (bytes32 epochHash);\\n}\\n\",\"keccak256\":\"0xd2ea451e450f6b3b01bd77b95dbb00465d263cae9285a03c8ffd0d96c4d75dc1\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/Application.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 {IApplication} from \\\"./IApplication.sol\\\";\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {IPortal} from \\\"../portals/IPortal.sol\\\";\\nimport {LibOutputValidityProof} from \\\"../library/LibOutputValidityProof.sol\\\";\\nimport {OutputValidityProof} from \\\"../common/OutputValidityProof.sol\\\";\\nimport {Outputs} from \\\"../common/Outputs.sol\\\";\\nimport {InputRange} from \\\"../common/InputRange.sol\\\";\\nimport {LibInputRange} from \\\"../library/LibInputRange.sol\\\";\\nimport {LibAddress} from \\\"../library/LibAddress.sol\\\";\\n\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {ERC721Holder} from \\\"@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol\\\";\\nimport {ERC1155Holder} from \\\"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol\\\";\\nimport {ReentrancyGuard} from \\\"@openzeppelin/contracts/utils/ReentrancyGuard.sol\\\";\\nimport {IERC721Receiver} from \\\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\\\";\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport {BitMaps} from \\\"@openzeppelin/contracts/utils/structs/BitMaps.sol\\\";\\n\\ncontract Application is\\n IApplication,\\n Ownable,\\n ERC721Holder,\\n ERC1155Holder,\\n ReentrancyGuard\\n{\\n using BitMaps for BitMaps.BitMap;\\n using LibAddress for address;\\n using LibOutputValidityProof for OutputValidityProof;\\n using LibInputRange for InputRange;\\n\\n /// @notice The initial machine state hash.\\n /// @dev See the `getTemplateHash` function.\\n bytes32 internal immutable _templateHash;\\n\\n /// @notice Keeps track of which outputs have been executed.\\n /// @dev See the `wasOutputExecuted` function.\\n mapping(uint256 => BitMaps.BitMap) internal _executed;\\n\\n /// @notice The current consensus contract.\\n /// @dev See the `getConsensus` and `migrateToConsensus` functions.\\n IConsensus internal _consensus;\\n\\n /// @notice The input box contract.\\n /// @dev See the `getInputBox` function.\\n IInputBox internal immutable _inputBox;\\n\\n /// @notice The portals supported by the application.\\n /// @dev See the `getPortals` function.\\n IPortal[] internal _portals;\\n\\n /// @notice Creates an `Application` contract.\\n /// @param consensus The initial consensus contract\\n /// @param inputBox The input box contract\\n /// @param portals The portals supported by the application\\n /// @param initialOwner The initial application owner\\n /// @param templateHash The initial machine state hash\\n constructor(\\n IConsensus consensus,\\n IInputBox inputBox,\\n IPortal[] memory portals,\\n address initialOwner,\\n bytes32 templateHash\\n ) Ownable(initialOwner) {\\n _templateHash = templateHash;\\n _consensus = consensus;\\n _inputBox = inputBox;\\n for (uint256 i; i < portals.length; ++i) {\\n _portals.push(portals[i]);\\n }\\n }\\n\\n /// @notice Accept Ether transfers.\\n /// @dev If you wish to transfer Ether to an application while informing\\n /// the backend of it, then please do so through the Ether portal contract.\\n receive() external payable {}\\n\\n function executeOutput(\\n bytes calldata output,\\n OutputValidityProof calldata proof\\n ) external override nonReentrant {\\n validateOutput(output, proof);\\n\\n uint256 inputIndex = proof.calculateInputIndex();\\n uint64 outputIndexWithinInput = proof.outputIndexWithinInput;\\n\\n BitMaps.BitMap storage bitmap = _executed[outputIndexWithinInput];\\n\\n if (output.length < 4) {\\n revert OutputNotExecutable(output);\\n }\\n\\n bytes4 selector = bytes4(output[:4]);\\n bytes calldata arguments = output[4:];\\n\\n if (selector == Outputs.Voucher.selector) {\\n if (bitmap.get(inputIndex)) {\\n revert OutputNotReexecutable(output);\\n }\\n _executeVoucher(arguments);\\n } else if (selector == Outputs.DelegateCallVoucher.selector) {\\n if (bitmap.get(inputIndex)) {\\n revert OutputNotReexecutable(output);\\n }\\n _executeDelegateCallVoucher(arguments);\\n } else {\\n revert OutputNotExecutable(output);\\n }\\n\\n bitmap.set(inputIndex);\\n emit OutputExecuted(uint64(inputIndex), outputIndexWithinInput, output);\\n }\\n\\n function migrateToConsensus(\\n IConsensus newConsensus\\n ) external override onlyOwner {\\n _consensus = newConsensus;\\n emit NewConsensus(newConsensus);\\n }\\n\\n function wasOutputExecuted(\\n uint256 inputIndex,\\n uint256 outputIndexWithinInput\\n ) external view override returns (bool) {\\n return _executed[outputIndexWithinInput].get(inputIndex);\\n }\\n\\n function validateOutput(\\n bytes calldata output,\\n OutputValidityProof calldata proof\\n ) public view override {\\n uint256 inputIndex = proof.calculateInputIndex();\\n\\n if (!proof.inputRange.contains(inputIndex)) {\\n revert InputIndexOutOfRange(inputIndex, proof.inputRange);\\n }\\n\\n bytes32 outputHash = keccak256(output);\\n\\n if (!proof.isOutputHashesRootHashValid(outputHash)) {\\n revert IncorrectOutputHashesRootHash();\\n }\\n\\n if (!proof.isOutputsEpochRootHashValid()) {\\n revert IncorrectOutputsEpochRootHash();\\n }\\n\\n bytes32 epochHash = _getEpochHash(proof.inputRange);\\n\\n if (!proof.isEpochHashValid(epochHash)) {\\n revert IncorrectEpochHash();\\n }\\n }\\n\\n function getTemplateHash() external view override returns (bytes32) {\\n return _templateHash;\\n }\\n\\n function getConsensus() external view override returns (IConsensus) {\\n return _consensus;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return _inputBox;\\n }\\n\\n function getPortals() external view override returns (IPortal[] memory) {\\n return _portals;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view virtual override(ERC1155Holder, IERC165) returns (bool) {\\n return\\n interfaceId == type(IApplication).interfaceId ||\\n interfaceId == type(IERC721Receiver).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /// @notice Get the epoch hash regarding an input range from the current consensus.\\n /// @param inputRange The input range\\n /// @return The epoch hash\\n function _getEpochHash(\\n InputRange calldata inputRange\\n ) internal view returns (bytes32) {\\n return _consensus.getEpochHash(address(this), inputRange);\\n }\\n\\n /// @notice Executes a voucher\\n /// @param arguments ABI-encoded arguments\\n function _executeVoucher(bytes calldata arguments) internal {\\n address destination;\\n uint256 value;\\n bytes memory payload;\\n\\n (destination, value, payload) = abi.decode(\\n arguments,\\n (address, uint256, bytes)\\n );\\n\\n destination.safeCall(value, payload);\\n }\\n\\n /// @notice Executes a delegatecall voucher\\n /// @param arguments ABI-encoded arguments\\n function _executeDelegateCallVoucher(bytes calldata arguments) internal {\\n address destination;\\n bytes memory payload;\\n\\n (destination, payload) = abi.decode(arguments, (address, bytes));\\n\\n destination.safeDelegateCall(payload);\\n }\\n}\\n\",\"keccak256\":\"0x5119ba0344182acea4f1a5ce91c7386be17a48e4b2c9881f5a708a29357cc660\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/ApplicationFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Create2} from \\\"@openzeppelin/contracts/utils/Create2.sol\\\";\\n\\nimport {IApplicationFactory} from \\\"./IApplicationFactory.sol\\\";\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {IPortal} from \\\"../portals/IPortal.sol\\\";\\nimport {Application} from \\\"./Application.sol\\\";\\n\\n/// @title Application Factory\\n/// @notice Allows anyone to reliably deploy a new `Application` contract.\\ncontract ApplicationFactory is IApplicationFactory {\\n function newApplication(\\n IConsensus consensus,\\n IInputBox inputBox,\\n IPortal[] memory portals,\\n address appOwner,\\n bytes32 templateHash\\n ) external override returns (Application) {\\n Application appContract = new Application(\\n consensus,\\n inputBox,\\n portals,\\n appOwner,\\n templateHash\\n );\\n\\n emit ApplicationCreated(\\n consensus,\\n inputBox,\\n portals,\\n appOwner,\\n templateHash,\\n appContract\\n );\\n\\n return appContract;\\n }\\n\\n function newApplication(\\n IConsensus consensus,\\n IInputBox inputBox,\\n IPortal[] memory portals,\\n address appOwner,\\n bytes32 templateHash,\\n bytes32 salt\\n ) external override returns (Application) {\\n Application appContract = new Application{salt: salt}(\\n consensus,\\n inputBox,\\n portals,\\n appOwner,\\n templateHash\\n );\\n\\n emit ApplicationCreated(\\n consensus,\\n inputBox,\\n portals,\\n appOwner,\\n templateHash,\\n appContract\\n );\\n\\n return appContract;\\n }\\n\\n function calculateApplicationAddress(\\n IConsensus consensus,\\n IInputBox inputBox,\\n IPortal[] memory portals,\\n address appOwner,\\n bytes32 templateHash,\\n bytes32 salt\\n ) external view override returns (address) {\\n return\\n Create2.computeAddress(\\n salt,\\n keccak256(\\n abi.encodePacked(\\n type(Application).creationCode,\\n abi.encode(\\n consensus,\\n inputBox,\\n portals,\\n appOwner,\\n templateHash\\n )\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x738565636f6d80e3f3e53537a2194846ff85deb864e39d25268a954d9b124967\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/IApplication.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 {IERC1155Receiver} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\\\";\\nimport {IERC721Receiver} from \\\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\\\";\\n\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {IPortal} from \\\"../portals/IPortal.sol\\\";\\nimport {OutputValidityProof} from \\\"../common/OutputValidityProof.sol\\\";\\nimport {InputRange} from \\\"../common/InputRange.sol\\\";\\n\\n/// @notice The base layer incarnation of an application running on the execution layer.\\n/// @notice The state of the application advances through inputs sent to an `IInputBox` contract (see the `getInputBox` function).\\n/// @notice These inputs can be sent either directly, or indirectly through portals (see the `getPortals` function).\\n/// @notice Reader nodes can retrieve inputs sent to the `IInputBox` contract through events, and feed them into the machine.\\n/// @notice Validator nodes can also submit claims to the `IConsensus` contract (see the `getConsensus` function).\\n/// @notice Once accepted, claims can be used to validate outputs generated by the machine.\\n/// @notice Some outputs are executable, which means they can have on-chain side effects.\\n/// @notice Every application is subscribed to some consensus, and may be governed by some owner.\\n/// The consensus has the power to accept claims, which, in turn, are used to validate outputs.\\n/// Meanwhile, the owner can replace the consensus at any time.\\n/// Therefore, the users of an application must trust both the consensus and the application owner.\\n/// @notice There are several ownership models to choose from:\\n/// - no owner (address zero)\\n/// - individual signer (externally-owned account)\\n/// - multiple signers (multi-sig)\\n/// - DAO (decentralized autonomous organization)\\n/// - self-owned application (off-chain governance logic)\\n/// @notice See `IConsensus` for examples of consensus models.\\ninterface IApplication is IERC721Receiver, IERC1155Receiver {\\n // Events\\n\\n /// @notice MUST trigger when a new consensus is chosen.\\n /// @param newConsensus The new consensus\\n event NewConsensus(IConsensus newConsensus);\\n\\n /// @notice MUST trigger when an output is executed.\\n /// @param inputIndex The index of the input that emitted the output\\n /// @param outputIndexWithinInput The index of the output amongst all outputs emitted by the input\\n /// @param output The output\\n event OutputExecuted(\\n uint64 inputIndex,\\n uint64 outputIndexWithinInput,\\n bytes output\\n );\\n\\n // Errors\\n\\n /// @notice Could not validate an output because the input\\n /// that generated it is outside the input range of the epoch.\\n /// @param inputIndex The input index\\n /// @param inputRange The input range\\n error InputIndexOutOfRange(uint256 inputIndex, InputRange inputRange);\\n\\n /// @notice Could not execute an output, because the application contract doesn't know how to.\\n /// @param output The output\\n error OutputNotExecutable(bytes output);\\n\\n /// @notice Could not execute an output, because it was already executed.\\n /// @param output The output\\n error OutputNotReexecutable(bytes output);\\n\\n /// @notice Raised when some `OutputValidityProof` variables does not match\\n /// the presented finalized epoch.\\n error IncorrectEpochHash();\\n\\n /// @notice Raised when `OutputValidityProof` metadata memory range is NOT\\n /// contained in epoch's output memory range.\\n error IncorrectOutputsEpochRootHash();\\n\\n /// @notice Raised when Merkle root of output hash is NOT contained\\n /// in the output metadata array memory range.\\n error IncorrectOutputHashesRootHash();\\n\\n // Permissioned functions\\n\\n /// @notice Migrate the application to a new consensus.\\n /// @param newConsensus The new consensus\\n /// @dev Can only be called by the application owner.\\n function migrateToConsensus(IConsensus newConsensus) external;\\n\\n // Permissionless functions\\n\\n /// @notice Execute an output.\\n /// @param output The output\\n /// @param proof The proof used to validate the output against\\n /// a claim submitted by the current consensus contract\\n /// @dev On a successful execution, emits a `OutputExecuted` event.\\n /// @dev May raise any of the errors raised by `validateOutput`,\\n /// as well as `OutputNotExecutable` and `OutputNotReexecutable`.\\n function executeOutput(\\n bytes calldata output,\\n OutputValidityProof calldata proof\\n ) external;\\n\\n /// @notice Check whether an output has been executed.\\n /// @param inputIndex The index of the input in the input box\\n /// @param outputIndexWithinInput The index of output emitted by the input\\n /// @return Whether the output has been executed before\\n function wasOutputExecuted(\\n uint256 inputIndex,\\n uint256 outputIndexWithinInput\\n ) external view returns (bool);\\n\\n /// @notice Validate an output.\\n /// @param output The output\\n /// @param proof The proof used to validate the output against\\n /// a claim submitted by the current consensus contract\\n /// @dev May raise `InputIndexOutOfRange`, `IncorrectEpochHash`,\\n /// `IncorrectOutputsEpochRootHash`, or `IncorrectOutputHashesRootHash`.\\n function validateOutput(\\n bytes calldata output,\\n OutputValidityProof calldata proof\\n ) external view;\\n\\n /// @notice Get the application's template hash.\\n /// @return The application's template hash\\n function getTemplateHash() external view returns (bytes32);\\n\\n /// @notice Get the current consensus.\\n /// @return The current consensus\\n function getConsensus() external view returns (IConsensus);\\n\\n /// @notice Get the input box that the application is listening to.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n\\n /// @notice Get the portals that the application expects inputs from.\\n /// @return The portals.\\n function getPortals() external view returns (IPortal[] memory);\\n}\\n\",\"keccak256\":\"0xb7f77e632c14935998e986276cbea53e9a52bc576aae51cbc8c51cedcbafc6bc\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/IApplicationFactory.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 {Application} from \\\"./Application.sol\\\";\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {IPortal} from \\\"../portals/IPortal.sol\\\";\\n\\n/// @title Application Factory interface\\ninterface IApplicationFactory {\\n // Events\\n\\n /// @notice A new application was deployed.\\n /// @param consensus The initial consensus contract\\n /// @param inputBox The input box contract\\n /// @param portals The portals supported by the application\\n /// @param appOwner The initial application owner\\n /// @param templateHash The initial machine state hash\\n /// @param appContract The application contract\\n /// @dev MUST be triggered on a successful call to `newApplication`.\\n event ApplicationCreated(\\n IConsensus indexed consensus,\\n IInputBox inputBox,\\n IPortal[] portals,\\n address appOwner,\\n bytes32 templateHash,\\n Application appContract\\n );\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new application.\\n /// @param consensus The initial consensus contract\\n /// @param inputBox The input box contract\\n /// @param portals The portals supported by the application\\n /// @param appOwner The initial application owner\\n /// @param templateHash The initial machine state hash\\n /// @return The application\\n /// @dev On success, MUST emit an `ApplicationCreated` event.\\n function newApplication(\\n IConsensus consensus,\\n IInputBox inputBox,\\n IPortal[] calldata portals,\\n address appOwner,\\n bytes32 templateHash\\n ) external returns (Application);\\n\\n /// @notice Deploy a new application deterministically.\\n /// @param consensus The initial consensus contract\\n /// @param inputBox The input box contract\\n /// @param portals The portals supported by the application\\n /// @param appOwner The initial application owner\\n /// @param templateHash The initial machine state hash\\n /// @param salt The salt used to deterministically generate the application contract address\\n /// @return The application\\n /// @dev On success, MUST emit an `ApplicationCreated` event.\\n function newApplication(\\n IConsensus consensus,\\n IInputBox inputBox,\\n IPortal[] calldata portals,\\n address appOwner,\\n bytes32 templateHash,\\n bytes32 salt\\n ) external returns (Application);\\n\\n /// @notice Calculate the address of an application contract to be deployed deterministically.\\n /// @param consensus The initial consensus contract\\n /// @param inputBox The input box contract\\n /// @param portals The portals supported by the application\\n /// @param appOwner The initial application owner\\n /// @param templateHash The initial machine state hash\\n /// @param salt The salt used to deterministically generate the application contract address\\n /// @return The deterministic application contract address\\n /// @dev Beware that only the `newApplication` function with the `salt` parameter\\n /// is able to deterministically deploy an application.\\n function calculateApplicationAddress(\\n IConsensus consensus,\\n IInputBox inputBox,\\n IPortal[] calldata portals,\\n address appOwner,\\n bytes32 templateHash,\\n bytes32 salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0xc8124036aad5321f0c30692196984061f55c82599a8da5c83f10bcfa64403817\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputBox.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/// @notice Provides data availability of inputs for applications.\\n/// @notice Each application has its own append-only list of inputs.\\n/// @notice Off-chain, inputs can be retrieved via events.\\n/// @notice On-chain, only the input hashes are stored.\\n/// @notice See `LibInput` for more details on how such hashes are computed.\\ninterface IInputBox {\\n /// @notice MUST trigger when an input is added.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @param input The input blob\\n event InputAdded(\\n address indexed appContract,\\n uint256 indexed index,\\n bytes input\\n );\\n\\n /// @notice Input is too large.\\n /// @param appContract The application contract address\\n /// @param inputLength The input length\\n /// @param maxInputLength The maximum input length\\n error InputTooLarge(\\n address appContract,\\n uint256 inputLength,\\n uint256 maxInputLength\\n );\\n\\n /// @notice Send an input to an application.\\n /// @param appContract The application contract address\\n /// @param payload The input payload\\n /// @return The hash of the input blob\\n /// @dev MUST fire an `InputAdded` event.\\n function addInput(\\n address appContract,\\n bytes calldata payload\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs sent to an application.\\n /// @param appContract The application contract address\\n function getNumberOfInputs(\\n address appContract\\n ) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in an application's input box.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @dev The provided index must be valid.\\n function getInputHash(\\n address appContract,\\n uint256 index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xae7730cd7ab2b31a86d7c4933215853ea6c0b1b4dc60d4ec24e5cfc2ec005fe3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/library/LibAddress.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 {LibError} from \\\"../library/LibError.sol\\\";\\n\\nlibrary LibAddress {\\n using LibError for bytes;\\n\\n /// @notice Perform a low level call and raise error if failed\\n /// @param destination The address that will be called\\n /// @param value The amount of Wei to be transferred through the call\\n /// @param payload The payload, which\\u2014in the case of Solidity\\n /// contracts\\u2014encodes a function call\\n function safeCall(\\n address destination,\\n uint256 value,\\n bytes memory payload\\n ) internal {\\n bool success;\\n bytes memory returndata;\\n\\n (success, returndata) = destination.call{value: value}(payload);\\n\\n if (!success) {\\n returndata.raise();\\n }\\n }\\n\\n /// @notice Perform a delegate call and raise error if failed\\n /// @param destination The address that will be called\\n /// @param payload The payload, which\\u2014in the case of Solidity\\n /// libraries\\u2014encodes a function call\\n function safeDelegateCall(\\n address destination,\\n bytes memory payload\\n ) internal {\\n bool success;\\n bytes memory returndata;\\n\\n (success, returndata) = destination.delegatecall(payload);\\n\\n if (!success) {\\n returndata.raise();\\n }\\n }\\n}\\n\",\"keccak256\":\"0xcae26d227ecb61fe953e6a5937037529b02fd929f6857151661121d6d233c0ac\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/library/LibError.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\\nlibrary LibError {\\n /// @notice Raise error data\\n /// @param errordata Data returned by failed low-level call\\n function raise(bytes memory errordata) internal pure {\\n if (errordata.length == 0) {\\n revert();\\n } else {\\n assembly {\\n revert(add(32, errordata), mload(errordata))\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3d5f9497f40e172fe1a0b9e2635cd4b14c4c3d16bcfd851db034273573aae37d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/library/LibInputRange.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 {InputRange} from \\\"../common/InputRange.sol\\\";\\n\\nlibrary LibInputRange {\\n /// @notice Check if an input range contains an input.\\n /// @param r The input range\\n /// @param inputIndex The input index\\n /// @return Whether the input range contains the input.\\n function contains(\\n InputRange calldata r,\\n uint256 inputIndex\\n ) internal pure returns (bool) {\\n return r.firstIndex <= inputIndex && inputIndex <= r.lastIndex;\\n }\\n}\\n\",\"keccak256\":\"0x30e95c1eb8b8f45bf4bc02c26e2b69a949025fa1bb34cb804137d7e2d229aa78\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/library/LibMerkle32.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.22;\\n\\n/// @title Merkle library for trees of 32-byte leaves\\n/// @notice This library is meant for creating and verifying Merkle proofs.\\n/// @notice Each Merkle tree is assumed to have `2^height` leaves.\\n/// @notice Nodes are concatenated pairwise and hashed with `keccak256`.\\n/// @notice Siblings are in bottom-up order, from leaf to root.\\nlibrary LibMerkle32 {\\n using LibMerkle32 for bytes32[];\\n\\n /// @notice Compute the root of a Merkle tree from its leaves.\\n /// @param leaves The left-most leaves of the Merkle tree\\n /// @param height The height of the Merkle tree\\n /// @return The root hash of the Merkle tree\\n /// @dev Raises an error if more than `2^height` leaves are provided.\\n function merkleRoot(\\n bytes32[] memory leaves,\\n uint256 height\\n ) internal pure returns (bytes32) {\\n bytes32 defaultNode;\\n for (uint256 i; i < height; ++i) {\\n leaves = leaves.parentLevel(defaultNode);\\n defaultNode = parent(defaultNode, defaultNode);\\n }\\n require(leaves.length <= 1, \\\"LibMerkle32: too many leaves\\\");\\n return leaves.at(0, defaultNode);\\n }\\n\\n /// @notice Compute the siblings of the ancestors of a leaf in a Merkle tree.\\n /// @param leaves The left-most leaves of the Merkle tree\\n /// @param index The index of the leaf\\n /// @param height The height of the Merkle tree\\n /// @return The siblings of the ancestors of the leaf in bottom-up order\\n /// @dev Raises an error if the provided index is out of bounds.\\n /// @dev Raises an error if more than `2^height` leaves are provided.\\n function siblings(\\n bytes32[] memory leaves,\\n uint256 index,\\n uint256 height\\n ) internal pure returns (bytes32[] memory) {\\n bytes32[] memory sibs = new bytes32[](height);\\n bytes32 defaultNode;\\n for (uint256 i; i < height; ++i) {\\n sibs[i] = leaves.at(index ^ 1, defaultNode);\\n leaves = leaves.parentLevel(defaultNode);\\n defaultNode = parent(defaultNode, defaultNode);\\n index >>= 1;\\n }\\n require(index == 0, \\\"LibMerkle32: index out of bounds\\\");\\n require(leaves.length <= 1, \\\"LibMerkle32: too many leaves\\\");\\n return sibs;\\n }\\n\\n /// @notice Compute the root of a Merkle tree after replacing one of its leaves.\\n /// @param sibs The siblings of the ancestors of the leaf in bottom-up order\\n /// @param index The index of the leaf\\n /// @param leaf The new leaf\\n /// @return The root hash of the new Merkle tree\\n /// @dev Raises an error if the provided index is out of bounds.\\n function merkleRootAfterReplacement(\\n bytes32[] calldata sibs,\\n uint256 index,\\n bytes32 leaf\\n ) internal pure returns (bytes32) {\\n uint256 height = sibs.length;\\n for (uint256 i; i < height; ++i) {\\n bytes32 sibling = sibs[i];\\n if (index & 1 == 0) {\\n leaf = parent(leaf, sibling);\\n } else {\\n leaf = parent(sibling, leaf);\\n }\\n index >>= 1;\\n }\\n require(index == 0, \\\"LibMerkle32: index out of bounds\\\");\\n return leaf;\\n }\\n\\n /// @notice Compute the parent of two nodes.\\n /// @param leftNode The left node\\n /// @param rightNode The right node\\n /// @return parentNode The parent node\\n /// @dev Uses assembly for extra performance\\n function parent(\\n bytes32 leftNode,\\n bytes32 rightNode\\n ) internal pure returns (bytes32 parentNode) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(0x00, leftNode)\\n mstore(0x20, rightNode)\\n parentNode := keccak256(0x00, 0x40)\\n }\\n }\\n\\n /// @notice Compute the parent level of an array of nodes.\\n /// @param nodes The array of left-most nodes\\n /// @param defaultNode The default node after the array\\n /// @return The left-most nodes of the parent level\\n /// @dev The default node of a parent level is\\n /// the parent node of two default nodes.\\n function parentLevel(\\n bytes32[] memory nodes,\\n bytes32 defaultNode\\n ) internal pure returns (bytes32[] memory) {\\n uint256 n = (nodes.length + 1) / 2; // ceil(#nodes / 2)\\n bytes32[] memory level = new bytes32[](n);\\n for (uint256 i; i < n; ++i) {\\n bytes32 leftLeaf = nodes[2 * i];\\n bytes32 rightLeaf = nodes.at(2 * i + 1, defaultNode);\\n level[i] = parent(leftLeaf, rightLeaf);\\n }\\n return level;\\n }\\n\\n /// @notice Get the node at some index\\n /// @param nodes The array of left-most nodes\\n /// @param index The index of the node\\n /// @param defaultNode The default node after the array\\n function at(\\n bytes32[] memory nodes,\\n uint256 index,\\n bytes32 defaultNode\\n ) internal pure returns (bytes32) {\\n if (index < nodes.length) {\\n return nodes[index];\\n } else {\\n return defaultNode;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x47ec1967c131735784544d1e1610a4eca01d54198411184f5e16c8662c5b63e7\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/library/LibOutputValidityProof.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 {CanonicalMachine} from \\\"../common/CanonicalMachine.sol\\\";\\nimport {Outputs} from \\\"../common/Outputs.sol\\\";\\nimport {OutputValidityProof} from \\\"../common/OutputValidityProof.sol\\\";\\n\\nimport {LibMerkle32} from \\\"./LibMerkle32.sol\\\";\\n\\nlibrary LibOutputValidityProof {\\n using LibMerkle32 for bytes32[];\\n\\n /// @notice Check if epoch hash is valid\\n /// @param v The output validity proof\\n /// @param epochHash The epoch hash\\n function isEpochHashValid(\\n OutputValidityProof calldata v,\\n bytes32 epochHash\\n ) internal pure returns (bool) {\\n return\\n epochHash ==\\n keccak256(abi.encode(v.outputsEpochRootHash, v.machineStateHash));\\n }\\n\\n /// @notice Check if the outputs epoch root hash is valid\\n /// @param v The output validity proof\\n function isOutputsEpochRootHashValid(\\n OutputValidityProof calldata v\\n ) internal pure returns (bool) {\\n bytes32[] calldata siblings = v.outputHashesInEpochSiblings;\\n return\\n (siblings.length == CanonicalMachine.LOG2_MAX_INPUTS_PER_EPOCH) &&\\n (v.outputsEpochRootHash ==\\n siblings.merkleRootAfterReplacement(\\n v.inputIndexWithinEpoch,\\n v.outputHashesRootHash\\n ));\\n }\\n\\n /// @notice Check if the output hashes root hash is valid\\n /// @param v The output validity proof\\n /// @param outputHash The output hash\\n function isOutputHashesRootHashValid(\\n OutputValidityProof calldata v,\\n bytes32 outputHash\\n ) internal pure returns (bool) {\\n bytes32[] calldata siblings = v.outputHashInOutputHashesSiblings;\\n return\\n (siblings.length == CanonicalMachine.LOG2_MAX_OUTPUTS_PER_INPUT) &&\\n (v.outputHashesRootHash ==\\n siblings.merkleRootAfterReplacement(\\n v.outputIndexWithinInput,\\n outputHash\\n ));\\n }\\n\\n /// @notice Calculate the input index\\n /// @param v The output validity proof\\n /// @return The input index\\n function calculateInputIndex(\\n OutputValidityProof calldata v\\n ) internal pure returns (uint256) {\\n return uint256(v.inputRange.firstIndex) + v.inputIndexWithinEpoch;\\n }\\n}\\n\",\"keccak256\":\"0x2719d93756e4477a7827c455a55f08066da64257a9570a867df3fbf2022217b8\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IPortal.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 {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\n/// @title Portal interface\\ninterface IPortal is IERC165 {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this portal.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0xbc364030939ea4a214e2f3673eaca1c500fcfd4929239a3b5d804ffc5687ed37\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50611cea806100206000396000f3fe60806040523480156200001157600080fd5b5060043610620000465760003560e01c806303557d67146200004b5780635c44eda4146200007e578063f63adead1462000095575b600080fd5b620000626200005c366004620003aa565b620000ac565b6040516001600160a01b03909116815260200160405180910390f35b620000626200008f3660046200043b565b6200014d565b62000062620000a6366004620003aa565b620001e8565b600080828888888888604051620000c390620002b5565b620000d395949392919062000509565b8190604051809103906000f5905080158015620000f4573d6000803e3d6000fd5b509050876001600160a01b03167ff0a2d32dae19c50fb841822aba94a3a9ba00be0584f7d8229795d66d9532395288888888866040516200013a95949392919062000548565b60405180910390a2979650505050505050565b60008086868686866040516200016390620002b5565b6200017395949392919062000509565b604051809103906000f08015801562000190573d6000803e3d6000fd5b509050866001600160a01b03167ff0a2d32dae19c50fb841822aba94a3a9ba00be0584f7d8229795d66d953239528787878786604051620001d695949392919062000548565b60405180910390a29695505050505050565b60006200026a82604051806020016200020190620002b5565b601f1982820381018352601f9091011660408190526200022e908b908b908b908b908b9060200162000509565b60408051601f19818403018152908290526200024e9291602001620005bd565b6040516020818303038152906040528051906020012062000275565b979650505050505050565b6000620002848383306200028b565b9392505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b6116d680620005df83390190565b6001600160a01b0381168114620002d957600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b8035620002ff81620002c3565b919050565b600082601f8301126200031657600080fd5b8135602067ffffffffffffffff80831115620003365762000336620002dc565b8260051b604051601f19603f830116810181811084821117156200035e576200035e620002dc565b60405293845260208187018101949081019250878511156200037f57600080fd5b6020870191505b848210156200026a576200039a82620002f2565b8352918301919083019062000386565b60008060008060008060c08789031215620003c457600080fd5b8635620003d181620002c3565b95506020870135620003e381620002c3565b9450604087013567ffffffffffffffff8111156200040057600080fd5b6200040e89828a0162000304565b94505060608701356200042181620002c3565b9598949750929560808101359460a0909101359350915050565b600080600080600060a086880312156200045457600080fd5b85356200046181620002c3565b945060208601356200047381620002c3565b9350604086013567ffffffffffffffff8111156200049057600080fd5b6200049e8882890162000304565b9350506060860135620004b181620002c3565b949793965091946080013592915050565b60008151808452602080850194506020840160005b83811015620004fe5781516001600160a01b031687529582019590820190600101620004d7565b509495945050505050565b600060018060a01b038088168352808716602084015260a060408401526200053560a0840187620004c2565b9416606083015250608001529392505050565b600060018060a01b03808816835260a060208401526200056c60a0840188620004c2565b9581166040840152606083019490945250911660809091015292915050565b6000815160005b81811015620005ae576020818501810151868301520162000592565b50600093019283525090919050565b6000620005d6620005cf83866200058b565b846200058b565b94935050505056fe60c06040523480156200001157600080fd5b50604051620016d6380380620016d68339810160408190526200003491620001a5565b816001600160a01b0381166200006457604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b6200006f8162000114565b50600180556080819052600380546001600160a01b0319166001600160a01b0387811691909117909155841660a05260005b835181101562000108576004848281518110620000c257620000c2620002c2565b60209081029190910181015182546001808201855560009485529290932090920180546001600160a01b0319166001600160a01b039093169290921790915501620000a1565b505050505050620002d8565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146200017a57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b8051620001a08162000164565b919050565b600080600080600060a08688031215620001be57600080fd5b8551620001cb8162000164565b80955050602080870151620001e08162000164565b60408801519095506001600160401b0380821115620001fe57600080fd5b818901915089601f8301126200021357600080fd5b8151818111156200022857620002286200017d565b8060051b604051601f19603f830116810181811085821117156200025057620002506200017d565b60405291825284820192508381018501918c8311156200026f57600080fd5b938501935b828510156200029857620002888562000193565b8452938501939285019262000274565b809850505050505050620002af6060870162000193565b9150608086015190509295509295909350565b634e487b7160e01b600052603260045260246000fd5b60805160a0516113d8620002fe60003960006101060152600061024b01526113d86000f3fe6080604052600436106100eb5760003560e01c806361b12c661161008a578063dbe1a6eb11610059578063dbe1a6eb146102d3578063f23a6e61146102f3578063f2fde38b1461031f578063fc4116831461033f57600080fd5b806361b12c6614610239578063715018a6146102745780638da5cb5b14610289578063bc197c81146102a757600080fd5b8063150b7a02116100c6578063150b7a0214610195578063179e740b146101d957806324523192146101f75780634dcea1551461021757600080fd5b8062aace9a146100f757806301ffc9a714610143578063108e8c1d1461017357600080fd5b366100f257005b600080fd5b34801561010357600080fd5b507f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b0390911681526020015b60405180910390f35b34801561014f57600080fd5b5061016361015e366004610c9f565b61035f565b604051901515815260200161013a565b34801561017f57600080fd5b506101886103a5565b60405161013a9190610cc9565b3480156101a157600080fd5b506101c06101b0366004610de0565b630a85bd0160e11b949350505050565b6040516001600160e01b0319909116815260200161013a565b3480156101e557600080fd5b506003546001600160a01b0316610126565b34801561020357600080fd5b50610163610212366004610e4b565b610407565b34801561022357600080fd5b50610237610232366004610e6d565b610437565b005b34801561024557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000815260200161013a565b34801561028057600080fd5b5061023761051e565b34801561029557600080fd5b506000546001600160a01b0316610126565b3480156102b357600080fd5b506101c06102c2366004610f87565b63bc197c8160e01b95945050505050565b3480156102df57600080fd5b506102376102ee366004610e6d565b610532565b3480156102ff57600080fd5b506101c061030e366004611034565b63f23a6e6160e01b95945050505050565b34801561032b57600080fd5b5061023761033a36600461109c565b610726565b34801561034b57600080fd5b5061023761035a36600461109c565b610764565b60006001600160e01b031982166328373a4560e01b148061039057506001600160e01b03198216630a85bd0160e11b145b8061039f575061039f826107c0565b92915050565b606060048054806020026020016040519081016040528092919081815260200182805480156103fd57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116103df575b5050505050905090565b6000818152600260209081526040808320600886901c8452909152812054600160ff85161b1615155b9392505050565b6000610442826107f5565b905061044e8282610830565b6104785760405163fef5040960e01b815261046f9082908490600401611102565b60405180910390fd5b6000848460405161048a929190611116565b604051908190039020905061049f8382610875565b6104bc5760405163017c689560e61b815260040160405180910390fd5b6104c5836108cc565b6104e257604051634371daa160e11b815260040160405180910390fd5b60006104ed84610927565b90506104f9848261099b565b61051657604051636fbd3b7160e11b815260040160405180910390fd5b505050505050565b6105266109e1565b6105306000610a0e565b565b61053a610a5e565b610545838383610437565b6000610550826107f5565b905060006105646080840160608501611126565b6001600160401b038116600090815260026020526040902090915060048510156105a5578585604051636942600f60e11b815260040161046f92919061116a565b60006105b4600482888a61117e565b6105bd916111a8565b90503660006105cf886004818c61117e565b909250905063dc857e9160e01b6001600160e01b031984160161063957600886901c600090815260208590526040902054600160ff88161b161561062a578888604051637b97a6bb60e01b815260040161046f92919061116a565b6106348282610a88565b6106b6565b63efcde17560e01b6001600160e01b031984160161069957600886901c600090815260208590526040902054600160ff88161b161561068f578888604051637b97a6bb60e01b815260040161046f92919061116a565b6106348282610abb565b8888604051636942600f60e11b815260040161046f92919061116a565b600886901c60009081526020859052604090208054600160ff89161b1790557fd39d8e3e610251d36b5464d9cabbd8fa8319fe6cff76941ce041ecf04669726f86868b8b60405161070a94939291906111d8565b60405180910390a150505050505061072160018055565b505050565b61072e6109e1565b6001600160a01b03811661075857604051631e4fbdf760e01b81526000600482015260240161046f565b61076181610a0e565b50565b61076c6109e1565b600380546001600160a01b0319166001600160a01b0383169081179091556040519081527f4991c6f37185659e276ff918a96f3e20e6c5abcd8c9aab450dc19c2f7ad35cb59060200160405180910390a150565b60006001600160e01b03198216630271189760e51b148061039f57506301ffc9a760e01b6001600160e01b031983161461039f565b60006108076060830160408401611126565b6001600160401b031661081d6020840184611126565b6001600160401b031661039f919061120f565b6000816108406020850185611126565b6001600160401b03161115801561043057506108626040840160208501611126565b6001600160401b03169091111592915050565b6000368161088660e0860186611230565b90925090506010811480156108c357506108bc6108a96080870160608801611126565b839083906001600160401b031687610ae9565b8560800135145b95945050505050565b600036816108de610100850185611230565b909250905060208114801561091f57506109186109016060860160408701611126565b839083906001600160401b03166080880135610ae9565b8460a00135145b949350505050565b60035460405163307d66bf60e21b81526000916001600160a01b03169063c1f59afc9061095a9030908690600401611280565b602060405180830381865afa158015610977573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061039f919061129d565b60008260a001358360c001356040516020016109c1929190918252602082015260400190565b604051602081830303815290604052805190602001208214905092915050565b6000546001600160a01b031633146105305760405163118cdaa760e01b815233600482015260240161046f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600260015403610a8157604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b6000806060610a99848601866112b6565b91945092509050610ab46001600160a01b0384168383610baa565b5050505050565b60006060610acb8385018561130e565b9092509050610ae36001600160a01b03831682610c1d565b50505050565b600083815b81811015610b51576000878783818110610b0a57610b0a61135d565b90506020020135905085600116600003610b335760008581526020829052604090209450610b44565b600081815260208690526040902094505b50600194851c9401610aee565b508315610ba05760405162461bcd60e51b815260206004820181905260248201527f4c69624d65726b6c6533323a20696e646578206f7574206f6620626f756e6473604482015260640161046f565b5090949350505050565b60006060846001600160a01b03168484604051610bc79190611373565b60006040518083038185875af1925050503d8060008114610c04576040519150601f19603f3d011682016040523d82523d6000602084013e610c09565b606091505b50909250905081610ab457610ab481610c89565b60006060836001600160a01b031683604051610c399190611373565b600060405180830381855af49150503d8060008114610c74576040519150601f19603f3d011682016040523d82523d6000602084013e610c79565b606091505b50909250905081610ae357610ae3815b8051600003610c9757600080fd5b805181602001fd5b600060208284031215610cb157600080fd5b81356001600160e01b03198116811461043057600080fd5b6020808252825182820181905260009190848201906040850190845b81811015610d0a5783516001600160a01b031683529284019291840191600101610ce5565b50909695505050505050565b6001600160a01b038116811461076157600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715610d6957610d69610d2b565b604052919050565b600082601f830112610d8257600080fd5b81356001600160401b03811115610d9b57610d9b610d2b565b610dae601f8201601f1916602001610d41565b818152846020838601011115610dc357600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215610df657600080fd5b8435610e0181610d16565b93506020850135610e1181610d16565b92506040850135915060608501356001600160401b03811115610e3357600080fd5b610e3f87828801610d71565b91505092959194509250565b60008060408385031215610e5e57600080fd5b50508035926020909101359150565b600080600060408486031215610e8257600080fd5b83356001600160401b0380821115610e9957600080fd5b818601915086601f830112610ead57600080fd5b813581811115610ebc57600080fd5b876020828501011115610ece57600080fd5b602092830195509350908501359080821115610ee957600080fd5b5084016101208187031215610efd57600080fd5b809150509250925092565b600082601f830112610f1957600080fd5b813560206001600160401b03821115610f3457610f34610d2b565b8160051b610f43828201610d41565b9283528481018201928281019087851115610f5d57600080fd5b83870192505b84831015610f7c57823582529183019190830190610f63565b979650505050505050565b600080600080600060a08688031215610f9f57600080fd5b8535610faa81610d16565b94506020860135610fba81610d16565b935060408601356001600160401b0380821115610fd657600080fd5b610fe289838a01610f08565b94506060880135915080821115610ff857600080fd5b61100489838a01610f08565b9350608088013591508082111561101a57600080fd5b5061102788828901610d71565b9150509295509295909350565b600080600080600060a0868803121561104c57600080fd5b853561105781610d16565b9450602086013561106781610d16565b9350604086013592506060860135915060808601356001600160401b0381111561109057600080fd5b61102788828901610d71565b6000602082840312156110ae57600080fd5b813561043081610d16565b80356001600160401b03811681146110d057600080fd5b919050565b6001600160401b03806110e7836110b9565b168352806110f7602084016110b9565b166020840152505050565b8281526060810161043060208301846110d5565b8183823760009101908152919050565b60006020828403121561113857600080fd5b610430826110b9565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60208152600061091f602083018486611141565b6000808585111561118e57600080fd5b8386111561119b57600080fd5b5050820193919092039150565b6001600160e01b031981358181169160048510156111d05780818660040360031b1b83161692505b505092915050565b60006001600160401b03808716835280861660208401525060606040830152611205606083018486611141565b9695505050505050565b8082018082111561039f57634e487b7160e01b600052601160045260246000fd5b6000808335601e1984360301811261124757600080fd5b8301803591506001600160401b0382111561126157600080fd5b6020019150600581901b360382131561127957600080fd5b9250929050565b6001600160a01b03831681526060810161043060208301846110d5565b6000602082840312156112af57600080fd5b5051919050565b6000806000606084860312156112cb57600080fd5b83356112d681610d16565b92506020840135915060408401356001600160401b038111156112f857600080fd5b61130486828701610d71565b9150509250925092565b6000806040838503121561132157600080fd5b823561132c81610d16565b915060208301356001600160401b0381111561134757600080fd5b61135385828601610d71565b9150509250929050565b634e487b7160e01b600052603260045260246000fd5b6000825160005b81811015611394576020818601810151858301520161137a565b50600092019182525091905056fea2646970667358221220065690aa558c226601c6855f13ad5e36d71a9c4c8cc49aaf9060519b30f496f864736f6c63430008170033a26469706673582212205c56bf9fd67eefa5bc4d2f1ef0cd3f63e53e830767c0b87db42e328955aa10a564736f6c63430008170033", - "deployedBytecode": "0x60806040523480156200001157600080fd5b5060043610620000465760003560e01c806303557d67146200004b5780635c44eda4146200007e578063f63adead1462000095575b600080fd5b620000626200005c366004620003aa565b620000ac565b6040516001600160a01b03909116815260200160405180910390f35b620000626200008f3660046200043b565b6200014d565b62000062620000a6366004620003aa565b620001e8565b600080828888888888604051620000c390620002b5565b620000d395949392919062000509565b8190604051809103906000f5905080158015620000f4573d6000803e3d6000fd5b509050876001600160a01b03167ff0a2d32dae19c50fb841822aba94a3a9ba00be0584f7d8229795d66d9532395288888888866040516200013a95949392919062000548565b60405180910390a2979650505050505050565b60008086868686866040516200016390620002b5565b6200017395949392919062000509565b604051809103906000f08015801562000190573d6000803e3d6000fd5b509050866001600160a01b03167ff0a2d32dae19c50fb841822aba94a3a9ba00be0584f7d8229795d66d953239528787878786604051620001d695949392919062000548565b60405180910390a29695505050505050565b60006200026a82604051806020016200020190620002b5565b601f1982820381018352601f9091011660408190526200022e908b908b908b908b908b9060200162000509565b60408051601f19818403018152908290526200024e9291602001620005bd565b6040516020818303038152906040528051906020012062000275565b979650505050505050565b6000620002848383306200028b565b9392505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b6116d680620005df83390190565b6001600160a01b0381168114620002d957600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b8035620002ff81620002c3565b919050565b600082601f8301126200031657600080fd5b8135602067ffffffffffffffff80831115620003365762000336620002dc565b8260051b604051601f19603f830116810181811084821117156200035e576200035e620002dc565b60405293845260208187018101949081019250878511156200037f57600080fd5b6020870191505b848210156200026a576200039a82620002f2565b8352918301919083019062000386565b60008060008060008060c08789031215620003c457600080fd5b8635620003d181620002c3565b95506020870135620003e381620002c3565b9450604087013567ffffffffffffffff8111156200040057600080fd5b6200040e89828a0162000304565b94505060608701356200042181620002c3565b9598949750929560808101359460a0909101359350915050565b600080600080600060a086880312156200045457600080fd5b85356200046181620002c3565b945060208601356200047381620002c3565b9350604086013567ffffffffffffffff8111156200049057600080fd5b6200049e8882890162000304565b9350506060860135620004b181620002c3565b949793965091946080013592915050565b60008151808452602080850194506020840160005b83811015620004fe5781516001600160a01b031687529582019590820190600101620004d7565b509495945050505050565b600060018060a01b038088168352808716602084015260a060408401526200053560a0840187620004c2565b9416606083015250608001529392505050565b600060018060a01b03808816835260a060208401526200056c60a0840188620004c2565b9581166040840152606083019490945250911660809091015292915050565b6000815160005b81811015620005ae576020818501810151868301520162000592565b50600093019283525090919050565b6000620005d6620005cf83866200058b565b846200058b565b94935050505056fe60c06040523480156200001157600080fd5b50604051620016d6380380620016d68339810160408190526200003491620001a5565b816001600160a01b0381166200006457604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b6200006f8162000114565b50600180556080819052600380546001600160a01b0319166001600160a01b0387811691909117909155841660a05260005b835181101562000108576004848281518110620000c257620000c2620002c2565b60209081029190910181015182546001808201855560009485529290932090920180546001600160a01b0319166001600160a01b039093169290921790915501620000a1565b505050505050620002d8565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146200017a57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b8051620001a08162000164565b919050565b600080600080600060a08688031215620001be57600080fd5b8551620001cb8162000164565b80955050602080870151620001e08162000164565b60408801519095506001600160401b0380821115620001fe57600080fd5b818901915089601f8301126200021357600080fd5b8151818111156200022857620002286200017d565b8060051b604051601f19603f830116810181811085821117156200025057620002506200017d565b60405291825284820192508381018501918c8311156200026f57600080fd5b938501935b828510156200029857620002888562000193565b8452938501939285019262000274565b809850505050505050620002af6060870162000193565b9150608086015190509295509295909350565b634e487b7160e01b600052603260045260246000fd5b60805160a0516113d8620002fe60003960006101060152600061024b01526113d86000f3fe6080604052600436106100eb5760003560e01c806361b12c661161008a578063dbe1a6eb11610059578063dbe1a6eb146102d3578063f23a6e61146102f3578063f2fde38b1461031f578063fc4116831461033f57600080fd5b806361b12c6614610239578063715018a6146102745780638da5cb5b14610289578063bc197c81146102a757600080fd5b8063150b7a02116100c6578063150b7a0214610195578063179e740b146101d957806324523192146101f75780634dcea1551461021757600080fd5b8062aace9a146100f757806301ffc9a714610143578063108e8c1d1461017357600080fd5b366100f257005b600080fd5b34801561010357600080fd5b507f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b0390911681526020015b60405180910390f35b34801561014f57600080fd5b5061016361015e366004610c9f565b61035f565b604051901515815260200161013a565b34801561017f57600080fd5b506101886103a5565b60405161013a9190610cc9565b3480156101a157600080fd5b506101c06101b0366004610de0565b630a85bd0160e11b949350505050565b6040516001600160e01b0319909116815260200161013a565b3480156101e557600080fd5b506003546001600160a01b0316610126565b34801561020357600080fd5b50610163610212366004610e4b565b610407565b34801561022357600080fd5b50610237610232366004610e6d565b610437565b005b34801561024557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000815260200161013a565b34801561028057600080fd5b5061023761051e565b34801561029557600080fd5b506000546001600160a01b0316610126565b3480156102b357600080fd5b506101c06102c2366004610f87565b63bc197c8160e01b95945050505050565b3480156102df57600080fd5b506102376102ee366004610e6d565b610532565b3480156102ff57600080fd5b506101c061030e366004611034565b63f23a6e6160e01b95945050505050565b34801561032b57600080fd5b5061023761033a36600461109c565b610726565b34801561034b57600080fd5b5061023761035a36600461109c565b610764565b60006001600160e01b031982166328373a4560e01b148061039057506001600160e01b03198216630a85bd0160e11b145b8061039f575061039f826107c0565b92915050565b606060048054806020026020016040519081016040528092919081815260200182805480156103fd57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116103df575b5050505050905090565b6000818152600260209081526040808320600886901c8452909152812054600160ff85161b1615155b9392505050565b6000610442826107f5565b905061044e8282610830565b6104785760405163fef5040960e01b815261046f9082908490600401611102565b60405180910390fd5b6000848460405161048a929190611116565b604051908190039020905061049f8382610875565b6104bc5760405163017c689560e61b815260040160405180910390fd5b6104c5836108cc565b6104e257604051634371daa160e11b815260040160405180910390fd5b60006104ed84610927565b90506104f9848261099b565b61051657604051636fbd3b7160e11b815260040160405180910390fd5b505050505050565b6105266109e1565b6105306000610a0e565b565b61053a610a5e565b610545838383610437565b6000610550826107f5565b905060006105646080840160608501611126565b6001600160401b038116600090815260026020526040902090915060048510156105a5578585604051636942600f60e11b815260040161046f92919061116a565b60006105b4600482888a61117e565b6105bd916111a8565b90503660006105cf886004818c61117e565b909250905063dc857e9160e01b6001600160e01b031984160161063957600886901c600090815260208590526040902054600160ff88161b161561062a578888604051637b97a6bb60e01b815260040161046f92919061116a565b6106348282610a88565b6106b6565b63efcde17560e01b6001600160e01b031984160161069957600886901c600090815260208590526040902054600160ff88161b161561068f578888604051637b97a6bb60e01b815260040161046f92919061116a565b6106348282610abb565b8888604051636942600f60e11b815260040161046f92919061116a565b600886901c60009081526020859052604090208054600160ff89161b1790557fd39d8e3e610251d36b5464d9cabbd8fa8319fe6cff76941ce041ecf04669726f86868b8b60405161070a94939291906111d8565b60405180910390a150505050505061072160018055565b505050565b61072e6109e1565b6001600160a01b03811661075857604051631e4fbdf760e01b81526000600482015260240161046f565b61076181610a0e565b50565b61076c6109e1565b600380546001600160a01b0319166001600160a01b0383169081179091556040519081527f4991c6f37185659e276ff918a96f3e20e6c5abcd8c9aab450dc19c2f7ad35cb59060200160405180910390a150565b60006001600160e01b03198216630271189760e51b148061039f57506301ffc9a760e01b6001600160e01b031983161461039f565b60006108076060830160408401611126565b6001600160401b031661081d6020840184611126565b6001600160401b031661039f919061120f565b6000816108406020850185611126565b6001600160401b03161115801561043057506108626040840160208501611126565b6001600160401b03169091111592915050565b6000368161088660e0860186611230565b90925090506010811480156108c357506108bc6108a96080870160608801611126565b839083906001600160401b031687610ae9565b8560800135145b95945050505050565b600036816108de610100850185611230565b909250905060208114801561091f57506109186109016060860160408701611126565b839083906001600160401b03166080880135610ae9565b8460a00135145b949350505050565b60035460405163307d66bf60e21b81526000916001600160a01b03169063c1f59afc9061095a9030908690600401611280565b602060405180830381865afa158015610977573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061039f919061129d565b60008260a001358360c001356040516020016109c1929190918252602082015260400190565b604051602081830303815290604052805190602001208214905092915050565b6000546001600160a01b031633146105305760405163118cdaa760e01b815233600482015260240161046f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600260015403610a8157604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b6000806060610a99848601866112b6565b91945092509050610ab46001600160a01b0384168383610baa565b5050505050565b60006060610acb8385018561130e565b9092509050610ae36001600160a01b03831682610c1d565b50505050565b600083815b81811015610b51576000878783818110610b0a57610b0a61135d565b90506020020135905085600116600003610b335760008581526020829052604090209450610b44565b600081815260208690526040902094505b50600194851c9401610aee565b508315610ba05760405162461bcd60e51b815260206004820181905260248201527f4c69624d65726b6c6533323a20696e646578206f7574206f6620626f756e6473604482015260640161046f565b5090949350505050565b60006060846001600160a01b03168484604051610bc79190611373565b60006040518083038185875af1925050503d8060008114610c04576040519150601f19603f3d011682016040523d82523d6000602084013e610c09565b606091505b50909250905081610ab457610ab481610c89565b60006060836001600160a01b031683604051610c399190611373565b600060405180830381855af49150503d8060008114610c74576040519150601f19603f3d011682016040523d82523d6000602084013e610c79565b606091505b50909250905081610ae357610ae3815b8051600003610c9757600080fd5b805181602001fd5b600060208284031215610cb157600080fd5b81356001600160e01b03198116811461043057600080fd5b6020808252825182820181905260009190848201906040850190845b81811015610d0a5783516001600160a01b031683529284019291840191600101610ce5565b50909695505050505050565b6001600160a01b038116811461076157600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715610d6957610d69610d2b565b604052919050565b600082601f830112610d8257600080fd5b81356001600160401b03811115610d9b57610d9b610d2b565b610dae601f8201601f1916602001610d41565b818152846020838601011115610dc357600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215610df657600080fd5b8435610e0181610d16565b93506020850135610e1181610d16565b92506040850135915060608501356001600160401b03811115610e3357600080fd5b610e3f87828801610d71565b91505092959194509250565b60008060408385031215610e5e57600080fd5b50508035926020909101359150565b600080600060408486031215610e8257600080fd5b83356001600160401b0380821115610e9957600080fd5b818601915086601f830112610ead57600080fd5b813581811115610ebc57600080fd5b876020828501011115610ece57600080fd5b602092830195509350908501359080821115610ee957600080fd5b5084016101208187031215610efd57600080fd5b809150509250925092565b600082601f830112610f1957600080fd5b813560206001600160401b03821115610f3457610f34610d2b565b8160051b610f43828201610d41565b9283528481018201928281019087851115610f5d57600080fd5b83870192505b84831015610f7c57823582529183019190830190610f63565b979650505050505050565b600080600080600060a08688031215610f9f57600080fd5b8535610faa81610d16565b94506020860135610fba81610d16565b935060408601356001600160401b0380821115610fd657600080fd5b610fe289838a01610f08565b94506060880135915080821115610ff857600080fd5b61100489838a01610f08565b9350608088013591508082111561101a57600080fd5b5061102788828901610d71565b9150509295509295909350565b600080600080600060a0868803121561104c57600080fd5b853561105781610d16565b9450602086013561106781610d16565b9350604086013592506060860135915060808601356001600160401b0381111561109057600080fd5b61102788828901610d71565b6000602082840312156110ae57600080fd5b813561043081610d16565b80356001600160401b03811681146110d057600080fd5b919050565b6001600160401b03806110e7836110b9565b168352806110f7602084016110b9565b166020840152505050565b8281526060810161043060208301846110d5565b8183823760009101908152919050565b60006020828403121561113857600080fd5b610430826110b9565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60208152600061091f602083018486611141565b6000808585111561118e57600080fd5b8386111561119b57600080fd5b5050820193919092039150565b6001600160e01b031981358181169160048510156111d05780818660040360031b1b83161692505b505092915050565b60006001600160401b03808716835280861660208401525060606040830152611205606083018486611141565b9695505050505050565b8082018082111561039f57634e487b7160e01b600052601160045260246000fd5b6000808335601e1984360301811261124757600080fd5b8301803591506001600160401b0382111561126157600080fd5b6020019150600581901b360382131561127957600080fd5b9250929050565b6001600160a01b03831681526060810161043060208301846110d5565b6000602082840312156112af57600080fd5b5051919050565b6000806000606084860312156112cb57600080fd5b83356112d681610d16565b92506020840135915060408401356001600160401b038111156112f857600080fd5b61130486828701610d71565b9150509250925092565b6000806040838503121561132157600080fd5b823561132c81610d16565b915060208301356001600160401b0381111561134757600080fd5b61135385828601610d71565b9150509250929050565b634e487b7160e01b600052603260045260246000fd5b6000825160005b81811015611394576020818601810151858301520161137a565b50600092019182525091905056fea2646970667358221220065690aa558c226601c6855f13ad5e36d71a9c4c8cc49aaf9060519b30f496f864736f6c63430008170033a26469706673582212205c56bf9fd67eefa5bc4d2f1ef0cd3f63e53e830767c0b87db42e328955aa10a564736f6c63430008170033", + "numDeployments": 2, + "solcInputHash": "3277ebc53d2ec4c7847e5faa9f9b26b3", + "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IConsensus\",\"name\":\"consensus\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"appOwner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"templateHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"contract IApplication\",\"name\":\"appContract\",\"type\":\"address\"}],\"name\":\"ApplicationCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"contract IConsensus\",\"name\":\"consensus\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"appOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"templateHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"}],\"name\":\"calculateApplicationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IConsensus\",\"name\":\"consensus\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"appOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"templateHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"}],\"name\":\"newApplication\",\"outputs\":[{\"internalType\":\"contract IApplication\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IConsensus\",\"name\":\"consensus\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"appOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"templateHash\",\"type\":\"bytes32\"}],\"name\":\"newApplication\",\"outputs\":[{\"internalType\":\"contract IApplication\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"ApplicationCreated(address,address,bytes32,address)\":{\"details\":\"MUST be triggered on a successful call to `newApplication`.\",\"params\":{\"appContract\":\"The application contract\",\"appOwner\":\"The initial application owner\",\"consensus\":\"The initial consensus contract\",\"templateHash\":\"The initial machine state hash\"}}},\"kind\":\"dev\",\"methods\":{\"calculateApplicationAddress(address,address,bytes32,bytes32)\":{\"details\":\"Beware that only the `newApplication` function with the `salt` parameter is able to deterministically deploy an application.\",\"params\":{\"appOwner\":\"The initial application owner\",\"consensus\":\"The initial consensus contract\",\"salt\":\"The salt used to deterministically generate the application contract address\",\"templateHash\":\"The initial machine state hash\"},\"returns\":{\"_0\":\"The deterministic application contract address\"}},\"newApplication(address,address,bytes32)\":{\"details\":\"On success, MUST emit an `ApplicationCreated` event.Reverts if the application owner address is zero.\",\"params\":{\"appOwner\":\"The initial application owner\",\"consensus\":\"The initial consensus contract\",\"templateHash\":\"The initial machine state hash\"},\"returns\":{\"_0\":\"The application\"}},\"newApplication(address,address,bytes32,bytes32)\":{\"details\":\"On success, MUST emit an `ApplicationCreated` event.Reverts if the application owner address is zero.\",\"params\":{\"appOwner\":\"The initial application owner\",\"consensus\":\"The initial consensus contract\",\"salt\":\"The salt used to deterministically generate the application contract address\",\"templateHash\":\"The initial machine state hash\"},\"returns\":{\"_0\":\"The application\"}}},\"title\":\"Application Factory\",\"version\":1},\"userdoc\":{\"events\":{\"ApplicationCreated(address,address,bytes32,address)\":{\"notice\":\"A new application was deployed.\"}},\"kind\":\"user\",\"methods\":{\"calculateApplicationAddress(address,address,bytes32,bytes32)\":{\"notice\":\"Calculate the address of an application contract to be deployed deterministically.\"},\"newApplication(address,address,bytes32)\":{\"notice\":\"Deploy a new application.\"},\"newApplication(address,address,bytes32,bytes32)\":{\"notice\":\"Deploy a new application deterministically.\"}},\"notice\":\"Allows anyone to reliably deploy a new `IApplication` contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dapp/ApplicationFactory.sol\":\"ApplicationFactory\"},\"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 v5.0.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {Context} from \\\"../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 * The initial owner is set to the address provided by the deployer. This can\\n * 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 /**\\n * @dev The caller account is not authorized to perform an operation.\\n */\\n error OwnableUnauthorizedAccount(address account);\\n\\n /**\\n * @dev The owner is not a valid owner account. (eg. `address(0)`)\\n */\\n error OwnableInvalidOwner(address owner);\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\\n */\\n constructor(address initialOwner) {\\n if (initialOwner == address(0)) {\\n revert OwnableInvalidOwner(address(0));\\n }\\n _transferOwnership(initialOwner);\\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 if (owner() != _msgSender()) {\\n revert OwnableUnauthorizedAccount(_msgSender());\\n }\\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 if (newOwner == address(0)) {\\n revert OwnableInvalidOwner(address(0));\\n }\\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\":\"0xff6d0bb2e285473e5311d9d3caacb525ae3538a80758c10649a4d61029b017bb\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155Receiver.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Interface that must be implemented by smart contracts in order to receive\\n * ERC-1155 token transfers.\\n */\\ninterface IERC1155Receiver is IERC165 {\\n /**\\n * @dev Handles the receipt of a single ERC1155 token type. This function is\\n * called at the end of a `safeTransferFrom` after the balance has been updated.\\n *\\n * NOTE: To accept the transfer, this must return\\n * `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))`\\n * (i.e. 0xf23a6e61, or its own function selector).\\n *\\n * @param operator The address which initiated the transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param id The ID of the token being transferred\\n * @param value The amount of tokens being transferred\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155Received(\\n address operator,\\n address from,\\n uint256 id,\\n uint256 value,\\n bytes calldata data\\n ) external returns (bytes4);\\n\\n /**\\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\\n * is called at the end of a `safeBatchTransferFrom` after the balances have\\n * been updated.\\n *\\n * NOTE: To accept the transfer(s), this must return\\n * `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))`\\n * (i.e. 0xbc197c81, or its own function selector).\\n *\\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155BatchReceived(\\n address operator,\\n address from,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xb69597a63b202e28401128bed6a6d259e8730191274471af7303eafb247881a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/utils/ERC1155Holder.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165, ERC165} from \\\"../../../utils/introspection/ERC165.sol\\\";\\nimport {IERC1155Receiver} from \\\"../IERC1155Receiver.sol\\\";\\n\\n/**\\n * @dev Simple implementation of `IERC1155Receiver` that will allow a contract to hold ERC1155 tokens.\\n *\\n * IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be\\n * stuck.\\n */\\nabstract contract ERC1155Holder is ERC165, IERC1155Receiver {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\\n return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n function onERC1155Received(\\n address,\\n address,\\n uint256,\\n uint256,\\n bytes memory\\n ) public virtual override returns (bytes4) {\\n return this.onERC1155Received.selector;\\n }\\n\\n function onERC1155BatchReceived(\\n address,\\n address,\\n uint256[] memory,\\n uint256[] memory,\\n bytes memory\\n ) public virtual override returns (bytes4) {\\n return this.onERC1155BatchReceived.selector;\\n }\\n}\\n\",\"keccak256\":\"0xc26cd2e2bcf59b87c986fc653545b35010db9c585a3f3312fe61d7b1b3805735\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be\\n * reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0x7f7a26306c79a65fb8b3b6c757cd74660c532cd8a02e165488e30027dd34ca49\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/utils/ERC721Holder.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC721Receiver} from \\\"../IERC721Receiver.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC721Receiver} interface.\\n *\\n * Accepts all token transfers.\\n * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or\\n * {IERC721-setApprovalForAll}.\\n */\\nabstract contract ERC721Holder is IERC721Receiver {\\n /**\\n * @dev See {IERC721Receiver-onERC721Received}.\\n *\\n * Always returns `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(address, address, uint256, bytes memory) public virtual returns (bytes4) {\\n return this.onERC721Received.selector;\\n }\\n}\\n\",\"keccak256\":\"0xaad20f8713b5cd98114278482d5d91b9758f9727048527d582e8e88fd4901fd8\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\\n\\npragma solidity ^0.8.20;\\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 function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Not enough balance for performing a CREATE2 deploy.\\n */\\n error Create2InsufficientBalance(uint256 balance, uint256 needed);\\n\\n /**\\n * @dev There's no code to deploy.\\n */\\n error Create2EmptyBytecode();\\n\\n /**\\n * @dev The deployment failed.\\n */\\n error Create2FailedDeployment();\\n\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\\n if (address(this).balance < amount) {\\n revert Create2InsufficientBalance(address(this).balance, amount);\\n }\\n if (bytecode.length == 0) {\\n revert Create2EmptyBytecode();\\n }\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n if (addr == address(0)) {\\n revert Create2FailedDeployment();\\n }\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2b9807d194b92f1068d868e9587d27037264a9a067c778486f86ae21c61cbd5e\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant NOT_ENTERED = 1;\\n uint256 private constant ENTERED = 2;\\n\\n uint256 private _status;\\n\\n /**\\n * @dev Unauthorized reentrant call.\\n */\\n error ReentrancyGuardReentrantCall();\\n\\n constructor() {\\n _status = NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and making it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n _nonReentrantBefore();\\n _;\\n _nonReentrantAfter();\\n }\\n\\n function _nonReentrantBefore() private {\\n // On the first call to nonReentrant, _status will be NOT_ENTERED\\n if (_status == ENTERED) {\\n revert ReentrancyGuardReentrantCall();\\n }\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = ENTERED;\\n }\\n\\n function _nonReentrantAfter() private {\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Returns true if the reentrancy guard is currently set to \\\"entered\\\", which indicates there is a\\n * `nonReentrant` function in the call stack.\\n */\\n function _reentrancyGuardEntered() internal view returns (bool) {\\n return _status == ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0xf980daa263b661ab8ddee7d4fd833c7da7e7995e2c359ff1f17e67e4112f2236\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0x9e8778b14317ba9e256c30a76fd6c32b960af621987f56069e1e819c77c6a133\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x4296879f55019b23e135000eb36896057e7101fb7fb859c5ef690cf14643757b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/structs/BitMaps.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/BitMaps.sol)\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Library for managing uint256 to bool mapping in a compact and efficient way, provided the keys are sequential.\\n * Largely inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor].\\n *\\n * BitMaps pack 256 booleans across each bit of a single 256-bit slot of `uint256` type.\\n * Hence booleans corresponding to 256 _sequential_ indices would only consume a single slot,\\n * unlike the regular `bool` which would consume an entire slot for a single value.\\n *\\n * This results in gas savings in two ways:\\n *\\n * - Setting a zero value to non-zero only once every 256 times\\n * - Accessing the same warm slot for every 256 _sequential_ indices\\n */\\nlibrary BitMaps {\\n struct BitMap {\\n mapping(uint256 bucket => uint256) _data;\\n }\\n\\n /**\\n * @dev Returns whether the bit at `index` is set.\\n */\\n function get(BitMap storage bitmap, uint256 index) internal view returns (bool) {\\n uint256 bucket = index >> 8;\\n uint256 mask = 1 << (index & 0xff);\\n return bitmap._data[bucket] & mask != 0;\\n }\\n\\n /**\\n * @dev Sets the bit at `index` to the boolean `value`.\\n */\\n function setTo(BitMap storage bitmap, uint256 index, bool value) internal {\\n if (value) {\\n set(bitmap, index);\\n } else {\\n unset(bitmap, index);\\n }\\n }\\n\\n /**\\n * @dev Sets the bit at `index`.\\n */\\n function set(BitMap storage bitmap, uint256 index) internal {\\n uint256 bucket = index >> 8;\\n uint256 mask = 1 << (index & 0xff);\\n bitmap._data[bucket] |= mask;\\n }\\n\\n /**\\n * @dev Unsets the bit at `index`.\\n */\\n function unset(BitMap storage bitmap, uint256 index) internal {\\n uint256 bucket = index >> 8;\\n uint256 mask = 1 << (index & 0xff);\\n bitmap._data[bucket] &= ~mask;\\n }\\n}\\n\",\"keccak256\":\"0x3616f1b0d0a9ee1ca8f0953ecaceb9230e36f691c7974d30f964212acff52d2b\",\"license\":\"MIT\"},\"contracts/access/IOwnable.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/// @notice The interface of OpenZeppelin's `Ownable` contract.\\ninterface IOwnable {\\n function owner() external view returns (address);\\n function renounceOwnership() external;\\n function transferOwnership(address newOwner) external;\\n}\\n\",\"keccak256\":\"0x826f366603fe6fd715bd912d40e9b4e851c110aea5895522523d800015532f6d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/common/CanonicalMachine.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 Canonical Machine Constants Library\\n///\\n/// @notice Defines several constants related to the reference implementation\\n/// of the RISC-V machine that runs Linux, also known as the \\\"Cartesi Machine\\\".\\nlibrary CanonicalMachine {\\n /// @notice Maximum input size (2 megabytes).\\n uint256 constant INPUT_MAX_SIZE = 1 << 21;\\n\\n /// @notice Log2 of maximum number of outputs.\\n uint256 constant LOG2_MAX_OUTPUTS = 63;\\n}\\n\",\"keccak256\":\"0xd433ed779b77fa74a86514a17eb76c9d4f250c5506a223541eb12963192d7ce0\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/common/OutputValidityProof.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/// @notice Proof of inclusion of an output in the output Merkle tree.\\n/// @param outputIndex Index of output in the Merkle tree\\n/// @param outputHashesSiblings Siblings of the output in the Merkle tree\\n/// @dev From the index and siblings, one can calculate the root of the Merkle tree.\\n/// @dev The siblings array should have size equal to the log2 of the maximum number of outputs.\\n/// @dev See the `CanonicalMachine` library for constants.\\nstruct OutputValidityProof {\\n uint64 outputIndex;\\n bytes32[] outputHashesSiblings;\\n}\\n\",\"keccak256\":\"0x3bd009e3b744e160f92a84624f8c325b5a6abc8f4e8e02e4a1b8a6de73779c1c\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/common/Outputs.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 Outputs\\n/// @notice Defines the signatures of outputs that can be generated by the\\n/// off-chain machine and verified by the on-chain contracts.\\ninterface Outputs {\\n /// @notice A piece of verifiable information.\\n /// @param payload An arbitrary payload.\\n function Notice(bytes calldata payload) external;\\n\\n /// @notice A single-use permission to execute a specific message call\\n /// from the context of the application contract.\\n /// @param destination The address that will be called\\n /// @param value The amount of Wei to be transferred through the call\\n /// @param payload The payload, which\\u2014in the case of Solidity\\n /// contracts\\u2014encodes a function call\\n function Voucher(\\n address destination,\\n uint256 value,\\n bytes calldata payload\\n ) external;\\n\\n /// @notice A single-use permission to execute a specific delegate call\\n /// from the context of the application contract.\\n /// @param destination The address that will be called\\n /// @param payload The payload, which\\u2014in the case of Solidity\\n /// libraries\\u2014encodes a function call\\n function DelegateCallVoucher(\\n address destination,\\n bytes calldata payload\\n ) external;\\n}\\n\",\"keccak256\":\"0xaee9d71104bfe2fab21d4e26f3ed802439d6c2e1bc5aeb9bfc5090f4083bd542\",\"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/// @notice Each application has its own stream of inputs.\\n/// See the `IInputBox` interface for calldata-based on-chain data availability.\\n/// @notice When an input is fed to the application, it may yield several outputs.\\n/// @notice Since genesis, a Merkle tree of all outputs ever produced is maintained\\n/// both inside and outside the Cartesi Machine.\\n/// @notice The claim that validators may submit to the consensus contract\\n/// is the root of this Merkle tree after processing all base layer blocks until some height.\\n/// @notice A validator should be able to save transaction fees by not submitting a claim if it was...\\n/// - already submitted by the validator (see the `ClaimSubmission` event) or;\\n/// - already accepted by the consensus (see the `ClaimAcceptance` event).\\n/// @notice The acceptance criteria for claims may depend on the type of consensus, and is not specified by this interface.\\n/// For example, a claim may be accepted if it was...\\n/// - submitted by an authority or;\\n/// - submitted by the majority of a quorum or;\\n/// - submitted and not proven wrong after some period of time or;\\n/// - submitted and proven correct through an on-chain tournament.\\ninterface IConsensus {\\n /// @notice MUST trigger when a claim is submitted.\\n /// @param submitter The submitter address\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The root of the Merkle tree of outputs\\n event ClaimSubmission(\\n address indexed submitter,\\n address indexed appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n );\\n\\n /// @notice MUST trigger when a claim is accepted.\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The root of the Merkle tree of outputs\\n event ClaimAcceptance(\\n address indexed appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n );\\n\\n /// @notice Submit a claim to the consensus.\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The root of the Merkle tree of outputs\\n /// @dev MUST fire a `ClaimSubmission` event.\\n /// @dev MAY fire a `ClaimAcceptance` event, if the acceptance criteria is met.\\n function submitClaim(\\n address appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n ) external;\\n\\n /// @notice Check if an output Merkle root hash was ever accepted by the consensus\\n /// for a particular application.\\n /// @param appContract The application contract address\\n /// @param claim The root of the Merkle tree of outputs\\n function wasClaimAccepted(\\n address appContract,\\n bytes32 claim\\n ) external view returns (bool);\\n\\n /// @notice Get the epoch length, in number of base layer blocks.\\n /// @dev The epoch number of a block is defined as\\n /// the integer division of the block number by the epoch length.\\n function getEpochLength() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x33ef3c4e213b2a3489b37d5ef553dc1165c598c56beb0ed8290723a5c74d821c\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/Application.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 {IApplication} from \\\"./IApplication.sol\\\";\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\nimport {LibOutputValidityProof} from \\\"../library/LibOutputValidityProof.sol\\\";\\nimport {OutputValidityProof} from \\\"../common/OutputValidityProof.sol\\\";\\nimport {Outputs} from \\\"../common/Outputs.sol\\\";\\nimport {LibAddress} from \\\"../library/LibAddress.sol\\\";\\nimport {IOwnable} from \\\"../access/IOwnable.sol\\\";\\n\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {ERC721Holder} from \\\"@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol\\\";\\nimport {ERC1155Holder} from \\\"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol\\\";\\nimport {ReentrancyGuard} from \\\"@openzeppelin/contracts/utils/ReentrancyGuard.sol\\\";\\nimport {IERC721Receiver} from \\\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\\\";\\nimport {BitMaps} from \\\"@openzeppelin/contracts/utils/structs/BitMaps.sol\\\";\\n\\ncontract Application is\\n IApplication,\\n Ownable,\\n ERC721Holder,\\n ERC1155Holder,\\n ReentrancyGuard\\n{\\n using BitMaps for BitMaps.BitMap;\\n using LibAddress for address;\\n using LibOutputValidityProof for OutputValidityProof;\\n\\n /// @notice The initial machine state hash.\\n /// @dev See the `getTemplateHash` function.\\n bytes32 internal immutable _templateHash;\\n\\n /// @notice Keeps track of which outputs have been executed.\\n /// @dev See the `wasOutputExecuted` function.\\n BitMaps.BitMap internal _executed;\\n\\n /// @notice The current consensus contract.\\n /// @dev See the `getConsensus` and `migrateToConsensus` functions.\\n IConsensus internal _consensus;\\n\\n /// @notice Creates an `Application` contract.\\n /// @param consensus The initial consensus contract\\n /// @param initialOwner The initial application owner\\n /// @param templateHash The initial machine state hash\\n /// @dev Reverts if the initial application owner address is zero.\\n constructor(\\n IConsensus consensus,\\n address initialOwner,\\n bytes32 templateHash\\n ) Ownable(initialOwner) {\\n _templateHash = templateHash;\\n _consensus = consensus;\\n }\\n\\n /// @notice Accept Ether transfers.\\n /// @dev If you wish to transfer Ether to an application while informing\\n /// the backend of it, then please do so through the Ether portal contract.\\n receive() external payable {}\\n\\n function executeOutput(\\n bytes calldata output,\\n OutputValidityProof calldata proof\\n ) external override nonReentrant {\\n validateOutput(output, proof);\\n\\n uint64 outputIndex = proof.outputIndex;\\n\\n if (output.length < 4) {\\n revert OutputNotExecutable(output);\\n }\\n\\n bytes4 selector = bytes4(output[:4]);\\n bytes calldata arguments = output[4:];\\n\\n if (selector == Outputs.Voucher.selector) {\\n if (_executed.get(outputIndex)) {\\n revert OutputNotReexecutable(output);\\n }\\n _executeVoucher(arguments);\\n } else if (selector == Outputs.DelegateCallVoucher.selector) {\\n if (_executed.get(outputIndex)) {\\n revert OutputNotReexecutable(output);\\n }\\n _executeDelegateCallVoucher(arguments);\\n } else {\\n revert OutputNotExecutable(output);\\n }\\n\\n _executed.set(outputIndex);\\n emit OutputExecuted(outputIndex, output);\\n }\\n\\n function migrateToConsensus(\\n IConsensus newConsensus\\n ) external override onlyOwner {\\n _consensus = newConsensus;\\n emit NewConsensus(newConsensus);\\n }\\n\\n function wasOutputExecuted(\\n uint256 outputIndex\\n ) external view override returns (bool) {\\n return _executed.get(outputIndex);\\n }\\n\\n function validateOutput(\\n bytes calldata output,\\n OutputValidityProof calldata proof\\n ) public view override {\\n validateOutputHash(keccak256(output), proof);\\n }\\n\\n function validateOutputHash(\\n bytes32 outputHash,\\n OutputValidityProof calldata proof\\n ) public view override {\\n if (!proof.isSiblingsArrayLengthValid()) {\\n revert InvalidOutputHashesSiblingsArrayLength();\\n }\\n\\n bytes32 claim = proof.computeClaim(outputHash);\\n\\n if (!_wasClaimAccepted(claim)) {\\n revert ClaimNotAccepted(claim);\\n }\\n }\\n\\n function getTemplateHash() external view override returns (bytes32) {\\n return _templateHash;\\n }\\n\\n function getConsensus() external view override returns (IConsensus) {\\n return _consensus;\\n }\\n\\n function owner() public view override(IOwnable, Ownable) returns (address) {\\n return super.owner();\\n }\\n\\n function renounceOwnership() public override(IOwnable, Ownable) {\\n super.renounceOwnership();\\n }\\n\\n function transferOwnership(\\n address newOwner\\n ) public override(IOwnable, Ownable) {\\n super.transferOwnership(newOwner);\\n }\\n\\n /// @notice Check if an output Merkle root hash was ever accepted by the current consensus.\\n /// @param claim The output Merkle root hash\\n function _wasClaimAccepted(bytes32 claim) internal view returns (bool) {\\n return _consensus.wasClaimAccepted(address(this), claim);\\n }\\n\\n /// @notice Executes a voucher\\n /// @param arguments ABI-encoded arguments\\n function _executeVoucher(bytes calldata arguments) internal {\\n address destination;\\n uint256 value;\\n bytes memory payload;\\n\\n (destination, value, payload) = abi.decode(\\n arguments,\\n (address, uint256, bytes)\\n );\\n\\n destination.safeCall(value, payload);\\n }\\n\\n /// @notice Executes a delegatecall voucher\\n /// @param arguments ABI-encoded arguments\\n function _executeDelegateCallVoucher(bytes calldata arguments) internal {\\n address destination;\\n bytes memory payload;\\n\\n (destination, payload) = abi.decode(arguments, (address, bytes));\\n\\n destination.safeDelegateCall(payload);\\n }\\n}\\n\",\"keccak256\":\"0xf6a70450836fc4d5dec47a4df10c139870b8279d34ae05b8e0710a7153e045e8\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/ApplicationFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Create2} from \\\"@openzeppelin/contracts/utils/Create2.sol\\\";\\n\\nimport {IApplicationFactory} from \\\"./IApplicationFactory.sol\\\";\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\nimport {Application} from \\\"./Application.sol\\\";\\nimport {IApplication} from \\\"./IApplication.sol\\\";\\n\\n/// @title Application Factory\\n/// @notice Allows anyone to reliably deploy a new `IApplication` contract.\\ncontract ApplicationFactory is IApplicationFactory {\\n function newApplication(\\n IConsensus consensus,\\n address appOwner,\\n bytes32 templateHash\\n ) external override returns (IApplication) {\\n IApplication appContract = new Application(\\n consensus,\\n appOwner,\\n templateHash\\n );\\n\\n emit ApplicationCreated(consensus, appOwner, templateHash, appContract);\\n\\n return appContract;\\n }\\n\\n function newApplication(\\n IConsensus consensus,\\n address appOwner,\\n bytes32 templateHash,\\n bytes32 salt\\n ) external override returns (IApplication) {\\n IApplication appContract = new Application{salt: salt}(\\n consensus,\\n appOwner,\\n templateHash\\n );\\n\\n emit ApplicationCreated(consensus, appOwner, templateHash, appContract);\\n\\n return appContract;\\n }\\n\\n function calculateApplicationAddress(\\n IConsensus consensus,\\n address appOwner,\\n bytes32 templateHash,\\n bytes32 salt\\n ) external view override returns (address) {\\n return\\n Create2.computeAddress(\\n salt,\\n keccak256(\\n abi.encodePacked(\\n type(Application).creationCode,\\n abi.encode(consensus, appOwner, templateHash)\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0xfb2191314998c855167aa5f4499ed36b624a167d9f2374a23ff16fe7d3365305\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/IApplication.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 {IOwnable} from \\\"../access/IOwnable.sol\\\";\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\nimport {OutputValidityProof} from \\\"../common/OutputValidityProof.sol\\\";\\n\\n/// @notice The base layer incarnation of an application running on the execution layer.\\n/// @notice The state of the application advances through inputs sent to an `IInputBox` contract.\\n/// @notice These inputs can be sent either directly, or indirectly through portals.\\n/// @notice Reader nodes can retrieve inputs sent to the `IInputBox` contract through events, and feed them into the machine.\\n/// @notice Validator nodes can also submit claims to the `IConsensus` contract (see the `getConsensus` function).\\n/// @notice Once accepted, claims can be used to validate outputs generated by the machine.\\n/// @notice Some outputs are executable, which means they can have on-chain side effects.\\n/// @notice Every application is subscribed to some consensus, and may be governed by some owner.\\n/// The consensus has the power to accept claims, which, in turn, are used to validate outputs.\\n/// Meanwhile, the owner can replace the consensus at any time.\\n/// Therefore, the users of an application must trust both the consensus and the application owner.\\n/// @notice There are several ownership models to choose from:\\n/// - no owner (address zero)\\n/// - individual signer (externally-owned account)\\n/// - multiple signers (multi-sig)\\n/// - DAO (decentralized autonomous organization)\\n/// - self-owned application (off-chain governance logic)\\n/// @notice See `IConsensus` for examples of consensus models.\\ninterface IApplication is IOwnable {\\n // Events\\n\\n /// @notice MUST trigger when a new consensus is chosen.\\n /// @param newConsensus The new consensus\\n event NewConsensus(IConsensus newConsensus);\\n\\n /// @notice MUST trigger when an output is executed.\\n /// @param outputIndex The index of the output\\n /// @param output The output\\n event OutputExecuted(uint64 outputIndex, bytes output);\\n\\n // Errors\\n\\n /// @notice Could not execute an output, because the application contract doesn't know how to.\\n /// @param output The output\\n error OutputNotExecutable(bytes output);\\n\\n /// @notice Could not execute an output, because it was already executed.\\n /// @param output The output\\n error OutputNotReexecutable(bytes output);\\n\\n /// @notice Raised when the output hashes siblings array has an invalid size.\\n /// @dev Please consult `CanonicalMachine` for the maximum number of outputs.\\n error InvalidOutputHashesSiblingsArrayLength();\\n\\n /// @notice Raised when the required claim was not accepted by the current consensus.\\n error ClaimNotAccepted(bytes32 claim);\\n\\n // Permissioned functions\\n\\n /// @notice Migrate the application to a new consensus.\\n /// @param newConsensus The new consensus\\n /// @dev Can only be called by the application owner.\\n function migrateToConsensus(IConsensus newConsensus) external;\\n\\n // Permissionless functions\\n\\n /// @notice Execute an output.\\n /// @param output The output\\n /// @param proof The proof used to validate the output against\\n /// a claim submitted to the current consensus contract\\n /// @dev On a successful execution, emits a `OutputExecuted` event.\\n /// @dev May raise any of the errors raised by `validateOutput`,\\n /// as well as `OutputNotExecutable` and `OutputNotReexecutable`.\\n function executeOutput(\\n bytes calldata output,\\n OutputValidityProof calldata proof\\n ) external;\\n\\n /// @notice Check whether an output has been executed.\\n /// @param outputIndex The index of output\\n /// @return Whether the output has been executed before\\n function wasOutputExecuted(\\n uint256 outputIndex\\n ) external view returns (bool);\\n\\n /// @notice Validate an output.\\n /// @param output The output\\n /// @param proof The proof used to validate the output against\\n /// a claim submitted to the current consensus contract\\n /// @dev May raise any of the errors raised by `validateOutputHash`.\\n function validateOutput(\\n bytes calldata output,\\n OutputValidityProof calldata proof\\n ) external view;\\n\\n /// @notice Validate an output hash.\\n /// @param outputHash The output hash\\n /// @param proof The proof used to validate the output against\\n /// a claim submitted to the current consensus contract\\n /// @dev May raise `InvalidOutputHashesSiblingsArrayLength`\\n /// or `ClaimNotAccepted`.\\n function validateOutputHash(\\n bytes32 outputHash,\\n OutputValidityProof calldata proof\\n ) external view;\\n\\n /// @notice Get the application's template hash.\\n /// @return The application's template hash\\n function getTemplateHash() external view returns (bytes32);\\n\\n /// @notice Get the current consensus.\\n /// @return The current consensus\\n function getConsensus() external view returns (IConsensus);\\n}\\n\",\"keccak256\":\"0x64ca7d1d00fe6eebb633ba07011bd73036360166bd8b75755f55e8f0f51c45ab\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/IApplicationFactory.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 {IApplication} from \\\"./IApplication.sol\\\";\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\n\\n/// @title Application Factory interface\\ninterface IApplicationFactory {\\n // Events\\n\\n /// @notice A new application was deployed.\\n /// @param consensus The initial consensus contract\\n /// @param appOwner The initial application owner\\n /// @param templateHash The initial machine state hash\\n /// @param appContract The application contract\\n /// @dev MUST be triggered on a successful call to `newApplication`.\\n event ApplicationCreated(\\n IConsensus indexed consensus,\\n address appOwner,\\n bytes32 templateHash,\\n IApplication appContract\\n );\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new application.\\n /// @param consensus The initial consensus contract\\n /// @param appOwner The initial application owner\\n /// @param templateHash The initial machine state hash\\n /// @return The application\\n /// @dev On success, MUST emit an `ApplicationCreated` event.\\n /// @dev Reverts if the application owner address is zero.\\n function newApplication(\\n IConsensus consensus,\\n address appOwner,\\n bytes32 templateHash\\n ) external returns (IApplication);\\n\\n /// @notice Deploy a new application deterministically.\\n /// @param consensus The initial consensus contract\\n /// @param appOwner The initial application owner\\n /// @param templateHash The initial machine state hash\\n /// @param salt The salt used to deterministically generate the application contract address\\n /// @return The application\\n /// @dev On success, MUST emit an `ApplicationCreated` event.\\n /// @dev Reverts if the application owner address is zero.\\n function newApplication(\\n IConsensus consensus,\\n address appOwner,\\n bytes32 templateHash,\\n bytes32 salt\\n ) external returns (IApplication);\\n\\n /// @notice Calculate the address of an application contract to be deployed deterministically.\\n /// @param consensus The initial consensus contract\\n /// @param appOwner The initial application owner\\n /// @param templateHash The initial machine state hash\\n /// @param salt The salt used to deterministically generate the application contract address\\n /// @return The deterministic application contract address\\n /// @dev Beware that only the `newApplication` function with the `salt` parameter\\n /// is able to deterministically deploy an application.\\n function calculateApplicationAddress(\\n IConsensus consensus,\\n address appOwner,\\n bytes32 templateHash,\\n bytes32 salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x8b3aab57aebe723265d1b1cad7c5d4c8ad944850b8b7c92f3c9cfade75f27197\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/library/LibAddress.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 {LibError} from \\\"../library/LibError.sol\\\";\\n\\nlibrary LibAddress {\\n using LibError for bytes;\\n\\n /// @notice Perform a low level call and raise error if failed\\n /// @param destination The address that will be called\\n /// @param value The amount of Wei to be transferred through the call\\n /// @param payload The payload, which\\u2014in the case of Solidity\\n /// contracts\\u2014encodes a function call\\n function safeCall(\\n address destination,\\n uint256 value,\\n bytes memory payload\\n ) internal {\\n bool success;\\n bytes memory returndata;\\n\\n (success, returndata) = destination.call{value: value}(payload);\\n\\n if (!success) {\\n returndata.raise();\\n }\\n }\\n\\n /// @notice Perform a delegate call and raise error if failed\\n /// @param destination The address that will be called\\n /// @param payload The payload, which\\u2014in the case of Solidity\\n /// libraries\\u2014encodes a function call\\n function safeDelegateCall(\\n address destination,\\n bytes memory payload\\n ) internal {\\n bool success;\\n bytes memory returndata;\\n\\n (success, returndata) = destination.delegatecall(payload);\\n\\n if (!success) {\\n returndata.raise();\\n }\\n }\\n}\\n\",\"keccak256\":\"0xcae26d227ecb61fe953e6a5937037529b02fd929f6857151661121d6d233c0ac\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/library/LibError.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\\nlibrary LibError {\\n /// @notice Raise error data\\n /// @param errordata Data returned by failed low-level call\\n function raise(bytes memory errordata) internal pure {\\n if (errordata.length == 0) {\\n revert();\\n } else {\\n assembly {\\n revert(add(32, errordata), mload(errordata))\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3d5f9497f40e172fe1a0b9e2635cd4b14c4c3d16bcfd851db034273573aae37d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/library/LibMerkle32.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.22;\\n\\n/// @title Merkle library for trees of 32-byte leaves\\n/// @notice This library is meant for creating and verifying Merkle proofs.\\n/// @notice Each Merkle tree is assumed to have `2^height` leaves.\\n/// @notice Nodes are concatenated pairwise and hashed with `keccak256`.\\n/// @notice Siblings are in bottom-up order, from leaf to root.\\nlibrary LibMerkle32 {\\n using LibMerkle32 for bytes32[];\\n\\n /// @notice Compute the root of a Merkle tree from its leaves.\\n /// @param leaves The left-most leaves of the Merkle tree\\n /// @param height The height of the Merkle tree\\n /// @return The root hash of the Merkle tree\\n /// @dev Raises an error if more than `2^height` leaves are provided.\\n function merkleRoot(\\n bytes32[] memory leaves,\\n uint256 height\\n ) internal pure returns (bytes32) {\\n bytes32 defaultNode;\\n for (uint256 i; i < height; ++i) {\\n leaves = leaves.parentLevel(defaultNode);\\n defaultNode = parent(defaultNode, defaultNode);\\n }\\n require(leaves.length <= 1, \\\"LibMerkle32: too many leaves\\\");\\n return leaves.at(0, defaultNode);\\n }\\n\\n /// @notice Compute the siblings of the ancestors of a leaf in a Merkle tree.\\n /// @param leaves The left-most leaves of the Merkle tree\\n /// @param index The index of the leaf\\n /// @param height The height of the Merkle tree\\n /// @return The siblings of the ancestors of the leaf in bottom-up order\\n /// @dev Raises an error if the provided index is out of bounds.\\n /// @dev Raises an error if more than `2^height` leaves are provided.\\n function siblings(\\n bytes32[] memory leaves,\\n uint256 index,\\n uint256 height\\n ) internal pure returns (bytes32[] memory) {\\n bytes32[] memory sibs = new bytes32[](height);\\n bytes32 defaultNode;\\n for (uint256 i; i < height; ++i) {\\n sibs[i] = leaves.at(index ^ 1, defaultNode);\\n leaves = leaves.parentLevel(defaultNode);\\n defaultNode = parent(defaultNode, defaultNode);\\n index >>= 1;\\n }\\n require(index == 0, \\\"LibMerkle32: index out of bounds\\\");\\n require(leaves.length <= 1, \\\"LibMerkle32: too many leaves\\\");\\n return sibs;\\n }\\n\\n /// @notice Compute the root of a Merkle tree after replacing one of its leaves.\\n /// @param sibs The siblings of the ancestors of the leaf in bottom-up order\\n /// @param index The index of the leaf\\n /// @param leaf The new leaf\\n /// @return The root hash of the new Merkle tree\\n /// @dev Raises an error if the provided index is out of bounds.\\n function merkleRootAfterReplacement(\\n bytes32[] calldata sibs,\\n uint256 index,\\n bytes32 leaf\\n ) internal pure returns (bytes32) {\\n uint256 height = sibs.length;\\n for (uint256 i; i < height; ++i) {\\n bytes32 sibling = sibs[i];\\n if (index & 1 == 0) {\\n leaf = parent(leaf, sibling);\\n } else {\\n leaf = parent(sibling, leaf);\\n }\\n index >>= 1;\\n }\\n require(index == 0, \\\"LibMerkle32: index out of bounds\\\");\\n return leaf;\\n }\\n\\n /// @notice Compute the parent of two nodes.\\n /// @param leftNode The left node\\n /// @param rightNode The right node\\n /// @return parentNode The parent node\\n /// @dev Uses assembly for extra performance\\n function parent(\\n bytes32 leftNode,\\n bytes32 rightNode\\n ) internal pure returns (bytes32 parentNode) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(0x00, leftNode)\\n mstore(0x20, rightNode)\\n parentNode := keccak256(0x00, 0x40)\\n }\\n }\\n\\n /// @notice Compute the parent level of an array of nodes.\\n /// @param nodes The array of left-most nodes\\n /// @param defaultNode The default node after the array\\n /// @return The left-most nodes of the parent level\\n /// @dev The default node of a parent level is\\n /// the parent node of two default nodes.\\n function parentLevel(\\n bytes32[] memory nodes,\\n bytes32 defaultNode\\n ) internal pure returns (bytes32[] memory) {\\n uint256 n = (nodes.length + 1) / 2; // ceil(#nodes / 2)\\n bytes32[] memory level = new bytes32[](n);\\n for (uint256 i; i < n; ++i) {\\n bytes32 leftLeaf = nodes[2 * i];\\n bytes32 rightLeaf = nodes.at(2 * i + 1, defaultNode);\\n level[i] = parent(leftLeaf, rightLeaf);\\n }\\n return level;\\n }\\n\\n /// @notice Get the node at some index\\n /// @param nodes The array of left-most nodes\\n /// @param index The index of the node\\n /// @param defaultNode The default node after the array\\n function at(\\n bytes32[] memory nodes,\\n uint256 index,\\n bytes32 defaultNode\\n ) internal pure returns (bytes32) {\\n if (index < nodes.length) {\\n return nodes[index];\\n } else {\\n return defaultNode;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x47ec1967c131735784544d1e1610a4eca01d54198411184f5e16c8662c5b63e7\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/library/LibOutputValidityProof.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 {CanonicalMachine} from \\\"../common/CanonicalMachine.sol\\\";\\nimport {OutputValidityProof} from \\\"../common/OutputValidityProof.sol\\\";\\n\\nimport {LibMerkle32} from \\\"./LibMerkle32.sol\\\";\\n\\nlibrary LibOutputValidityProof {\\n using LibMerkle32 for bytes32[];\\n\\n function isSiblingsArrayLengthValid(\\n OutputValidityProof calldata v\\n ) internal pure returns (bool) {\\n return\\n v.outputHashesSiblings.length == CanonicalMachine.LOG2_MAX_OUTPUTS;\\n }\\n\\n function computeClaim(\\n OutputValidityProof calldata v,\\n bytes32 outputHash\\n ) internal pure returns (bytes32) {\\n return\\n v.outputHashesSiblings.merkleRootAfterReplacement(\\n v.outputIndex,\\n outputHash\\n );\\n }\\n}\\n\",\"keccak256\":\"0x1d56c141256772d513d7b99b8c62e1e04288a0bc7ac9f63bf2d69d8b6f24d56d\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061160a806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80630e1a07f5146100465780633648bfb514610075578063bd4f121914610088575b600080fd5b6100596100543660046102df565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b610059610083366004610325565b610148565b6100596100963660046102df565b6101ef565b600080828686866040516100ae906102ba565b6001600160a01b03938416815292909116602083015260408201526060018190604051809103906000f59050801580156100ec573d6000803e3d6000fd5b50604080516001600160a01b03888116825260208201889052838116828401529151929350908816917fe73165c2d277daf8713fd08b40845cb6bb7a20b2b543f3d35324a475660fcebd9181900360600190a295945050505050565b60008084848460405161015a906102ba565b6001600160a01b0393841681529290911660208301526040820152606001604051809103906000f080158015610194573d6000803e3d6000fd5b50604080516001600160a01b03878116825260208201879052838116828401529151929350908716917fe73165c2d277daf8713fd08b40845cb6bb7a20b2b543f3d35324a475660fcebd9181900360600190a2949350505050565b60006102738260405180602001610205906102ba565b601f1982820381018352601f9091011660408181526001600160a01b038a811660208401528916908201526060810187905260800160408051601f19818403018152908290526102589291602001610396565b6040516020818303038152906040528051906020012061027c565b95945050505050565b6000610289838330610290565b9392505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b611221806103b483390190565b6001600160a01b03811681146102dc57600080fd5b50565b600080600080608085870312156102f557600080fd5b8435610300816102c7565b93506020850135610310816102c7565b93969395505050506040820135916060013590565b60008060006060848603121561033a57600080fd5b8335610345816102c7565b92506020840135610355816102c7565b929592945050506040919091013590565b6000815160005b81811015610387576020818501810151868301520161036d565b50600093019283525090919050565b60006103ab6103a58386610366565b84610366565b94935050505056fe60a060405234801561001057600080fd5b5060405161122138038061122183398101604081905261002f916100fd565b816001600160a01b03811661005e57604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b61006781610095565b506001805560805250600380546001600160a01b0319166001600160a01b0392909216919091179055610140565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146100fa57600080fd5b50565b60008060006060848603121561011257600080fd5b835161011d816100e5565b602085015190935061012e816100e5565b80925050604084015190509250925092565b6080516110c661015b60003960006101ec01526110c66000f3fe6080604052600436106100e15760003560e01c806371891db01161007f578063e88d39c011610059578063e88d39c014610294578063f23a6e61146102b4578063f2fde38b146102e0578063fc4116831461030057600080fd5b806371891db01461022a5780638da5cb5b1461024a578063bc197c811461026857600080fd5b8063179e740b116100bb578063179e740b1461018857806333137b76146101ba57806361b12c66146101da578063715018a61461021557600080fd5b806301ffc9a7146100ed57806308eb89ab14610122578063150b7a021461014457600080fd5b366100e857005b600080fd5b3480156100f957600080fd5b5061010d610108366004610a28565b610320565b60405190151581526020015b60405180910390f35b34801561012e57600080fd5b5061014261013d366004610a6a565b610357565b005b34801561015057600080fd5b5061016f61015f366004610b7a565b630a85bd0160e11b949350505050565b6040516001600160e01b03199091168152602001610119565b34801561019457600080fd5b506003546001600160a01b03165b6040516001600160a01b039091168152602001610119565b3480156101c657600080fd5b506101426101d5366004610be5565b6103be565b3480156101e657600080fd5b506040517f00000000000000000000000000000000000000000000000000000000000000008152602001610119565b34801561022157600080fd5b5061014261059b565b34801561023657600080fd5b5061010d610245366004610c78565b6105a5565b34801561025657600080fd5b506000546001600160a01b03166101a2565b34801561027457600080fd5b5061016f610283366004610d10565b63bc197c8160e01b95945050505050565b3480156102a057600080fd5b506101426102af366004610be5565b6105c8565b3480156102c057600080fd5b5061016f6102cf366004610dbd565b63f23a6e6160e01b95945050505050565b3480156102ec57600080fd5b506101426102fb366004610e25565b6105e9565b34801561030c57600080fd5b5061014261031b366004610e25565b6105f5565b60006001600160e01b03198216630271189760e51b148061035157506301ffc9a760e01b6001600160e01b03198316145b92915050565b61036081610651565b61037d57604051635d2c5e9b60e11b815260040160405180910390fd5b6000610389828461066c565b9050610394816106a5565b6103b95760405163506b919d60e11b8152600481018290526024015b60405180910390fd5b505050565b6103c6610719565b6103d18383836105c8565b60006103e06020830183610e42565b90506004831015610408578383604051636942600f60e11b81526004016103b0929190610e94565b60006104176004828688610eb0565b61042091610eda565b9050366000610432866004818a610eb0565b909250905063dc857e9160e01b6001600160e01b03198416016104a55766ffffffffffffff600885901c16600090815260026020526040902054600160ff86161b1615610496578686604051637b97a6bb60e01b81526004016103b0929190610e94565b6104a08282610743565b61052b565b63efcde17560e01b6001600160e01b031984160161050e5766ffffffffffffff600885901c16600090815260026020526040902054600160ff86161b1615610504578686604051637b97a6bb60e01b81526004016103b0929190610e94565b6104a08282610776565b8686604051636942600f60e11b81526004016103b0929190610e94565b66ffffffffffffff600885901c1660009081526002602052604090208054600160ff87161b1790557fcad1f361c6e84664e892230291c8e8eb9555683e0a6a5ce8ea7b204ac0ac367684888860405161058693929190610f0a565b60405180910390a1505050506103b960018055565b6105a36107a4565b565b600881901c600090815260026020526040812054600160ff84161b161515610351565b6103b983836040516105db929190610f36565b604051809103902082610357565b6105f2816107b6565b50565b6105fd6107f1565b600380546001600160a01b0319166001600160a01b0383169081179091556040519081527f4991c6f37185659e276ff918a96f3e20e6c5abcd8c9aab450dc19c2f7ad35cb59060200160405180910390a150565b6000603f6106626020840184610f46565b9050149050919050565b600061069e61067e6020850185610e42565b6001600160401b0316836106956020870187610f46565b9092909161081e565b9392505050565b600354604051639618f35b60e01b8152306004820152602481018390526000916001600160a01b031690639618f35b90604401602060405180830381865afa1580156106f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103519190610f96565b60026001540361073c57604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b600080606061075484860186610fb8565b9194509250905061076f6001600160a01b03841683836108df565b5050505050565b6000606061078683850185611006565b909250905061079e6001600160a01b03831682610952565b50505050565b6107ac6107f1565b6105a360006109c2565b6107be6107f1565b6001600160a01b0381166107e857604051631e4fbdf760e01b8152600060048201526024016103b0565b6105f2816109c2565b6000546001600160a01b031633146105a35760405163118cdaa760e01b81523360048201526024016103b0565b600083815b8181101561088657600087878381811061083f5761083f61104b565b905060200201359050856001166000036108685760008581526020829052604090209450610879565b600081815260208690526040902094505b50600194851c9401610823565b5083156108d55760405162461bcd60e51b815260206004820181905260248201527f4c69624d65726b6c6533323a20696e646578206f7574206f6620626f756e647360448201526064016103b0565b5090949350505050565b60006060846001600160a01b031684846040516108fc9190611061565b60006040518083038185875af1925050503d8060008114610939576040519150601f19603f3d011682016040523d82523d6000602084013e61093e565b606091505b5090925090508161076f5761076f81610a12565b60006060836001600160a01b03168360405161096e9190611061565b600060405180830381855af49150503d80600081146109a9576040519150601f19603f3d011682016040523d82523d6000602084013e6109ae565b606091505b5090925090508161079e5761079e81610a12565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b8051600003610a2057600080fd5b805181602001fd5b600060208284031215610a3a57600080fd5b81356001600160e01b03198116811461069e57600080fd5b600060408284031215610a6457600080fd5b50919050565b60008060408385031215610a7d57600080fd5b8235915060208301356001600160401b03811115610a9a57600080fd5b610aa685828601610a52565b9150509250929050565b6001600160a01b03811681146105f257600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715610b0357610b03610ac5565b604052919050565b600082601f830112610b1c57600080fd5b81356001600160401b03811115610b3557610b35610ac5565b610b48601f8201601f1916602001610adb565b818152846020838601011115610b5d57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215610b9057600080fd5b8435610b9b81610ab0565b93506020850135610bab81610ab0565b92506040850135915060608501356001600160401b03811115610bcd57600080fd5b610bd987828801610b0b565b91505092959194509250565b600080600060408486031215610bfa57600080fd5b83356001600160401b0380821115610c1157600080fd5b818601915086601f830112610c2557600080fd5b813581811115610c3457600080fd5b876020828501011115610c4657600080fd5b602092830195509350908501359080821115610c6157600080fd5b50610c6e86828701610a52565b9150509250925092565b600060208284031215610c8a57600080fd5b5035919050565b600082601f830112610ca257600080fd5b813560206001600160401b03821115610cbd57610cbd610ac5565b8160051b610ccc828201610adb565b9283528481018201928281019087851115610ce657600080fd5b83870192505b84831015610d0557823582529183019190830190610cec565b979650505050505050565b600080600080600060a08688031215610d2857600080fd5b8535610d3381610ab0565b94506020860135610d4381610ab0565b935060408601356001600160401b0380821115610d5f57600080fd5b610d6b89838a01610c91565b94506060880135915080821115610d8157600080fd5b610d8d89838a01610c91565b93506080880135915080821115610da357600080fd5b50610db088828901610b0b565b9150509295509295909350565b600080600080600060a08688031215610dd557600080fd5b8535610de081610ab0565b94506020860135610df081610ab0565b9350604086013592506060860135915060808601356001600160401b03811115610e1957600080fd5b610db088828901610b0b565b600060208284031215610e3757600080fd5b813561069e81610ab0565b600060208284031215610e5457600080fd5b81356001600160401b038116811461069e57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b602081526000610ea8602083018486610e6b565b949350505050565b60008085851115610ec057600080fd5b83861115610ecd57600080fd5b5050820193919092039150565b6001600160e01b03198135818116916004851015610f025780818660040360031b1b83161692505b505092915050565b6001600160401b0384168152604060208201526000610f2d604083018486610e6b565b95945050505050565b8183823760009101908152919050565b6000808335601e19843603018112610f5d57600080fd5b8301803591506001600160401b03821115610f7757600080fd5b6020019150600581901b3603821315610f8f57600080fd5b9250929050565b600060208284031215610fa857600080fd5b8151801515811461069e57600080fd5b600080600060608486031215610fcd57600080fd5b8335610fd881610ab0565b92506020840135915060408401356001600160401b03811115610ffa57600080fd5b610c6e86828701610b0b565b6000806040838503121561101957600080fd5b823561102481610ab0565b915060208301356001600160401b0381111561103f57600080fd5b610aa685828601610b0b565b634e487b7160e01b600052603260045260246000fd5b6000825160005b818110156110825760208186018101518583015201611068565b50600092019182525091905056fea26469706673582212203f315ffa1b40cea7dff22d84a4da91a7608e3e91ce7edcfdf33bec1516bcd4a264736f6c63430008170033a26469706673582212208c4a52f54de2f4ddae6d92bbdbe5a6efa1298a6912df6cab98cca337ff99a72264736f6c63430008170033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80630e1a07f5146100465780633648bfb514610075578063bd4f121914610088575b600080fd5b6100596100543660046102df565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b610059610083366004610325565b610148565b6100596100963660046102df565b6101ef565b600080828686866040516100ae906102ba565b6001600160a01b03938416815292909116602083015260408201526060018190604051809103906000f59050801580156100ec573d6000803e3d6000fd5b50604080516001600160a01b03888116825260208201889052838116828401529151929350908816917fe73165c2d277daf8713fd08b40845cb6bb7a20b2b543f3d35324a475660fcebd9181900360600190a295945050505050565b60008084848460405161015a906102ba565b6001600160a01b0393841681529290911660208301526040820152606001604051809103906000f080158015610194573d6000803e3d6000fd5b50604080516001600160a01b03878116825260208201879052838116828401529151929350908716917fe73165c2d277daf8713fd08b40845cb6bb7a20b2b543f3d35324a475660fcebd9181900360600190a2949350505050565b60006102738260405180602001610205906102ba565b601f1982820381018352601f9091011660408181526001600160a01b038a811660208401528916908201526060810187905260800160408051601f19818403018152908290526102589291602001610396565b6040516020818303038152906040528051906020012061027c565b95945050505050565b6000610289838330610290565b9392505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b611221806103b483390190565b6001600160a01b03811681146102dc57600080fd5b50565b600080600080608085870312156102f557600080fd5b8435610300816102c7565b93506020850135610310816102c7565b93969395505050506040820135916060013590565b60008060006060848603121561033a57600080fd5b8335610345816102c7565b92506020840135610355816102c7565b929592945050506040919091013590565b6000815160005b81811015610387576020818501810151868301520161036d565b50600093019283525090919050565b60006103ab6103a58386610366565b84610366565b94935050505056fe60a060405234801561001057600080fd5b5060405161122138038061122183398101604081905261002f916100fd565b816001600160a01b03811661005e57604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b61006781610095565b506001805560805250600380546001600160a01b0319166001600160a01b0392909216919091179055610140565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146100fa57600080fd5b50565b60008060006060848603121561011257600080fd5b835161011d816100e5565b602085015190935061012e816100e5565b80925050604084015190509250925092565b6080516110c661015b60003960006101ec01526110c66000f3fe6080604052600436106100e15760003560e01c806371891db01161007f578063e88d39c011610059578063e88d39c014610294578063f23a6e61146102b4578063f2fde38b146102e0578063fc4116831461030057600080fd5b806371891db01461022a5780638da5cb5b1461024a578063bc197c811461026857600080fd5b8063179e740b116100bb578063179e740b1461018857806333137b76146101ba57806361b12c66146101da578063715018a61461021557600080fd5b806301ffc9a7146100ed57806308eb89ab14610122578063150b7a021461014457600080fd5b366100e857005b600080fd5b3480156100f957600080fd5b5061010d610108366004610a28565b610320565b60405190151581526020015b60405180910390f35b34801561012e57600080fd5b5061014261013d366004610a6a565b610357565b005b34801561015057600080fd5b5061016f61015f366004610b7a565b630a85bd0160e11b949350505050565b6040516001600160e01b03199091168152602001610119565b34801561019457600080fd5b506003546001600160a01b03165b6040516001600160a01b039091168152602001610119565b3480156101c657600080fd5b506101426101d5366004610be5565b6103be565b3480156101e657600080fd5b506040517f00000000000000000000000000000000000000000000000000000000000000008152602001610119565b34801561022157600080fd5b5061014261059b565b34801561023657600080fd5b5061010d610245366004610c78565b6105a5565b34801561025657600080fd5b506000546001600160a01b03166101a2565b34801561027457600080fd5b5061016f610283366004610d10565b63bc197c8160e01b95945050505050565b3480156102a057600080fd5b506101426102af366004610be5565b6105c8565b3480156102c057600080fd5b5061016f6102cf366004610dbd565b63f23a6e6160e01b95945050505050565b3480156102ec57600080fd5b506101426102fb366004610e25565b6105e9565b34801561030c57600080fd5b5061014261031b366004610e25565b6105f5565b60006001600160e01b03198216630271189760e51b148061035157506301ffc9a760e01b6001600160e01b03198316145b92915050565b61036081610651565b61037d57604051635d2c5e9b60e11b815260040160405180910390fd5b6000610389828461066c565b9050610394816106a5565b6103b95760405163506b919d60e11b8152600481018290526024015b60405180910390fd5b505050565b6103c6610719565b6103d18383836105c8565b60006103e06020830183610e42565b90506004831015610408578383604051636942600f60e11b81526004016103b0929190610e94565b60006104176004828688610eb0565b61042091610eda565b9050366000610432866004818a610eb0565b909250905063dc857e9160e01b6001600160e01b03198416016104a55766ffffffffffffff600885901c16600090815260026020526040902054600160ff86161b1615610496578686604051637b97a6bb60e01b81526004016103b0929190610e94565b6104a08282610743565b61052b565b63efcde17560e01b6001600160e01b031984160161050e5766ffffffffffffff600885901c16600090815260026020526040902054600160ff86161b1615610504578686604051637b97a6bb60e01b81526004016103b0929190610e94565b6104a08282610776565b8686604051636942600f60e11b81526004016103b0929190610e94565b66ffffffffffffff600885901c1660009081526002602052604090208054600160ff87161b1790557fcad1f361c6e84664e892230291c8e8eb9555683e0a6a5ce8ea7b204ac0ac367684888860405161058693929190610f0a565b60405180910390a1505050506103b960018055565b6105a36107a4565b565b600881901c600090815260026020526040812054600160ff84161b161515610351565b6103b983836040516105db929190610f36565b604051809103902082610357565b6105f2816107b6565b50565b6105fd6107f1565b600380546001600160a01b0319166001600160a01b0383169081179091556040519081527f4991c6f37185659e276ff918a96f3e20e6c5abcd8c9aab450dc19c2f7ad35cb59060200160405180910390a150565b6000603f6106626020840184610f46565b9050149050919050565b600061069e61067e6020850185610e42565b6001600160401b0316836106956020870187610f46565b9092909161081e565b9392505050565b600354604051639618f35b60e01b8152306004820152602481018390526000916001600160a01b031690639618f35b90604401602060405180830381865afa1580156106f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103519190610f96565b60026001540361073c57604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b600080606061075484860186610fb8565b9194509250905061076f6001600160a01b03841683836108df565b5050505050565b6000606061078683850185611006565b909250905061079e6001600160a01b03831682610952565b50505050565b6107ac6107f1565b6105a360006109c2565b6107be6107f1565b6001600160a01b0381166107e857604051631e4fbdf760e01b8152600060048201526024016103b0565b6105f2816109c2565b6000546001600160a01b031633146105a35760405163118cdaa760e01b81523360048201526024016103b0565b600083815b8181101561088657600087878381811061083f5761083f61104b565b905060200201359050856001166000036108685760008581526020829052604090209450610879565b600081815260208690526040902094505b50600194851c9401610823565b5083156108d55760405162461bcd60e51b815260206004820181905260248201527f4c69624d65726b6c6533323a20696e646578206f7574206f6620626f756e647360448201526064016103b0565b5090949350505050565b60006060846001600160a01b031684846040516108fc9190611061565b60006040518083038185875af1925050503d8060008114610939576040519150601f19603f3d011682016040523d82523d6000602084013e61093e565b606091505b5090925090508161076f5761076f81610a12565b60006060836001600160a01b03168360405161096e9190611061565b600060405180830381855af49150503d80600081146109a9576040519150601f19603f3d011682016040523d82523d6000602084013e6109ae565b606091505b5090925090508161079e5761079e81610a12565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b8051600003610a2057600080fd5b805181602001fd5b600060208284031215610a3a57600080fd5b81356001600160e01b03198116811461069e57600080fd5b600060408284031215610a6457600080fd5b50919050565b60008060408385031215610a7d57600080fd5b8235915060208301356001600160401b03811115610a9a57600080fd5b610aa685828601610a52565b9150509250929050565b6001600160a01b03811681146105f257600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715610b0357610b03610ac5565b604052919050565b600082601f830112610b1c57600080fd5b81356001600160401b03811115610b3557610b35610ac5565b610b48601f8201601f1916602001610adb565b818152846020838601011115610b5d57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215610b9057600080fd5b8435610b9b81610ab0565b93506020850135610bab81610ab0565b92506040850135915060608501356001600160401b03811115610bcd57600080fd5b610bd987828801610b0b565b91505092959194509250565b600080600060408486031215610bfa57600080fd5b83356001600160401b0380821115610c1157600080fd5b818601915086601f830112610c2557600080fd5b813581811115610c3457600080fd5b876020828501011115610c4657600080fd5b602092830195509350908501359080821115610c6157600080fd5b50610c6e86828701610a52565b9150509250925092565b600060208284031215610c8a57600080fd5b5035919050565b600082601f830112610ca257600080fd5b813560206001600160401b03821115610cbd57610cbd610ac5565b8160051b610ccc828201610adb565b9283528481018201928281019087851115610ce657600080fd5b83870192505b84831015610d0557823582529183019190830190610cec565b979650505050505050565b600080600080600060a08688031215610d2857600080fd5b8535610d3381610ab0565b94506020860135610d4381610ab0565b935060408601356001600160401b0380821115610d5f57600080fd5b610d6b89838a01610c91565b94506060880135915080821115610d8157600080fd5b610d8d89838a01610c91565b93506080880135915080821115610da357600080fd5b50610db088828901610b0b565b9150509295509295909350565b600080600080600060a08688031215610dd557600080fd5b8535610de081610ab0565b94506020860135610df081610ab0565b9350604086013592506060860135915060808601356001600160401b03811115610e1957600080fd5b610db088828901610b0b565b600060208284031215610e3757600080fd5b813561069e81610ab0565b600060208284031215610e5457600080fd5b81356001600160401b038116811461069e57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b602081526000610ea8602083018486610e6b565b949350505050565b60008085851115610ec057600080fd5b83861115610ecd57600080fd5b5050820193919092039150565b6001600160e01b03198135818116916004851015610f025780818660040360031b1b83161692505b505092915050565b6001600160401b0384168152604060208201526000610f2d604083018486610e6b565b95945050505050565b8183823760009101908152919050565b6000808335601e19843603018112610f5d57600080fd5b8301803591506001600160401b03821115610f7757600080fd5b6020019150600581901b3603821315610f8f57600080fd5b9250929050565b600060208284031215610fa857600080fd5b8151801515811461069e57600080fd5b600080600060608486031215610fcd57600080fd5b8335610fd881610ab0565b92506020840135915060408401356001600160401b03811115610ffa57600080fd5b610c6e86828701610b0b565b6000806040838503121561101957600080fd5b823561102481610ab0565b915060208301356001600160401b0381111561103f57600080fd5b610aa685828601610b0b565b634e487b7160e01b600052603260045260246000fd5b6000825160005b818110156110825760208186018101518583015201611068565b50600092019182525091905056fea26469706673582212203f315ffa1b40cea7dff22d84a4da91a7608e3e91ce7edcfdf33bec1516bcd4a264736f6c63430008170033a26469706673582212208c4a52f54de2f4ddae6d92bbdbe5a6efa1298a6912df6cab98cca337ff99a72264736f6c63430008170033", "devdoc": { "events": { - "ApplicationCreated(address,address,address[],address,bytes32,address)": { + "ApplicationCreated(address,address,bytes32,address)": { "details": "MUST be triggered on a successful call to `newApplication`.", "params": { "appContract": "The application contract", "appOwner": "The initial application owner", "consensus": "The initial consensus contract", - "inputBox": "The input box contract", - "portals": "The portals supported by the application", "templateHash": "The initial machine state hash" } } }, "kind": "dev", "methods": { - "calculateApplicationAddress(address,address,address[],address,bytes32,bytes32)": { + "calculateApplicationAddress(address,address,bytes32,bytes32)": { "details": "Beware that only the `newApplication` function with the `salt` parameter is able to deterministically deploy an application.", "params": { "appOwner": "The initial application owner", "consensus": "The initial consensus contract", - "inputBox": "The input box contract", - "portals": "The portals supported by the application", "salt": "The salt used to deterministically generate the application contract address", "templateHash": "The initial machine state hash" }, @@ -224,26 +178,22 @@ "_0": "The deterministic application contract address" } }, - "newApplication(address,address,address[],address,bytes32)": { - "details": "On success, MUST emit an `ApplicationCreated` event.", + "newApplication(address,address,bytes32)": { + "details": "On success, MUST emit an `ApplicationCreated` event.Reverts if the application owner address is zero.", "params": { "appOwner": "The initial application owner", "consensus": "The initial consensus contract", - "inputBox": "The input box contract", - "portals": "The portals supported by the application", "templateHash": "The initial machine state hash" }, "returns": { "_0": "The application" } }, - "newApplication(address,address,address[],address,bytes32,bytes32)": { - "details": "On success, MUST emit an `ApplicationCreated` event.", + "newApplication(address,address,bytes32,bytes32)": { + "details": "On success, MUST emit an `ApplicationCreated` event.Reverts if the application owner address is zero.", "params": { "appOwner": "The initial application owner", "consensus": "The initial consensus contract", - "inputBox": "The input box contract", - "portals": "The portals supported by the application", "salt": "The salt used to deterministically generate the application contract address", "templateHash": "The initial machine state hash" }, @@ -257,23 +207,23 @@ }, "userdoc": { "events": { - "ApplicationCreated(address,address,address[],address,bytes32,address)": { + "ApplicationCreated(address,address,bytes32,address)": { "notice": "A new application was deployed." } }, "kind": "user", "methods": { - "calculateApplicationAddress(address,address,address[],address,bytes32,bytes32)": { + "calculateApplicationAddress(address,address,bytes32,bytes32)": { "notice": "Calculate the address of an application contract to be deployed deterministically." }, - "newApplication(address,address,address[],address,bytes32)": { + "newApplication(address,address,bytes32)": { "notice": "Deploy a new application." }, - "newApplication(address,address,address[],address,bytes32,bytes32)": { + "newApplication(address,address,bytes32,bytes32)": { "notice": "Deploy a new application deterministically." } }, - "notice": "Allows anyone to reliably deploy a new `Application` contract.", + "notice": "Allows anyone to reliably deploy a new `IApplication` contract.", "version": 1 }, "storageLayout": { diff --git a/deployments/sepolia/AuthorityFactory.json b/deployments/sepolia/AuthorityFactory.json index a2370e4a..2f4fa701 100644 --- a/deployments/sepolia/AuthorityFactory.json +++ b/deployments/sepolia/AuthorityFactory.json @@ -1,18 +1,12 @@ { - "address": "0xFc6c1Fc6546898eb2f9cb7De360B3eA52E601D46", + "address": "0xB897F7Fe78f220aE34B7FA9493092701a873Ed45", "abi": [ { "anonymous": false, "inputs": [ { "indexed": false, - "internalType": "address", - "name": "authorityOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract Authority", + "internalType": "contract IAuthority", "name": "authority", "type": "address" } @@ -27,6 +21,11 @@ "name": "authorityOwner", "type": "address" }, + { + "internalType": "uint256", + "name": "epochLength", + "type": "uint256" + }, { "internalType": "bytes32", "name": "salt", @@ -52,15 +51,15 @@ "type": "address" }, { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" + "internalType": "uint256", + "name": "epochLength", + "type": "uint256" } ], "name": "newAuthority", "outputs": [ { - "internalType": "contract Authority", + "internalType": "contract IAuthority", "name": "", "type": "address" } @@ -74,12 +73,22 @@ "internalType": "address", "name": "authorityOwner", "type": "address" + }, + { + "internalType": "uint256", + "name": "epochLength", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" } ], "name": "newAuthority", "outputs": [ { - "internalType": "contract Authority", + "internalType": "contract IAuthority", "name": "", "type": "address" } @@ -88,63 +97,65 @@ "type": "function" } ], - "transactionHash": "0x9e3f3887ce26b197fc0c8898030bbcb45d1025d1a87f85b1774a85d27066f48a", + "transactionHash": "0x93b0ce5a1b8b6cb69ceded19ccf667a1230a51925a00809c3202d387b1c2865f", "receipt": { "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0xB25D9D56f5877Ca869A0362c324aCC2F1465AF1B", + "from": "0xeA4037a524309056545fbAd9A688f449E7e05ffB", "contractAddress": null, - "transactionIndex": 108, - "gasUsed": "548098", + "transactionIndex": 41, + "gasUsed": "532228", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x21f4e7ebee663c85ee9b1080508419e95c6b630172dc36674f513dd50e7adf6c", - "transactionHash": "0x9e3f3887ce26b197fc0c8898030bbcb45d1025d1a87f85b1774a85d27066f48a", + "blockHash": "0xb527b55072b0e52ca8325eee566afd4d3343e327285a22036713dd62ed75ebce", + "transactionHash": "0x93b0ce5a1b8b6cb69ceded19ccf667a1230a51925a00809c3202d387b1c2865f", "logs": [], - "blockNumber": 6099740, - "cumulativeGasUsed": "10193390", + "blockNumber": 6850941, + "cumulativeGasUsed": "4528239", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 2, - "solcInputHash": "d5e580c56a1973c1da5089d8c687e7bd", - "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"authorityOwner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract Authority\",\"name\":\"authority\",\"type\":\"address\"}],\"name\":\"AuthorityCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"authorityOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"}],\"name\":\"calculateAuthorityAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"authorityOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"}],\"name\":\"newAuthority\",\"outputs\":[{\"internalType\":\"contract Authority\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"authorityOwner\",\"type\":\"address\"}],\"name\":\"newAuthority\",\"outputs\":[{\"internalType\":\"contract Authority\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"AuthorityCreated(address,address)\":{\"details\":\"MUST be triggered on a successful call to `newAuthority`.\",\"params\":{\"authority\":\"The authority\",\"authorityOwner\":\"The initial authority owner\"}}},\"kind\":\"dev\",\"methods\":{\"calculateAuthorityAddress(address,bytes32)\":{\"details\":\"Beware that only the `newAuthority` function with the `salt` parameter is able to deterministically deploy an authority.\",\"params\":{\"authorityOwner\":\"The initial authority owner\",\"salt\":\"The salt used to deterministically generate the authority address\"},\"returns\":{\"_0\":\"The deterministic authority address\"}},\"newAuthority(address)\":{\"details\":\"On success, MUST emit an `AuthorityCreated` event.\",\"params\":{\"authorityOwner\":\"The initial authority owner\"},\"returns\":{\"_0\":\"The authority\"}},\"newAuthority(address,bytes32)\":{\"details\":\"On success, MUST emit an `AuthorityCreated` event.\",\"params\":{\"authorityOwner\":\"The initial authority owner\",\"salt\":\"The salt used to deterministically generate the authority address\"},\"returns\":{\"_0\":\"The authority\"}}},\"title\":\"Authority Factory\",\"version\":1},\"userdoc\":{\"events\":{\"AuthorityCreated(address,address)\":{\"notice\":\"A new authority was deployed.\"}},\"kind\":\"user\",\"methods\":{\"calculateAuthorityAddress(address,bytes32)\":{\"notice\":\"Calculate the address of an authority to be deployed deterministically.\"},\"newAuthority(address)\":{\"notice\":\"Deploy a new authority.\"},\"newAuthority(address,bytes32)\":{\"notice\":\"Deploy a new authority deterministically.\"}},\"notice\":\"Allows anyone to reliably deploy a new `Authority` contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/consensus/authority/AuthorityFactory.sol\":\"AuthorityFactory\"},\"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 v5.0.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {Context} from \\\"../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 * The initial owner is set to the address provided by the deployer. This can\\n * 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 /**\\n * @dev The caller account is not authorized to perform an operation.\\n */\\n error OwnableUnauthorizedAccount(address account);\\n\\n /**\\n * @dev The owner is not a valid owner account. (eg. `address(0)`)\\n */\\n error OwnableInvalidOwner(address owner);\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\\n */\\n constructor(address initialOwner) {\\n if (initialOwner == address(0)) {\\n revert OwnableInvalidOwner(address(0));\\n }\\n _transferOwnership(initialOwner);\\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 if (owner() != _msgSender()) {\\n revert OwnableUnauthorizedAccount(_msgSender());\\n }\\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 if (newOwner == address(0)) {\\n revert OwnableInvalidOwner(address(0));\\n }\\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\":\"0xff6d0bb2e285473e5311d9d3caacb525ae3538a80758c10649a4d61029b017bb\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\\n\\npragma solidity ^0.8.20;\\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 function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Not enough balance for performing a CREATE2 deploy.\\n */\\n error Create2InsufficientBalance(uint256 balance, uint256 needed);\\n\\n /**\\n * @dev There's no code to deploy.\\n */\\n error Create2EmptyBytecode();\\n\\n /**\\n * @dev The deployment failed.\\n */\\n error Create2FailedDeployment();\\n\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\\n if (address(this).balance < amount) {\\n revert Create2InsufficientBalance(address(this).balance, amount);\\n }\\n if (bytecode.length == 0) {\\n revert Create2EmptyBytecode();\\n }\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n if (addr == address(0)) {\\n revert Create2FailedDeployment();\\n }\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2b9807d194b92f1068d868e9587d27037264a9a067c778486f86ae21c61cbd5e\",\"license\":\"MIT\"},\"contracts/common/InputRange.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/// @notice A range of input indices.\\n/// @param firstIndex The index of the first input\\n/// @param lastIndex The index of the last input\\nstruct InputRange {\\n uint64 firstIndex;\\n uint64 lastIndex;\\n}\\n\",\"keccak256\":\"0x4825516380f1fb39d5b15e99c1b08e07c636dc062ad3036093e78ba8e624cd33\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"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\\\";\\nimport {InputRange} from \\\"../common/InputRange.sol\\\";\\n\\n/// @notice Stores epoch hashes for several applications and input ranges.\\n/// @dev This contract was designed to be inherited by implementations of the `IConsensus` interface\\n/// that only need a simple mechanism of storage and retrieval of epoch hashes.\\nabstract contract AbstractConsensus is IConsensus {\\n /// @notice Indexes epoch hashes by application contract address, first input index and last input index.\\n mapping(address => mapping(uint256 => mapping(uint256 => bytes32)))\\n private _epochHashes;\\n\\n /// @notice Get the epoch hash for a certain application and input range.\\n /// @param appContract The application contract address\\n /// @param r The input range\\n /// @return epochHash The epoch hash\\n /// @dev For claimed epochs, returns the epoch hash of the last accepted claim.\\n /// @dev For unclaimed epochs, returns `bytes32(0)`.\\n function getEpochHash(\\n address appContract,\\n InputRange calldata r\\n ) public view override returns (bytes32 epochHash) {\\n epochHash = _epochHashes[appContract][r.firstIndex][r.lastIndex];\\n }\\n\\n /// @notice Accept a claim.\\n /// @param appContract The application contract address\\n /// @param r The input range\\n /// @param epochHash The epoch hash\\n /// @dev On successs, emits a `ClaimAcceptance` event.\\n function _acceptClaim(\\n address appContract,\\n InputRange calldata r,\\n bytes32 epochHash\\n ) internal {\\n _epochHashes[appContract][r.firstIndex][r.lastIndex] = epochHash;\\n emit ClaimAcceptance(appContract, r, epochHash);\\n }\\n}\\n\",\"keccak256\":\"0x2e41db152b70de9fe9917780efeba10ea3c0e1a1a2c96b158d81b1129a877eb5\",\"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\\nimport {InputRange} from \\\"../common/InputRange.sol\\\";\\n\\n/// @notice Provides data availability of epoch hashes for applications.\\n/// @notice An epoch hash is produced after the machine processes a range of inputs and the epoch is finalized.\\n/// This hash can be later used to prove that any given output was produced by the machine during the epoch.\\n/// @notice After an epoch is finalized, a validator may submit a claim containing the application contract address,\\n/// the range of inputs accepted during the epoch, and the epoch hash.\\n/// @notice Validators may synchronize epoch finalization, but such mechanism is not specified by this interface.\\n/// @notice A validator should be able to save transaction fees by not submitting a claim if it was...\\n/// - already submitted by the validator (see the `ClaimSubmission` event) or;\\n/// - already accepted by the consensus (see the `ClaimAcceptance` event).\\n/// @notice The acceptance criteria for claims may depend on the type of consensus, and is not specified by this interface.\\n/// For example, a claim may be accepted if it was...\\n/// - submitted by an authority or;\\n/// - submitted by the majority of a quorum or;\\n/// - submitted and not proven wrong after some period of time.\\ninterface IConsensus {\\n /// @notice MUST trigger when a claim is submitted.\\n /// @param submitter The submitter address\\n /// @param appContract The application contract address\\n /// @param inputRange The input range\\n /// @param epochHash The epoch hash\\n /// @dev Overwrites any previous submissions regarding `submitter`, `appContract` and `inputRange`.\\n event ClaimSubmission(\\n address indexed submitter,\\n address indexed appContract,\\n InputRange inputRange,\\n bytes32 epochHash\\n );\\n\\n /// @notice MUST trigger when a claim is accepted.\\n /// @param appContract The application contract address\\n /// @param inputRange The input range\\n /// @param epochHash The epoch hash\\n /// @dev MUST be triggered after some `ClaimSubmission` event regarding `appContract`, `inputRange` and `epochHash`.\\n /// @dev Overwrites any previous acceptances regarding `appContract` and `inputRange`.\\n event ClaimAcceptance(\\n address indexed appContract,\\n InputRange inputRange,\\n bytes32 epochHash\\n );\\n\\n /// @notice Submit a claim to the consensus.\\n /// @param appContract The application contract address\\n /// @param inputRange The input range\\n /// @param epochHash The epoch hash\\n /// @dev MUST fire a `ClaimSubmission` event.\\n /// @dev MAY fire a `ClaimAcceptance` event, if the acceptance criteria is met.\\n function submitClaim(\\n address appContract,\\n InputRange calldata inputRange,\\n bytes32 epochHash\\n ) external;\\n\\n /// @notice Get the epoch hash for a certain application and input range.\\n /// @param appContract The application contract address\\n /// @param inputRange The input range\\n /// @return epochHash The epoch hash\\n /// @dev For claimed epochs, must return the epoch hash of the last accepted claim.\\n /// @dev For unclaimed epochs, MUST either revert or return `bytes32(0)`.\\n function getEpochHash(\\n address appContract,\\n InputRange calldata inputRange\\n ) external view returns (bytes32 epochHash);\\n}\\n\",\"keccak256\":\"0xd2ea451e450f6b3b01bd77b95dbb00465d263cae9285a03c8ffd0d96c4d75dc1\",\"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\\\";\\n\\nimport {IConsensus} from \\\"../IConsensus.sol\\\";\\nimport {AbstractConsensus} from \\\"../AbstractConsensus.sol\\\";\\nimport {InputRange} from \\\"../../common/InputRange.sol\\\";\\n\\n/// @notice A consensus contract controlled by a single address, the owner.\\n/// @dev This contract inherits from OpenZeppelin's `Ownable` contract.\\n/// For more information on `Ownable`, please consult OpenZeppelin's official documentation.\\ncontract Authority is AbstractConsensus, Ownable {\\n /// @param initialOwner The initial contract owner\\n constructor(address initialOwner) Ownable(initialOwner) {}\\n\\n /// @notice Submit a claim.\\n /// @param appContract The application contract address\\n /// @param inputRange The input range\\n /// @param epochHash The epoch hash\\n /// @dev Fires a `ClaimSubmission` event and a `ClaimAcceptance` event.\\n /// @dev Can only be called by the owner.\\n function submitClaim(\\n address appContract,\\n InputRange calldata inputRange,\\n bytes32 epochHash\\n ) external override onlyOwner {\\n emit ClaimSubmission(msg.sender, appContract, inputRange, epochHash);\\n _acceptClaim(appContract, inputRange, epochHash);\\n }\\n}\\n\",\"keccak256\":\"0xe74884532170247ebc0abfd564a8415cac18fafe4e2a1c9a851a369dd7ee4539\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/AuthorityFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Create2} from \\\"@openzeppelin/contracts/utils/Create2.sol\\\";\\n\\nimport {IAuthorityFactory} from \\\"./IAuthorityFactory.sol\\\";\\nimport {Authority} from \\\"./Authority.sol\\\";\\n\\n/// @title Authority Factory\\n/// @notice Allows anyone to reliably deploy a new `Authority` contract.\\ncontract AuthorityFactory is IAuthorityFactory {\\n function newAuthority(\\n address authorityOwner\\n ) external override returns (Authority) {\\n Authority authority = new Authority(authorityOwner);\\n\\n emit AuthorityCreated(authorityOwner, authority);\\n\\n return authority;\\n }\\n\\n function newAuthority(\\n address authorityOwner,\\n bytes32 salt\\n ) external override returns (Authority) {\\n Authority authority = new Authority{salt: salt}(authorityOwner);\\n\\n emit AuthorityCreated(authorityOwner, authority);\\n\\n return authority;\\n }\\n\\n function calculateAuthorityAddress(\\n address authorityOwner,\\n bytes32 salt\\n ) external view override returns (address) {\\n return\\n Create2.computeAddress(\\n salt,\\n keccak256(\\n abi.encodePacked(\\n type(Authority).creationCode,\\n abi.encode(authorityOwner)\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x216e02503f325929033ea9e19a8ff42ceaa254aabc81fa3749358b4f492a2f05\",\"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\":\"0xb25511358cbebf34bbd3c6e518d55d0235bff4d25de414d96ce3468c7bf7d05a\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506108f0806100206000396000f3fe608060405234801561001057600080fd5b50600436106100405760003560e01c80629c5784146100455780635a3f27d314610074578063b3a51b8414610087575b600080fd5b610058610053366004610288565b61009a565b6040516001600160a01b03909116815260200160405180910390f35b610058610082366004610288565b610115565b6100586100953660046102b2565b6101a4565b600061010e82604051806020016100b09061025f565b601f1982820381018352601f9091011660408181526001600160a01b03881660208301520160408051601f19818403018152908290526100f392916020016102fd565b6040516020818303038152906040528051906020012061022d565b9392505050565b60008082846040516101269061025f565b6001600160a01b0390911681526020018190604051809103906000f5905080158015610156573d6000803e3d6000fd5b50604080516001600160a01b038088168252831660208201529192507f0fb2d916aa6a78060ff9e89d89d62797c6668818dec04969013c5098754380ec910160405180910390a19392505050565b600080826040516101b49061025f565b6001600160a01b039091168152602001604051809103906000f0801580156101e0573d6000803e3d6000fd5b50604080516001600160a01b038087168252831660208201529192507f0fb2d916aa6a78060ff9e89d89d62797c6668818dec04969013c5098754380ec910160405180910390a192915050565b600061010e8383306000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b6105a08061031b83390190565b80356001600160a01b038116811461028357600080fd5b919050565b6000806040838503121561029b57600080fd5b6102a48361026c565b946020939093013593505050565b6000602082840312156102c457600080fd5b61010e8261026c565b6000815160005b818110156102ee57602081850181015186830152016102d4565b50600093019283525090919050565b600061031261030c83866102cd565b846102cd565b94935050505056fe608060405234801561001057600080fd5b506040516105a03803806105a083398101604081905261002f916100c0565b806001600160a01b03811661005e57604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b6100678161006e565b50506100f0565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000602082840312156100d257600080fd5b81516001600160a01b03811681146100e957600080fd5b9392505050565b6104a1806100ff6000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063715018a61461005c578063866b85fa146100665780638da5cb5b14610079578063c1f59afc14610099578063f2fde38b146100ba575b600080fd5b6100646100cd565b005b61006461007436600461036a565b6100e1565b6001546040516001600160a01b0390911681526020015b60405180910390f35b6100ac6100a73660046103a7565b610146565b604051908152602001610090565b6100646100c83660046103db565b6101bb565b6100d56101fe565b6100df600061022b565b565b6100e96101fe565b826001600160a01b0316336001600160a01b03167f940326476a755934b6ae9d2b36ffcf1f447c3a8223f6d9f8a796b54fbfcce582848460405161012e929190610415565b60405180910390a361014183838361027d565b505050565b6001600160a01b038216600090815260208181526040822090829061016d90850185610450565b67ffffffffffffffff168152602001908152602001600020600083602001602081019061019a9190610450565b67ffffffffffffffff16815260200190815260200160002054905092915050565b6101c36101fe565b6001600160a01b0381166101f257604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b6101fb8161022b565b50565b6001546001600160a01b031633146100df5760405163118cdaa760e01b81523360048201526024016101e9565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0383166000908152602081815260408220839290916102a590860186610450565b67ffffffffffffffff16815260200190815260200160002060008460200160208101906102d29190610450565b67ffffffffffffffff16815260200190815260200160002081905550826001600160a01b03167f4e068a6b8ed35e6ee03244135874f91ccebb5cd1f3a258a6dc2ad0ebd29884768383604051610329929190610415565b60405180910390a2505050565b80356001600160a01b038116811461034d57600080fd5b919050565b60006040828403121561036457600080fd5b50919050565b60008060006080848603121561037f57600080fd5b61038884610336565b92506103978560208601610352565b9150606084013590509250925092565b600080606083850312156103ba57600080fd5b6103c383610336565b91506103d28460208501610352565b90509250929050565b6000602082840312156103ed57600080fd5b6103f682610336565b9392505050565b803567ffffffffffffffff8116811461034d57600080fd5b6060810167ffffffffffffffff8061042c866103fd565b1683528061043c602087016103fd565b166020840152508260408301529392505050565b60006020828403121561046257600080fd5b6103f6826103fd56fea26469706673582212209daab5af7bf31878a001268a1e530a73c9e116addde25fe1ed74dbd37dd6ab6664736f6c63430008170033a2646970667358221220202385c5d3667fd4673b493ed4c06f5c86e9736d67477efdd7fa7a1f5e0e807164736f6c63430008170033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100405760003560e01c80629c5784146100455780635a3f27d314610074578063b3a51b8414610087575b600080fd5b610058610053366004610288565b61009a565b6040516001600160a01b03909116815260200160405180910390f35b610058610082366004610288565b610115565b6100586100953660046102b2565b6101a4565b600061010e82604051806020016100b09061025f565b601f1982820381018352601f9091011660408181526001600160a01b03881660208301520160408051601f19818403018152908290526100f392916020016102fd565b6040516020818303038152906040528051906020012061022d565b9392505050565b60008082846040516101269061025f565b6001600160a01b0390911681526020018190604051809103906000f5905080158015610156573d6000803e3d6000fd5b50604080516001600160a01b038088168252831660208201529192507f0fb2d916aa6a78060ff9e89d89d62797c6668818dec04969013c5098754380ec910160405180910390a19392505050565b600080826040516101b49061025f565b6001600160a01b039091168152602001604051809103906000f0801580156101e0573d6000803e3d6000fd5b50604080516001600160a01b038087168252831660208201529192507f0fb2d916aa6a78060ff9e89d89d62797c6668818dec04969013c5098754380ec910160405180910390a192915050565b600061010e8383306000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b6105a08061031b83390190565b80356001600160a01b038116811461028357600080fd5b919050565b6000806040838503121561029b57600080fd5b6102a48361026c565b946020939093013593505050565b6000602082840312156102c457600080fd5b61010e8261026c565b6000815160005b818110156102ee57602081850181015186830152016102d4565b50600093019283525090919050565b600061031261030c83866102cd565b846102cd565b94935050505056fe608060405234801561001057600080fd5b506040516105a03803806105a083398101604081905261002f916100c0565b806001600160a01b03811661005e57604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b6100678161006e565b50506100f0565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000602082840312156100d257600080fd5b81516001600160a01b03811681146100e957600080fd5b9392505050565b6104a1806100ff6000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063715018a61461005c578063866b85fa146100665780638da5cb5b14610079578063c1f59afc14610099578063f2fde38b146100ba575b600080fd5b6100646100cd565b005b61006461007436600461036a565b6100e1565b6001546040516001600160a01b0390911681526020015b60405180910390f35b6100ac6100a73660046103a7565b610146565b604051908152602001610090565b6100646100c83660046103db565b6101bb565b6100d56101fe565b6100df600061022b565b565b6100e96101fe565b826001600160a01b0316336001600160a01b03167f940326476a755934b6ae9d2b36ffcf1f447c3a8223f6d9f8a796b54fbfcce582848460405161012e929190610415565b60405180910390a361014183838361027d565b505050565b6001600160a01b038216600090815260208181526040822090829061016d90850185610450565b67ffffffffffffffff168152602001908152602001600020600083602001602081019061019a9190610450565b67ffffffffffffffff16815260200190815260200160002054905092915050565b6101c36101fe565b6001600160a01b0381166101f257604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b6101fb8161022b565b50565b6001546001600160a01b031633146100df5760405163118cdaa760e01b81523360048201526024016101e9565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0383166000908152602081815260408220839290916102a590860186610450565b67ffffffffffffffff16815260200190815260200160002060008460200160208101906102d29190610450565b67ffffffffffffffff16815260200190815260200160002081905550826001600160a01b03167f4e068a6b8ed35e6ee03244135874f91ccebb5cd1f3a258a6dc2ad0ebd29884768383604051610329929190610415565b60405180910390a2505050565b80356001600160a01b038116811461034d57600080fd5b919050565b60006040828403121561036457600080fd5b50919050565b60008060006080848603121561037f57600080fd5b61038884610336565b92506103978560208601610352565b9150606084013590509250925092565b600080606083850312156103ba57600080fd5b6103c383610336565b91506103d28460208501610352565b90509250929050565b6000602082840312156103ed57600080fd5b6103f682610336565b9392505050565b803567ffffffffffffffff8116811461034d57600080fd5b6060810167ffffffffffffffff8061042c866103fd565b1683528061043c602087016103fd565b166020840152508260408301529392505050565b60006020828403121561046257600080fd5b6103f6826103fd56fea26469706673582212209daab5af7bf31878a001268a1e530a73c9e116addde25fe1ed74dbd37dd6ab6664736f6c63430008170033a2646970667358221220202385c5d3667fd4673b493ed4c06f5c86e9736d67477efdd7fa7a1f5e0e807164736f6c63430008170033", + "numDeployments": 3, + "solcInputHash": "3277ebc53d2ec4c7847e5faa9f9b26b3", + "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract IAuthority\",\"name\":\"authority\",\"type\":\"address\"}],\"name\":\"AuthorityCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"authorityOwner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"epochLength\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"}],\"name\":\"calculateAuthorityAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"authorityOwner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"epochLength\",\"type\":\"uint256\"}],\"name\":\"newAuthority\",\"outputs\":[{\"internalType\":\"contract IAuthority\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"authorityOwner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"epochLength\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"}],\"name\":\"newAuthority\",\"outputs\":[{\"internalType\":\"contract IAuthority\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"AuthorityCreated(address)\":{\"details\":\"MUST be triggered on a successful call to `newAuthority`.\",\"params\":{\"authority\":\"The authority\"}}},\"kind\":\"dev\",\"methods\":{\"calculateAuthorityAddress(address,uint256,bytes32)\":{\"details\":\"Beware that only the `newAuthority` function with the `salt` parameter is able to deterministically deploy an authority.\",\"params\":{\"authorityOwner\":\"The initial authority owner\",\"epochLength\":\"The epoch length\",\"salt\":\"The salt used to deterministically generate the authority address\"},\"returns\":{\"_0\":\"The deterministic authority address\"}},\"newAuthority(address,uint256)\":{\"details\":\"On success, MUST emit an `AuthorityCreated` event.Reverts if the authority owner address is zero.Reverts if the epoch length is zero.\",\"params\":{\"authorityOwner\":\"The initial authority owner\",\"epochLength\":\"The epoch length\"},\"returns\":{\"_0\":\"The authority\"}},\"newAuthority(address,uint256,bytes32)\":{\"details\":\"On success, MUST emit an `AuthorityCreated` event.Reverts if the authority owner address is zero.Reverts if the epoch length is zero.\",\"params\":{\"authorityOwner\":\"The initial authority owner\",\"epochLength\":\"The epoch length\",\"salt\":\"The salt used to deterministically generate the authority address\"},\"returns\":{\"_0\":\"The authority\"}}},\"title\":\"Authority Factory\",\"version\":1},\"userdoc\":{\"events\":{\"AuthorityCreated(address)\":{\"notice\":\"A new authority was deployed.\"}},\"kind\":\"user\",\"methods\":{\"calculateAuthorityAddress(address,uint256,bytes32)\":{\"notice\":\"Calculate the address of an authority to be deployed deterministically.\"},\"newAuthority(address,uint256)\":{\"notice\":\"Deploy a new authority.\"},\"newAuthority(address,uint256,bytes32)\":{\"notice\":\"Deploy a new authority deterministically.\"}},\"notice\":\"Allows anyone to reliably deploy a new `IAuthority` contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/consensus/authority/AuthorityFactory.sol\":\"AuthorityFactory\"},\"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 v5.0.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {Context} from \\\"../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 * The initial owner is set to the address provided by the deployer. This can\\n * 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 /**\\n * @dev The caller account is not authorized to perform an operation.\\n */\\n error OwnableUnauthorizedAccount(address account);\\n\\n /**\\n * @dev The owner is not a valid owner account. (eg. `address(0)`)\\n */\\n error OwnableInvalidOwner(address owner);\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\\n */\\n constructor(address initialOwner) {\\n if (initialOwner == address(0)) {\\n revert OwnableInvalidOwner(address(0));\\n }\\n _transferOwnership(initialOwner);\\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 if (owner() != _msgSender()) {\\n revert OwnableUnauthorizedAccount(_msgSender());\\n }\\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 if (newOwner == address(0)) {\\n revert OwnableInvalidOwner(address(0));\\n }\\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\":\"0xff6d0bb2e285473e5311d9d3caacb525ae3538a80758c10649a4d61029b017bb\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\\n\\npragma solidity ^0.8.20;\\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 function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Not enough balance for performing a CREATE2 deploy.\\n */\\n error Create2InsufficientBalance(uint256 balance, uint256 needed);\\n\\n /**\\n * @dev There's no code to deploy.\\n */\\n error Create2EmptyBytecode();\\n\\n /**\\n * @dev The deployment failed.\\n */\\n error Create2FailedDeployment();\\n\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\\n if (address(this).balance < amount) {\\n revert Create2InsufficientBalance(address(this).balance, amount);\\n }\\n if (bytecode.length == 0) {\\n revert Create2EmptyBytecode();\\n }\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n if (addr == address(0)) {\\n revert Create2FailedDeployment();\\n }\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2b9807d194b92f1068d868e9587d27037264a9a067c778486f86ae21c61cbd5e\",\"license\":\"MIT\"},\"contracts/access/IOwnable.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/// @notice The interface of OpenZeppelin's `Ownable` contract.\\ninterface IOwnable {\\n function owner() external view returns (address);\\n function renounceOwnership() external;\\n function transferOwnership(address newOwner) external;\\n}\\n\",\"keccak256\":\"0x826f366603fe6fd715bd912d40e9b4e851c110aea5895522523d800015532f6d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"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/// @notice Stores accepted claims for several applications.\\n/// @dev This contract was designed to be inherited by implementations of the `IConsensus` interface\\n/// that only need a simple mechanism of storage and retrieval of accepted claims.\\nabstract contract AbstractConsensus is IConsensus {\\n /// @notice The epoch length\\n uint256 private immutable _epochLength;\\n\\n /// @notice Indexes accepted claims by application contract address.\\n mapping(address => mapping(bytes32 => bool)) private _acceptedClaims;\\n\\n /// @param epochLength The epoch length\\n /// @dev Reverts if the epoch length is zero.\\n constructor(uint256 epochLength) {\\n require(epochLength > 0, \\\"epoch length must not be zero\\\");\\n _epochLength = epochLength;\\n }\\n\\n /// @inheritdoc IConsensus\\n function wasClaimAccepted(\\n address appContract,\\n bytes32 claim\\n ) public view override returns (bool) {\\n return _acceptedClaims[appContract][claim];\\n }\\n\\n /// @inheritdoc IConsensus\\n function getEpochLength() public view override returns (uint256) {\\n return _epochLength;\\n }\\n\\n /// @notice Accept a claim.\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The output Merkle root hash\\n /// @dev Emits a `ClaimAcceptance` event.\\n function _acceptClaim(\\n address appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n ) internal {\\n _acceptedClaims[appContract][claim] = true;\\n emit ClaimAcceptance(appContract, lastProcessedBlockNumber, claim);\\n }\\n}\\n\",\"keccak256\":\"0x8d94096a285a068e53dfa65f26d4aa8549c3edf0d80e1b3f4322a2df69e141b7\",\"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/// @notice Each application has its own stream of inputs.\\n/// See the `IInputBox` interface for calldata-based on-chain data availability.\\n/// @notice When an input is fed to the application, it may yield several outputs.\\n/// @notice Since genesis, a Merkle tree of all outputs ever produced is maintained\\n/// both inside and outside the Cartesi Machine.\\n/// @notice The claim that validators may submit to the consensus contract\\n/// is the root of this Merkle tree after processing all base layer blocks until some height.\\n/// @notice A validator should be able to save transaction fees by not submitting a claim if it was...\\n/// - already submitted by the validator (see the `ClaimSubmission` event) or;\\n/// - already accepted by the consensus (see the `ClaimAcceptance` event).\\n/// @notice The acceptance criteria for claims may depend on the type of consensus, and is not specified by this interface.\\n/// For example, a claim may be accepted if it was...\\n/// - submitted by an authority or;\\n/// - submitted by the majority of a quorum or;\\n/// - submitted and not proven wrong after some period of time or;\\n/// - submitted and proven correct through an on-chain tournament.\\ninterface IConsensus {\\n /// @notice MUST trigger when a claim is submitted.\\n /// @param submitter The submitter address\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The root of the Merkle tree of outputs\\n event ClaimSubmission(\\n address indexed submitter,\\n address indexed appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n );\\n\\n /// @notice MUST trigger when a claim is accepted.\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The root of the Merkle tree of outputs\\n event ClaimAcceptance(\\n address indexed appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n );\\n\\n /// @notice Submit a claim to the consensus.\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The root of the Merkle tree of outputs\\n /// @dev MUST fire a `ClaimSubmission` event.\\n /// @dev MAY fire a `ClaimAcceptance` event, if the acceptance criteria is met.\\n function submitClaim(\\n address appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n ) external;\\n\\n /// @notice Check if an output Merkle root hash was ever accepted by the consensus\\n /// for a particular application.\\n /// @param appContract The application contract address\\n /// @param claim The root of the Merkle tree of outputs\\n function wasClaimAccepted(\\n address appContract,\\n bytes32 claim\\n ) external view returns (bool);\\n\\n /// @notice Get the epoch length, in number of base layer blocks.\\n /// @dev The epoch number of a block is defined as\\n /// the integer division of the block number by the epoch length.\\n function getEpochLength() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x33ef3c4e213b2a3489b37d5ef553dc1165c598c56beb0ed8290723a5c74d821c\",\"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\\\";\\n\\nimport {IAuthority} from \\\"./IAuthority.sol\\\";\\nimport {IConsensus} from \\\"../IConsensus.sol\\\";\\nimport {AbstractConsensus} from \\\"../AbstractConsensus.sol\\\";\\nimport {IOwnable} from \\\"../../access/IOwnable.sol\\\";\\n\\n/// @notice A consensus contract controlled by a single address, the owner.\\n/// @dev This contract inherits from OpenZeppelin's `Ownable` contract.\\n/// For more information on `Ownable`, please consult OpenZeppelin's official documentation.\\ncontract Authority is IAuthority, AbstractConsensus, Ownable {\\n /// @param initialOwner The initial contract owner\\n /// @param epochLength The epoch length\\n /// @dev Reverts if the epoch length is zero.\\n constructor(\\n address initialOwner,\\n uint256 epochLength\\n ) AbstractConsensus(epochLength) Ownable(initialOwner) {}\\n\\n /// @notice Submit a claim.\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The output Merkle root hash\\n /// @dev Fires a `ClaimSubmission` event and a `ClaimAcceptance` event.\\n /// @dev Can only be called by the owner.\\n function submitClaim(\\n address appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n ) external override onlyOwner {\\n emit ClaimSubmission(\\n msg.sender,\\n appContract,\\n lastProcessedBlockNumber,\\n claim\\n );\\n _acceptClaim(appContract, lastProcessedBlockNumber, claim);\\n }\\n\\n function owner() public view override(IOwnable, Ownable) returns (address) {\\n return super.owner();\\n }\\n\\n function renounceOwnership() public override(IOwnable, Ownable) {\\n super.renounceOwnership();\\n }\\n\\n function transferOwnership(\\n address newOwner\\n ) public override(IOwnable, Ownable) {\\n super.transferOwnership(newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xaebdc8837598570f415461eb609ec5cfb51da3d2a631d133c83d95211b6fc85b\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/AuthorityFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Create2} from \\\"@openzeppelin/contracts/utils/Create2.sol\\\";\\n\\nimport {IAuthorityFactory} from \\\"./IAuthorityFactory.sol\\\";\\nimport {Authority} from \\\"./Authority.sol\\\";\\nimport {IAuthority} from \\\"./IAuthority.sol\\\";\\n\\n/// @title Authority Factory\\n/// @notice Allows anyone to reliably deploy a new `IAuthority` contract.\\ncontract AuthorityFactory is IAuthorityFactory {\\n function newAuthority(\\n address authorityOwner,\\n uint256 epochLength\\n ) external override returns (IAuthority) {\\n IAuthority authority = new Authority(authorityOwner, epochLength);\\n\\n emit AuthorityCreated(authority);\\n\\n return authority;\\n }\\n\\n function newAuthority(\\n address authorityOwner,\\n uint256 epochLength,\\n bytes32 salt\\n ) external override returns (IAuthority) {\\n IAuthority authority = new Authority{salt: salt}(\\n authorityOwner,\\n epochLength\\n );\\n\\n emit AuthorityCreated(authority);\\n\\n return authority;\\n }\\n\\n function calculateAuthorityAddress(\\n address authorityOwner,\\n uint256 epochLength,\\n bytes32 salt\\n ) external view override returns (address) {\\n return\\n Create2.computeAddress(\\n salt,\\n keccak256(\\n abi.encodePacked(\\n type(Authority).creationCode,\\n abi.encode(authorityOwner, epochLength)\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0xebd3e83da68c6b5173289d5f4f32e5bb4874cad4f3675b8fd90b4187c1656773\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/IAuthority.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 {IOwnable} from \\\"../../access/IOwnable.sol\\\";\\nimport {IConsensus} from \\\"../IConsensus.sol\\\";\\n\\n/// @notice A consensus contract controlled by a single address, the owner.\\ninterface IAuthority is IConsensus, IOwnable {}\\n\",\"keccak256\":\"0x6b63b7eb9c7deac1184052e58a2fba6e45bc630f1a38225d35cafbd0d5b98b04\",\"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 {IAuthority} from \\\"./IAuthority.sol\\\";\\n\\n/// @title Authority Factory interface\\ninterface IAuthorityFactory {\\n // Events\\n\\n /// @notice A new authority was deployed.\\n /// @param authority The authority\\n /// @dev MUST be triggered on a successful call to `newAuthority`.\\n event AuthorityCreated(IAuthority authority);\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new authority.\\n /// @param authorityOwner The initial authority owner\\n /// @param epochLength The epoch length\\n /// @return The authority\\n /// @dev On success, MUST emit an `AuthorityCreated` event.\\n /// @dev Reverts if the authority owner address is zero.\\n /// @dev Reverts if the epoch length is zero.\\n function newAuthority(\\n address authorityOwner,\\n uint256 epochLength\\n ) external returns (IAuthority);\\n\\n /// @notice Deploy a new authority deterministically.\\n /// @param authorityOwner The initial authority owner\\n /// @param epochLength The epoch length\\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 /// @dev Reverts if the authority owner address is zero.\\n /// @dev Reverts if the epoch length is zero.\\n function newAuthority(\\n address authorityOwner,\\n uint256 epochLength,\\n bytes32 salt\\n ) external returns (IAuthority);\\n\\n /// @notice Calculate the address of an authority to be deployed deterministically.\\n /// @param authorityOwner The initial authority owner\\n /// @param epochLength The epoch length\\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 uint256 epochLength,\\n bytes32 salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x05bde19d7cbd2bed92a9d81baa60b7e24b00b99f3656b67515b0903e5a920d46\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506108a8806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80631442f7bb1461004657806393d7217c14610075578063ec99266814610088575b600080fd5b61005961005436600461029d565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b6100596100833660046102d0565b61011e565b61005961009636600461029d565b6101a7565b600061011682604051806020016100b190610274565b601f1982820381018352601f9091011660408181526001600160a01b0389166020830152810187905260600160408051601f19818403018152908290526100fb929160200161032a565b60405160208183030381529060405280519060200120610236565b949350505050565b600080838360405161012f90610274565b6001600160a01b0390921682526020820152604001604051809103906000f080158015610160573d6000803e3d6000fd5b506040516001600160a01b03821681529091507fdca1fad70bee4ba7a4e17a1c6e99e657d2251af7a279124758bc01588abe2d2f9060200160405180910390a19392505050565b6000808285856040516101b990610274565b6001600160a01b03909216825260208201526040018190604051809103906000f59050801580156101ee573d6000803e3d6000fd5b506040516001600160a01b03821681529091507fdca1fad70bee4ba7a4e17a1c6e99e657d2251af7a279124758bc01588abe2d2f9060200160405180910390a1949350505050565b600061024383833061024a565b9392505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b6105338061034083390190565b80356001600160a01b038116811461029857600080fd5b919050565b6000806000606084860312156102b257600080fd5b6102bb84610281565b95602085013595506040909401359392505050565b600080604083850312156102e357600080fd5b6102ec83610281565b946020939093013593505050565b6000815160005b8181101561031b5760208185018101518683015201610301565b50600093019283525090919050565b600061011661033983866102fa565b846102fa56fe60a060405234801561001057600080fd5b5060405161053338038061053383398101604081905261002f91610116565b8181600081116100865760405162461bcd60e51b815260206004820152601d60248201527f65706f6368206c656e677468206d757374206e6f74206265207a65726f00000060448201526064015b60405180910390fd5b6080526001600160a01b0381166100b357604051631e4fbdf760e01b81526000600482015260240161007d565b6100bc816100c4565b505050610150565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000806040838503121561012957600080fd5b82516001600160a01b038116811461014057600080fd5b6020939093015192949293505050565b6080516103c961016a600039600060f501526103c96000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c80636470af0014610067578063715018a61461007c5780638da5cb5b146100845780639618f35b146100a9578063cfe8a73b146100f0578063f2fde38b1461011e575b600080fd5b61007a610075366004610314565b610131565b005b61007a61018f565b61008c610199565b6040516001600160a01b0390911681526020015b60405180910390f35b6100e06100b7366004610347565b6001600160a01b0391909116600090815260208181526040808320938352929052205460ff1690565b60405190151581526020016100a0565b6040517f000000000000000000000000000000000000000000000000000000000000000081526020016100a0565b61007a61012c366004610371565b6101b2565b6101396101be565b60408051838152602081018390526001600160a01b0385169133917ff5a28e07a1b89d1ca3f9a2a7ef16bd650503a4791baf2e70dc401c21ee505f0a910160405180910390a361018a8383836101f5565b505050565b61019761025d565b565b60006101ad6001546001600160a01b031690565b905090565b6101bb8161026f565b50565b336101c7610199565b6001600160a01b0316146101975760405163118cdaa760e01b81523360048201526024015b60405180910390fd5b6001600160a01b038316600081815260208181526040808320858452825291829020805460ff1916600117905581518581529081018490527fd3e4892959c6ddb27e02bcaaebc0c1898d0f677b7360bf80339f10a8717957d3910160405180910390a2505050565b6102656101be565b61019760006102a6565b6102776101be565b6001600160a01b0381166102a157604051631e4fbdf760e01b8152600060048201526024016101ec565b6101bb815b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80356001600160a01b038116811461030f57600080fd5b919050565b60008060006060848603121561032957600080fd5b610332846102f8565b95602085013595506040909401359392505050565b6000806040838503121561035a57600080fd5b610363836102f8565b946020939093013593505050565b60006020828403121561038357600080fd5b61038c826102f8565b939250505056fea2646970667358221220fdfd7afacb990763bde79c74a424d800d5b6d84b9946a046eab3844941271e9864736f6c63430008170033a2646970667358221220cea85fc9e89ea5b4ed137a747c8c035c923896b73e090001968db6647ef1226864736f6c63430008170033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80631442f7bb1461004657806393d7217c14610075578063ec99266814610088575b600080fd5b61005961005436600461029d565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b6100596100833660046102d0565b61011e565b61005961009636600461029d565b6101a7565b600061011682604051806020016100b190610274565b601f1982820381018352601f9091011660408181526001600160a01b0389166020830152810187905260600160408051601f19818403018152908290526100fb929160200161032a565b60405160208183030381529060405280519060200120610236565b949350505050565b600080838360405161012f90610274565b6001600160a01b0390921682526020820152604001604051809103906000f080158015610160573d6000803e3d6000fd5b506040516001600160a01b03821681529091507fdca1fad70bee4ba7a4e17a1c6e99e657d2251af7a279124758bc01588abe2d2f9060200160405180910390a19392505050565b6000808285856040516101b990610274565b6001600160a01b03909216825260208201526040018190604051809103906000f59050801580156101ee573d6000803e3d6000fd5b506040516001600160a01b03821681529091507fdca1fad70bee4ba7a4e17a1c6e99e657d2251af7a279124758bc01588abe2d2f9060200160405180910390a1949350505050565b600061024383833061024a565b9392505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b6105338061034083390190565b80356001600160a01b038116811461029857600080fd5b919050565b6000806000606084860312156102b257600080fd5b6102bb84610281565b95602085013595506040909401359392505050565b600080604083850312156102e357600080fd5b6102ec83610281565b946020939093013593505050565b6000815160005b8181101561031b5760208185018101518683015201610301565b50600093019283525090919050565b600061011661033983866102fa565b846102fa56fe60a060405234801561001057600080fd5b5060405161053338038061053383398101604081905261002f91610116565b8181600081116100865760405162461bcd60e51b815260206004820152601d60248201527f65706f6368206c656e677468206d757374206e6f74206265207a65726f00000060448201526064015b60405180910390fd5b6080526001600160a01b0381166100b357604051631e4fbdf760e01b81526000600482015260240161007d565b6100bc816100c4565b505050610150565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000806040838503121561012957600080fd5b82516001600160a01b038116811461014057600080fd5b6020939093015192949293505050565b6080516103c961016a600039600060f501526103c96000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c80636470af0014610067578063715018a61461007c5780638da5cb5b146100845780639618f35b146100a9578063cfe8a73b146100f0578063f2fde38b1461011e575b600080fd5b61007a610075366004610314565b610131565b005b61007a61018f565b61008c610199565b6040516001600160a01b0390911681526020015b60405180910390f35b6100e06100b7366004610347565b6001600160a01b0391909116600090815260208181526040808320938352929052205460ff1690565b60405190151581526020016100a0565b6040517f000000000000000000000000000000000000000000000000000000000000000081526020016100a0565b61007a61012c366004610371565b6101b2565b6101396101be565b60408051838152602081018390526001600160a01b0385169133917ff5a28e07a1b89d1ca3f9a2a7ef16bd650503a4791baf2e70dc401c21ee505f0a910160405180910390a361018a8383836101f5565b505050565b61019761025d565b565b60006101ad6001546001600160a01b031690565b905090565b6101bb8161026f565b50565b336101c7610199565b6001600160a01b0316146101975760405163118cdaa760e01b81523360048201526024015b60405180910390fd5b6001600160a01b038316600081815260208181526040808320858452825291829020805460ff1916600117905581518581529081018490527fd3e4892959c6ddb27e02bcaaebc0c1898d0f677b7360bf80339f10a8717957d3910160405180910390a2505050565b6102656101be565b61019760006102a6565b6102776101be565b6001600160a01b0381166102a157604051631e4fbdf760e01b8152600060048201526024016101ec565b6101bb815b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80356001600160a01b038116811461030f57600080fd5b919050565b60008060006060848603121561032957600080fd5b610332846102f8565b95602085013595506040909401359392505050565b6000806040838503121561035a57600080fd5b610363836102f8565b946020939093013593505050565b60006020828403121561038357600080fd5b61038c826102f8565b939250505056fea2646970667358221220fdfd7afacb990763bde79c74a424d800d5b6d84b9946a046eab3844941271e9864736f6c63430008170033a2646970667358221220cea85fc9e89ea5b4ed137a747c8c035c923896b73e090001968db6647ef1226864736f6c63430008170033", "devdoc": { "events": { - "AuthorityCreated(address,address)": { + "AuthorityCreated(address)": { "details": "MUST be triggered on a successful call to `newAuthority`.", "params": { - "authority": "The authority", - "authorityOwner": "The initial authority owner" + "authority": "The authority" } } }, "kind": "dev", "methods": { - "calculateAuthorityAddress(address,bytes32)": { + "calculateAuthorityAddress(address,uint256,bytes32)": { "details": "Beware that only the `newAuthority` function with the `salt` parameter is able to deterministically deploy an authority.", "params": { "authorityOwner": "The initial authority owner", + "epochLength": "The epoch length", "salt": "The salt used to deterministically generate the authority address" }, "returns": { "_0": "The deterministic authority address" } }, - "newAuthority(address)": { - "details": "On success, MUST emit an `AuthorityCreated` event.", + "newAuthority(address,uint256)": { + "details": "On success, MUST emit an `AuthorityCreated` event.Reverts if the authority owner address is zero.Reverts if the epoch length is zero.", "params": { - "authorityOwner": "The initial authority owner" + "authorityOwner": "The initial authority owner", + "epochLength": "The epoch length" }, "returns": { "_0": "The authority" } }, - "newAuthority(address,bytes32)": { - "details": "On success, MUST emit an `AuthorityCreated` event.", + "newAuthority(address,uint256,bytes32)": { + "details": "On success, MUST emit an `AuthorityCreated` event.Reverts if the authority owner address is zero.Reverts if the epoch length is zero.", "params": { "authorityOwner": "The initial authority owner", + "epochLength": "The epoch length", "salt": "The salt used to deterministically generate the authority address" }, "returns": { @@ -157,23 +168,23 @@ }, "userdoc": { "events": { - "AuthorityCreated(address,address)": { + "AuthorityCreated(address)": { "notice": "A new authority was deployed." } }, "kind": "user", "methods": { - "calculateAuthorityAddress(address,bytes32)": { + "calculateAuthorityAddress(address,uint256,bytes32)": { "notice": "Calculate the address of an authority to be deployed deterministically." }, - "newAuthority(address)": { + "newAuthority(address,uint256)": { "notice": "Deploy a new authority." }, - "newAuthority(address,bytes32)": { + "newAuthority(address,uint256,bytes32)": { "notice": "Deploy a new authority deterministically." } }, - "notice": "Allows anyone to reliably deploy a new `Authority` contract.", + "notice": "Allows anyone to reliably deploy a new `IAuthority` contract.", "version": 1 }, "storageLayout": { diff --git a/deployments/sepolia/ERC1155BatchPortal.json b/deployments/sepolia/ERC1155BatchPortal.json index 53286f39..d60b5e7f 100644 --- a/deployments/sepolia/ERC1155BatchPortal.json +++ b/deployments/sepolia/ERC1155BatchPortal.json @@ -1,5 +1,5 @@ { - "address": "0x8A55f9AD8E78A8FBaf6c4c09D43e8ea0694b46E1", + "address": "0x4a218D331C0933d7E3EB496ac901669f28D94981", "abi": [ { "inputs": [ @@ -62,51 +62,32 @@ ], "stateMutability": "view", "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" } ], - "transactionHash": "0xea1d22cca3f849d31dbd86b974b39e52050aa149ed063d4ef65b726d449d0dac", + "transactionHash": "0x74d043e4185d038611578058fb1f9a92f64e9092216e1d21d71fd52f4ffecaa4", "receipt": { "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0xB25D9D56f5877Ca869A0362c324aCC2F1465AF1B", + "from": "0xeA4037a524309056545fbAd9A688f449E7e05ffB", "contractAddress": null, - "transactionIndex": 128, - "gasUsed": "411764", + "transactionIndex": 37, + "gasUsed": "370950", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xc99cfbbdb7fc4e29b9d31857481658412c4d8c16232ab3993aa59c92bf1ea586", - "transactionHash": "0xea1d22cca3f849d31dbd86b974b39e52050aa149ed063d4ef65b726d449d0dac", + "blockHash": "0x3ded79b9fdca61e5fc69c6abf1e64700c7a5880cf27f134875529eb3ae2b68d0", + "transactionHash": "0x74d043e4185d038611578058fb1f9a92f64e9092216e1d21d71fd52f4ffecaa4", "logs": [], - "blockNumber": 6099739, - "cumulativeGasUsed": "11897328", + "blockNumber": 6850939, + "cumulativeGasUsed": "10315652", "status": 1, "byzantium": true }, "args": [ - "0x58Df21fE097d4bE5dCf61e01d9ea3f6B81c2E1dB" + "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6" ], - "numDeployments": 4, - "solcInputHash": "d5e580c56a1973c1da5089d8c687e7bd", - "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"inputBox\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"contract IERC1155\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"baseLayerData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"execLayerData\",\"type\":\"bytes\"}],\"name\":\"depositBatchERC1155Token\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getInputBox\",\"outputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"inputBox\":\"The input box used by the portal\"}},\"depositBatchERC1155Token(address,address,uint256[],uint256[],bytes,bytes)\":{\"details\":\"Please make sure the arrays `tokenIds` and `values` have the same length.\",\"params\":{\"appContract\":\"The application contract address\",\"baseLayerData\":\"Additional data to be interpreted by the base layer\",\"execLayerData\":\"Additional data to be interpreted by the execution layer\",\"token\":\"The ERC-1155 token contract\",\"tokenIds\":\"The identifiers of the tokens being transferred\",\"values\":\"Transfer amounts per token type\"}},\"getInputBox()\":{\"returns\":{\"_0\":\"The input box\"}}},\"title\":\"ERC-1155 Batch Transfer Portal\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs the portal.\"},\"depositBatchERC1155Token(address,address,uint256[],uint256[],bytes,bytes)\":{\"notice\":\"Transfer a batch of ERC-1155 tokens of multiple types to an application contract and add an input to the application's input box to signal such operation. The caller must enable approval for the portal to manage all of their tokens beforehand, by calling the `setApprovalForAll` function in the token contract.\"},\"getInputBox()\":{\"notice\":\"Get the input box used by this portal.\"}},\"notice\":\"This contract allows anyone to perform batch transfers of ERC-1155 tokens to an application contract while informing the off-chain machine.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/portals/ERC1155BatchPortal.sol\":\"ERC1155BatchPortal\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the value of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155Received} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `value` amount.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.\\n *\\n * Requirements:\\n *\\n * - `ids` and `values` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x6caffc9cfdc623eca9f87a686071708af5d5c17454d65022843fdddbc53c0cce\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\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 value of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the value of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens as the allowance of `spender` over the\\n * 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 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\\n * allowance mechanism. `value` 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 value) external returns (bool);\\n}\\n\",\"keccak256\":\"0xc6a8ff0ea489379b61faa647490411b80102578440ab9d84e9a957cc12164e70\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or\\n * {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the address zero.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5ef46daa3b58ef2702279d514780316efaa952915ee1aa3396f041ee2982b0b4\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0x9e8778b14317ba9e256c30a76fd6c32b960af621987f56069e1e819c77c6a133\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x4296879f55019b23e135000eb36896057e7101fb7fb859c5ef690cf14643757b\",\"license\":\"MIT\"},\"contracts/common/InputEncoding.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 {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title Input Encoding Library\\n\\n/// @notice Defines the encoding of inputs added by core trustless and\\n/// permissionless contracts, such as portals.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Wei being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeEtherDeposit(\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-20 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param value The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeERC20Deposit(\\n IERC20 token,\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-721 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param tokenId The token identifier\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeERC721Deposit(\\n IERC721 token,\\n address sender,\\n uint256 tokenId,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 single token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenId The identifier of the token being transferred\\n /// @param value Transfer amount\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeSingleERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256 tokenId,\\n uint256 value,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n value, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 batch token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenIds The identifiers of the tokens being transferred\\n /// @param values Transfer amounts per token type\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeBatchERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256[] calldata tokenIds,\\n uint256[] calldata values,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(\\n tokenIds,\\n values,\\n baseLayerData,\\n execLayerData\\n );\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n data // arbitrary size\\n );\\n }\\n}\\n\",\"keccak256\":\"0x1a7e17a9739f27dd761234c388bc6ba30b4aacdf31fc750a29e5c11f0b08bcae\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputBox.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/// @notice Provides data availability of inputs for applications.\\n/// @notice Each application has its own append-only list of inputs.\\n/// @notice Off-chain, inputs can be retrieved via events.\\n/// @notice On-chain, only the input hashes are stored.\\n/// @notice See `LibInput` for more details on how such hashes are computed.\\ninterface IInputBox {\\n /// @notice MUST trigger when an input is added.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @param input The input blob\\n event InputAdded(\\n address indexed appContract,\\n uint256 indexed index,\\n bytes input\\n );\\n\\n /// @notice Input is too large.\\n /// @param appContract The application contract address\\n /// @param inputLength The input length\\n /// @param maxInputLength The maximum input length\\n error InputTooLarge(\\n address appContract,\\n uint256 inputLength,\\n uint256 maxInputLength\\n );\\n\\n /// @notice Send an input to an application.\\n /// @param appContract The application contract address\\n /// @param payload The input payload\\n /// @return The hash of the input blob\\n /// @dev MUST fire an `InputAdded` event.\\n function addInput(\\n address appContract,\\n bytes calldata payload\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs sent to an application.\\n /// @param appContract The application contract address\\n function getNumberOfInputs(\\n address appContract\\n ) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in an application's input box.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @dev The provided index must be valid.\\n function getInputHash(\\n address appContract,\\n uint256 index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xae7730cd7ab2b31a86d7c4933215853ea6c0b1b4dc60d4ec24e5cfc2ec005fe3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/ERC1155BatchPortal.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 {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\nimport {IERC1155BatchPortal} from \\\"./IERC1155BatchPortal.sol\\\";\\nimport {Portal} from \\\"./Portal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {InputEncoding} from \\\"../common/InputEncoding.sol\\\";\\n\\n/// @title ERC-1155 Batch Transfer Portal\\n///\\n/// @notice This contract allows anyone to perform batch transfers of\\n/// ERC-1155 tokens to an application contract while informing the off-chain machine.\\ncontract ERC1155BatchPortal is IERC1155BatchPortal, Portal {\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) Portal(inputBox) {}\\n\\n function depositBatchERC1155Token(\\n IERC1155 token,\\n address appContract,\\n uint256[] calldata tokenIds,\\n uint256[] calldata values,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) external override {\\n token.safeBatchTransferFrom(\\n msg.sender,\\n appContract,\\n tokenIds,\\n values,\\n baseLayerData\\n );\\n\\n bytes memory payload = InputEncoding.encodeBatchERC1155Deposit(\\n token,\\n msg.sender,\\n tokenIds,\\n values,\\n baseLayerData,\\n execLayerData\\n );\\n\\n _inputBox.addInput(appContract, payload);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view virtual override(IERC165, Portal) returns (bool) {\\n return\\n interfaceId == type(IERC1155BatchPortal).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n}\\n\",\"keccak256\":\"0xdbc07c0d40bd8479bce3eeb6b1f95701b9707456815663c38dc5cfda1544ee36\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IERC1155BatchPortal.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 {IPortal} from \\\"./IPortal.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title ERC-1155 Batch Transfer Portal interface\\ninterface IERC1155BatchPortal is IPortal {\\n // Permissionless functions\\n\\n /// @notice Transfer a batch of ERC-1155 tokens of multiple types to an application contract\\n /// and add an input to the application's input box to signal such operation.\\n ///\\n /// The caller must enable approval for the portal to manage all of their tokens\\n /// beforehand, by calling the `setApprovalForAll` function in the token contract.\\n ///\\n /// @param token The ERC-1155 token contract\\n /// @param appContract The application contract address\\n /// @param tokenIds The identifiers of the tokens being transferred\\n /// @param values Transfer amounts per token type\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n ///\\n /// @dev Please make sure the arrays `tokenIds` and `values` have the same length.\\n function depositBatchERC1155Token(\\n IERC1155 token,\\n address appContract,\\n uint256[] calldata tokenIds,\\n uint256[] calldata values,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0xb8b26505036fc698af4e6ab71b6c20267c67e22d0252b99569fa93ed9c9baf23\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IPortal.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 {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\n/// @title Portal interface\\ninterface IPortal is IERC165 {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this portal.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0xbc364030939ea4a214e2f3673eaca1c500fcfd4929239a3b5d804ffc5687ed37\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/Portal.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 {IPortal} from \\\"./IPortal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {ERC165, IERC165} from \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\n/// @title Portal\\n/// @notice This contract serves as a base for all the other portals.\\ncontract Portal is IPortal, ERC165 {\\n /// @notice The input box used by the portal.\\n IInputBox internal immutable _inputBox;\\n\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) {\\n _inputBox = inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return _inputBox;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view virtual override(ERC165, IERC165) returns (bool) {\\n return\\n interfaceId == type(IPortal).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n}\\n\",\"keccak256\":\"0x0cd3da30a41e1085163195b99526cedced7665c89d291d287500d53e5160e5dc\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b5060405161070238038061070283398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b608051610671610091600039600081816052015261017e01526106716000f3fe608060405234801561001057600080fd5b50600436106100405760003560e01c8062aace9a1461004557806301ffc9a71461008157806324d15c67146100a4575b600080fd5b6040516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001681526020015b60405180910390f35b61009461008f3660046102a3565b6100b9565b6040519015158152602001610078565b6100b76100b236600461037e565b6100e4565b005b60006001600160e01b031982166324d15c6760e01b14806100de57506100de82610206565b92915050565b604051631759616b60e11b81526001600160a01b038b1690632eb2c2d69061011e9033908d908d908d908d908d908d908d906004016104c1565b600060405180830381600087803b15801561013857600080fd5b505af115801561014c573d6000803e3d6000fd5b5050505060006101648b338b8b8b8b8b8b8b8b61023a565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd63906101b5908d908590600401610549565b6020604051808303816000875af11580156101d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f8919061058b565b505050505050505050505050565b60006001600160e01b031982166255674d60e11b14806100de57506301ffc9a760e01b6001600160e01b03198316146100de565b60606000898989898989898960405160200161025d9897969594939291906105a4565b60405160208183030381529060405290508b8b82604051602001610283939291906105f5565b6040516020818303038152906040529150509a9950505050505050505050565b6000602082840312156102b557600080fd5b81356001600160e01b0319811681146102cd57600080fd5b9392505050565b80356001600160a01b03811681146102eb57600080fd5b919050565b60008083601f84011261030257600080fd5b50813567ffffffffffffffff81111561031a57600080fd5b6020830191508360208260051b850101111561033557600080fd5b9250929050565b60008083601f84011261034e57600080fd5b50813567ffffffffffffffff81111561036657600080fd5b60208301915083602082850101111561033557600080fd5b60008060008060008060008060008060c08b8d03121561039d57600080fd5b6103a68b6102d4565b99506103b460208c016102d4565b985060408b013567ffffffffffffffff808211156103d157600080fd5b6103dd8e838f016102f0565b909a50985060608d01359150808211156103f657600080fd5b6104028e838f016102f0565b909850965060808d013591508082111561041b57600080fd5b6104278e838f0161033c565b909650945060a08d013591508082111561044057600080fd5b5061044d8d828e0161033c565b915080935050809150509295989b9194979a5092959850565b81835260006001600160fb1b0383111561047f57600080fd5b8260051b80836020870137939093016020019392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0389811682528816602082015260a0604082018190526000906104ee908301888a610466565b8281036060840152610501818789610466565b90508281036080840152610516818587610498565b9b9a5050505050505050505050565b60005b83811015610540578181015183820152602001610528565b50506000910152565b60018060a01b03831681526040602082015260008251806040840152610576816060850160208701610525565b601f01601f1916919091016060019392505050565b60006020828403121561059d57600080fd5b5051919050565b6080815260006105b8608083018a8c610466565b82810360208401526105cb81898b610466565b905082810360408401526105e0818789610498565b90508281036060840152610516818587610498565b60006bffffffffffffffffffffffff19808660601b168352808560601b16601484015250825161062c816028850160208701610525565b9190910160280194935050505056fea264697066735822122066692ea3d3c201dcc743c27987b04d5dbc11f2c31e058d8bac3e860205dd7a9d64736f6c63430008170033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100405760003560e01c8062aace9a1461004557806301ffc9a71461008157806324d15c67146100a4575b600080fd5b6040516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001681526020015b60405180910390f35b61009461008f3660046102a3565b6100b9565b6040519015158152602001610078565b6100b76100b236600461037e565b6100e4565b005b60006001600160e01b031982166324d15c6760e01b14806100de57506100de82610206565b92915050565b604051631759616b60e11b81526001600160a01b038b1690632eb2c2d69061011e9033908d908d908d908d908d908d908d906004016104c1565b600060405180830381600087803b15801561013857600080fd5b505af115801561014c573d6000803e3d6000fd5b5050505060006101648b338b8b8b8b8b8b8b8b61023a565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd63906101b5908d908590600401610549565b6020604051808303816000875af11580156101d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f8919061058b565b505050505050505050505050565b60006001600160e01b031982166255674d60e11b14806100de57506301ffc9a760e01b6001600160e01b03198316146100de565b60606000898989898989898960405160200161025d9897969594939291906105a4565b60405160208183030381529060405290508b8b82604051602001610283939291906105f5565b6040516020818303038152906040529150509a9950505050505050505050565b6000602082840312156102b557600080fd5b81356001600160e01b0319811681146102cd57600080fd5b9392505050565b80356001600160a01b03811681146102eb57600080fd5b919050565b60008083601f84011261030257600080fd5b50813567ffffffffffffffff81111561031a57600080fd5b6020830191508360208260051b850101111561033557600080fd5b9250929050565b60008083601f84011261034e57600080fd5b50813567ffffffffffffffff81111561036657600080fd5b60208301915083602082850101111561033557600080fd5b60008060008060008060008060008060c08b8d03121561039d57600080fd5b6103a68b6102d4565b99506103b460208c016102d4565b985060408b013567ffffffffffffffff808211156103d157600080fd5b6103dd8e838f016102f0565b909a50985060608d01359150808211156103f657600080fd5b6104028e838f016102f0565b909850965060808d013591508082111561041b57600080fd5b6104278e838f0161033c565b909650945060a08d013591508082111561044057600080fd5b5061044d8d828e0161033c565b915080935050809150509295989b9194979a5092959850565b81835260006001600160fb1b0383111561047f57600080fd5b8260051b80836020870137939093016020019392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0389811682528816602082015260a0604082018190526000906104ee908301888a610466565b8281036060840152610501818789610466565b90508281036080840152610516818587610498565b9b9a5050505050505050505050565b60005b83811015610540578181015183820152602001610528565b50506000910152565b60018060a01b03831681526040602082015260008251806040840152610576816060850160208701610525565b601f01601f1916919091016060019392505050565b60006020828403121561059d57600080fd5b5051919050565b6080815260006105b8608083018a8c610466565b82810360208401526105cb81898b610466565b905082810360408401526105e0818789610498565b90508281036060840152610516818587610498565b60006bffffffffffffffffffffffff19808660601b168352808560601b16601484015250825161062c816028850160208701610525565b9190910160280194935050505056fea264697066735822122066692ea3d3c201dcc743c27987b04d5dbc11f2c31e058d8bac3e860205dd7a9d64736f6c63430008170033", + "numDeployments": 5, + "solcInputHash": "8db616d9d86bc002576bd1bb74fd4f72", + "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"inputBox\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"contract IERC1155\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"baseLayerData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"execLayerData\",\"type\":\"bytes\"}],\"name\":\"depositBatchERC1155Token\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getInputBox\",\"outputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"inputBox\":\"The input box used by the portal\"}},\"depositBatchERC1155Token(address,address,uint256[],uint256[],bytes,bytes)\":{\"details\":\"Please make sure the arrays `tokenIds` and `values` have the same length.\",\"params\":{\"appContract\":\"The application contract address\",\"baseLayerData\":\"Additional data to be interpreted by the base layer\",\"execLayerData\":\"Additional data to be interpreted by the execution layer\",\"token\":\"The ERC-1155 token contract\",\"tokenIds\":\"The identifiers of the tokens being transferred\",\"values\":\"Transfer amounts per token type\"}},\"getInputBox()\":{\"returns\":{\"_0\":\"The input box\"}}},\"title\":\"ERC-1155 Batch Transfer Portal\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs the portal.\"},\"depositBatchERC1155Token(address,address,uint256[],uint256[],bytes,bytes)\":{\"notice\":\"Transfer a batch of ERC-1155 tokens of multiple types to an application contract and add an input to the application's input box to signal such operation. The caller must enable approval for the portal to manage all of their tokens beforehand, by calling the `setApprovalForAll` function in the token contract.\"},\"getInputBox()\":{\"notice\":\"Get the input box used by this portal.\"}},\"notice\":\"This contract allows anyone to perform batch transfers of ERC-1155 tokens to an application contract while informing the off-chain machine.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/portals/ERC1155BatchPortal.sol\":\"ERC1155BatchPortal\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the value of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155Received} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `value` amount.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.\\n *\\n * Requirements:\\n *\\n * - `ids` and `values` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x6caffc9cfdc623eca9f87a686071708af5d5c17454d65022843fdddbc53c0cce\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\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 value of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the value of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens as the allowance of `spender` over the\\n * 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 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\\n * allowance mechanism. `value` 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 value) external returns (bool);\\n}\\n\",\"keccak256\":\"0xc6a8ff0ea489379b61faa647490411b80102578440ab9d84e9a957cc12164e70\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or\\n * {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the address zero.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5ef46daa3b58ef2702279d514780316efaa952915ee1aa3396f041ee2982b0b4\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x4296879f55019b23e135000eb36896057e7101fb7fb859c5ef690cf14643757b\",\"license\":\"MIT\"},\"contracts/common/InputEncoding.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 {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title Input Encoding Library\\n\\n/// @notice Defines the encoding of inputs added by core trustless and\\n/// permissionless contracts, such as portals.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Wei being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeEtherDeposit(\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-20 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param value The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeERC20Deposit(\\n IERC20 token,\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-721 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param tokenId The token identifier\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeERC721Deposit(\\n IERC721 token,\\n address sender,\\n uint256 tokenId,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 single token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenId The identifier of the token being transferred\\n /// @param value Transfer amount\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeSingleERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256 tokenId,\\n uint256 value,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n value, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 batch token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenIds The identifiers of the tokens being transferred\\n /// @param values Transfer amounts per token type\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeBatchERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256[] calldata tokenIds,\\n uint256[] calldata values,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(\\n tokenIds,\\n values,\\n baseLayerData,\\n execLayerData\\n );\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n data // arbitrary size\\n );\\n }\\n}\\n\",\"keccak256\":\"0x1a7e17a9739f27dd761234c388bc6ba30b4aacdf31fc750a29e5c11f0b08bcae\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputBox.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/// @notice Provides data availability of inputs for applications.\\n/// @notice Each application has its own append-only list of inputs.\\n/// @notice Off-chain, inputs can be retrieved via events.\\n/// @notice On-chain, only the input hashes are stored.\\n/// @notice See `LibInput` for more details on how such hashes are computed.\\ninterface IInputBox {\\n /// @notice MUST trigger when an input is added.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @param input The input blob\\n event InputAdded(\\n address indexed appContract,\\n uint256 indexed index,\\n bytes input\\n );\\n\\n /// @notice Input is too large.\\n /// @param appContract The application contract address\\n /// @param inputLength The input length\\n /// @param maxInputLength The maximum input length\\n error InputTooLarge(\\n address appContract,\\n uint256 inputLength,\\n uint256 maxInputLength\\n );\\n\\n /// @notice Send an input to an application.\\n /// @param appContract The application contract address\\n /// @param payload The input payload\\n /// @return The hash of the input blob\\n /// @dev MUST fire an `InputAdded` event.\\n function addInput(\\n address appContract,\\n bytes calldata payload\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs sent to an application.\\n /// @param appContract The application contract address\\n function getNumberOfInputs(\\n address appContract\\n ) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in an application's input box.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @dev The provided index must be valid.\\n function getInputHash(\\n address appContract,\\n uint256 index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xae7730cd7ab2b31a86d7c4933215853ea6c0b1b4dc60d4ec24e5cfc2ec005fe3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/ERC1155BatchPortal.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 {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\nimport {IERC1155BatchPortal} from \\\"./IERC1155BatchPortal.sol\\\";\\nimport {Portal} from \\\"./Portal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {InputEncoding} from \\\"../common/InputEncoding.sol\\\";\\n\\n/// @title ERC-1155 Batch Transfer Portal\\n///\\n/// @notice This contract allows anyone to perform batch transfers of\\n/// ERC-1155 tokens to an application contract while informing the off-chain machine.\\ncontract ERC1155BatchPortal is IERC1155BatchPortal, Portal {\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) Portal(inputBox) {}\\n\\n function depositBatchERC1155Token(\\n IERC1155 token,\\n address appContract,\\n uint256[] calldata tokenIds,\\n uint256[] calldata values,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) external override {\\n token.safeBatchTransferFrom(\\n msg.sender,\\n appContract,\\n tokenIds,\\n values,\\n baseLayerData\\n );\\n\\n bytes memory payload = InputEncoding.encodeBatchERC1155Deposit(\\n token,\\n msg.sender,\\n tokenIds,\\n values,\\n baseLayerData,\\n execLayerData\\n );\\n\\n _inputBox.addInput(appContract, payload);\\n }\\n}\\n\",\"keccak256\":\"0xb147f8d6b0a145ddd1c23fdbb58213f2dabc94a6a6adab9ec7646b58346534dd\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IERC1155BatchPortal.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 {IPortal} from \\\"./IPortal.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title ERC-1155 Batch Transfer Portal interface\\ninterface IERC1155BatchPortal is IPortal {\\n // Permissionless functions\\n\\n /// @notice Transfer a batch of ERC-1155 tokens of multiple types to an application contract\\n /// and add an input to the application's input box to signal such operation.\\n ///\\n /// The caller must enable approval for the portal to manage all of their tokens\\n /// beforehand, by calling the `setApprovalForAll` function in the token contract.\\n ///\\n /// @param token The ERC-1155 token contract\\n /// @param appContract The application contract address\\n /// @param tokenIds The identifiers of the tokens being transferred\\n /// @param values Transfer amounts per token type\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n ///\\n /// @dev Please make sure the arrays `tokenIds` and `values` have the same length.\\n function depositBatchERC1155Token(\\n IERC1155 token,\\n address appContract,\\n uint256[] calldata tokenIds,\\n uint256[] calldata values,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0xb8b26505036fc698af4e6ab71b6c20267c67e22d0252b99569fa93ed9c9baf23\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IPortal.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 {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\n\\n/// @title Portal interface\\ninterface IPortal {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this portal.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x390bc7ed84639e38e40bef8085486119d6c42057f91f3ab8286a9246198682e2\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/Portal.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 {IPortal} from \\\"./IPortal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\n\\n/// @title Portal\\n/// @notice This contract serves as a base for all the other portals.\\ncontract Portal is IPortal {\\n /// @notice The input box used by the portal.\\n IInputBox internal immutable _inputBox;\\n\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) {\\n _inputBox = inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return _inputBox;\\n }\\n}\\n\",\"keccak256\":\"0x0597a118880f0fe29f38931452342e8294dafc3699100cbf3454b6c5faa5f48a\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", + "bytecode": "0x60a060405234801561001057600080fd5b5060405161064538038061064583398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516105b461009160003960008181603c015261012601526105b46000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806324d15c6714610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a6100853660046102c1565b61008c565b005b604051631759616b60e11b81526001600160a01b038b1690632eb2c2d6906100c69033908d908d908d908d908d908d908d90600401610404565b600060405180830381600087803b1580156100e057600080fd5b505af11580156100f4573d6000803e3d6000fd5b50505050600061010c8b338b8b8b8b8b8b8b8b6101ae565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061015d908d90859060040161048c565b6020604051808303816000875af115801561017c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a091906104ce565b505050505050505050505050565b6060600089898989898989896040516020016101d19897969594939291906104e7565b60405160208183030381529060405290508b8b826040516020016101f793929190610538565b6040516020818303038152906040529150509a9950505050505050505050565b80356001600160a01b038116811461022e57600080fd5b919050565b60008083601f84011261024557600080fd5b50813567ffffffffffffffff81111561025d57600080fd5b6020830191508360208260051b850101111561027857600080fd5b9250929050565b60008083601f84011261029157600080fd5b50813567ffffffffffffffff8111156102a957600080fd5b60208301915083602082850101111561027857600080fd5b60008060008060008060008060008060c08b8d0312156102e057600080fd5b6102e98b610217565b99506102f760208c01610217565b985060408b013567ffffffffffffffff8082111561031457600080fd5b6103208e838f01610233565b909a50985060608d013591508082111561033957600080fd5b6103458e838f01610233565b909850965060808d013591508082111561035e57600080fd5b61036a8e838f0161027f565b909650945060a08d013591508082111561038357600080fd5b506103908d828e0161027f565b915080935050809150509295989b9194979a5092959850565b81835260006001600160fb1b038311156103c257600080fd5b8260051b80836020870137939093016020019392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0389811682528816602082015260a060408201819052600090610431908301888a6103a9565b82810360608401526104448187896103a9565b905082810360808401526104598185876103db565b9b9a5050505050505050505050565b60005b8381101561048357818101518382015260200161046b565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526104b9816060850160208701610468565b601f01601f1916919091016060019392505050565b6000602082840312156104e057600080fd5b5051919050565b6080815260006104fb608083018a8c6103a9565b828103602084015261050e81898b6103a9565b905082810360408401526105238187896103db565b905082810360608401526104598185876103db565b60006bffffffffffffffffffffffff19808660601b168352808560601b16601484015250825161056f816028850160208701610468565b9190910160280194935050505056fea264697066735822122035db86f04505cf3f941203bf956d2dde8c705c85e4bb9bdbc3fdac6c5b1e565564736f6c63430008170033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806324d15c6714610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a6100853660046102c1565b61008c565b005b604051631759616b60e11b81526001600160a01b038b1690632eb2c2d6906100c69033908d908d908d908d908d908d908d90600401610404565b600060405180830381600087803b1580156100e057600080fd5b505af11580156100f4573d6000803e3d6000fd5b50505050600061010c8b338b8b8b8b8b8b8b8b6101ae565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061015d908d90859060040161048c565b6020604051808303816000875af115801561017c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a091906104ce565b505050505050505050505050565b6060600089898989898989896040516020016101d19897969594939291906104e7565b60405160208183030381529060405290508b8b826040516020016101f793929190610538565b6040516020818303038152906040529150509a9950505050505050505050565b80356001600160a01b038116811461022e57600080fd5b919050565b60008083601f84011261024557600080fd5b50813567ffffffffffffffff81111561025d57600080fd5b6020830191508360208260051b850101111561027857600080fd5b9250929050565b60008083601f84011261029157600080fd5b50813567ffffffffffffffff8111156102a957600080fd5b60208301915083602082850101111561027857600080fd5b60008060008060008060008060008060c08b8d0312156102e057600080fd5b6102e98b610217565b99506102f760208c01610217565b985060408b013567ffffffffffffffff8082111561031457600080fd5b6103208e838f01610233565b909a50985060608d013591508082111561033957600080fd5b6103458e838f01610233565b909850965060808d013591508082111561035e57600080fd5b61036a8e838f0161027f565b909650945060a08d013591508082111561038357600080fd5b506103908d828e0161027f565b915080935050809150509295989b9194979a5092959850565b81835260006001600160fb1b038311156103c257600080fd5b8260051b80836020870137939093016020019392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0389811682528816602082015260a060408201819052600090610431908301888a6103a9565b82810360608401526104448187896103a9565b905082810360808401526104598185876103db565b9b9a5050505050505050505050565b60005b8381101561048357818101518382015260200161046b565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526104b9816060850160208701610468565b601f01601f1916919091016060019392505050565b6000602082840312156104e057600080fd5b5051919050565b6080815260006104fb608083018a8c6103a9565b828103602084015261050e81898b6103a9565b905082810360408401526105238187896103db565b905082810360608401526104598185876103db565b60006bffffffffffffffffffffffff19808660601b168352808560601b16601484015250825161056f816028850160208701610468565b9190910160280194935050505056fea264697066735822122035db86f04505cf3f941203bf956d2dde8c705c85e4bb9bdbc3fdac6c5b1e565564736f6c63430008170033", "devdoc": { "kind": "dev", "methods": { diff --git a/deployments/sepolia/ERC1155SinglePortal.json b/deployments/sepolia/ERC1155SinglePortal.json index 41672d33..f6c9be9b 100644 --- a/deployments/sepolia/ERC1155SinglePortal.json +++ b/deployments/sepolia/ERC1155SinglePortal.json @@ -1,5 +1,5 @@ { - "address": "0x7a87676A40aEd3A780Cd8D58c22129D5673eaBc8", + "address": "0x2f0D587DD6EcF67d25C558f2e9c3839c579e5e38", "abi": [ { "inputs": [ @@ -62,51 +62,32 @@ ], "stateMutability": "view", "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" } ], - "transactionHash": "0xb781a0e20b1362abb82c814d97f0992fd4779bf31f7fe4cf480eb9b46794e9dc", + "transactionHash": "0xd32f7dc4f084f0d6b8800a6dc022dae7864e499620c35ddd31af8f27e9f00632", "receipt": { "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0xB25D9D56f5877Ca869A0362c324aCC2F1465AF1B", + "from": "0xeA4037a524309056545fbAd9A688f449E7e05ffB", "contractAddress": null, - "transactionIndex": 130, - "gasUsed": "358356", + "transactionIndex": 157, + "gasUsed": "317542", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x74dfadd40aa6fcc92a70cdddfe281b2baed59220dd293b6966518175da7cf17f", - "transactionHash": "0xb781a0e20b1362abb82c814d97f0992fd4779bf31f7fe4cf480eb9b46794e9dc", + "blockHash": "0x58f3cf075e0d5ba351de0b170ae896322e0919d3273cd00177a508a2ab2373e2", + "transactionHash": "0xd32f7dc4f084f0d6b8800a6dc022dae7864e499620c35ddd31af8f27e9f00632", "logs": [], - "blockNumber": 6099738, - "cumulativeGasUsed": "13873272", + "blockNumber": 6850938, + "cumulativeGasUsed": "6913790", "status": 1, "byzantium": true }, "args": [ - "0x58Df21fE097d4bE5dCf61e01d9ea3f6B81c2E1dB" + "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6" ], - "numDeployments": 4, - "solcInputHash": "d5e580c56a1973c1da5089d8c687e7bd", - "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"inputBox\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"contract IERC1155\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"baseLayerData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"execLayerData\",\"type\":\"bytes\"}],\"name\":\"depositSingleERC1155Token\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getInputBox\",\"outputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"inputBox\":\"The input box used by the portal\"}},\"depositSingleERC1155Token(address,address,uint256,uint256,bytes,bytes)\":{\"params\":{\"appContract\":\"The application contract address\",\"baseLayerData\":\"Additional data to be interpreted by the base layer\",\"execLayerData\":\"Additional data to be interpreted by the execution layer\",\"token\":\"The ERC-1155 token contract\",\"tokenId\":\"The identifier of the token being transferred\",\"value\":\"Transfer amount\"}},\"getInputBox()\":{\"returns\":{\"_0\":\"The input box\"}}},\"title\":\"ERC-1155 Single Transfer Portal\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs the portal.\"},\"depositSingleERC1155Token(address,address,uint256,uint256,bytes,bytes)\":{\"notice\":\"Transfer ERC-1155 tokens of a single type to an application contract and add an input to the application's input box to signal such operation. The caller must enable approval for the portal to manage all of their tokens beforehand, by calling the `setApprovalForAll` function in the token contract.\"},\"getInputBox()\":{\"notice\":\"Get the input box used by this portal.\"}},\"notice\":\"This contract allows anyone to perform single transfers of ERC-1155 tokens to an application contract while informing the off-chain machine.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/portals/ERC1155SinglePortal.sol\":\"ERC1155SinglePortal\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the value of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155Received} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `value` amount.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.\\n *\\n * Requirements:\\n *\\n * - `ids` and `values` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x6caffc9cfdc623eca9f87a686071708af5d5c17454d65022843fdddbc53c0cce\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\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 value of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the value of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens as the allowance of `spender` over the\\n * 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 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\\n * allowance mechanism. `value` 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 value) external returns (bool);\\n}\\n\",\"keccak256\":\"0xc6a8ff0ea489379b61faa647490411b80102578440ab9d84e9a957cc12164e70\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or\\n * {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the address zero.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5ef46daa3b58ef2702279d514780316efaa952915ee1aa3396f041ee2982b0b4\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0x9e8778b14317ba9e256c30a76fd6c32b960af621987f56069e1e819c77c6a133\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x4296879f55019b23e135000eb36896057e7101fb7fb859c5ef690cf14643757b\",\"license\":\"MIT\"},\"contracts/common/InputEncoding.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 {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title Input Encoding Library\\n\\n/// @notice Defines the encoding of inputs added by core trustless and\\n/// permissionless contracts, such as portals.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Wei being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeEtherDeposit(\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-20 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param value The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeERC20Deposit(\\n IERC20 token,\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-721 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param tokenId The token identifier\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeERC721Deposit(\\n IERC721 token,\\n address sender,\\n uint256 tokenId,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 single token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenId The identifier of the token being transferred\\n /// @param value Transfer amount\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeSingleERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256 tokenId,\\n uint256 value,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n value, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 batch token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenIds The identifiers of the tokens being transferred\\n /// @param values Transfer amounts per token type\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeBatchERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256[] calldata tokenIds,\\n uint256[] calldata values,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(\\n tokenIds,\\n values,\\n baseLayerData,\\n execLayerData\\n );\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n data // arbitrary size\\n );\\n }\\n}\\n\",\"keccak256\":\"0x1a7e17a9739f27dd761234c388bc6ba30b4aacdf31fc750a29e5c11f0b08bcae\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputBox.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/// @notice Provides data availability of inputs for applications.\\n/// @notice Each application has its own append-only list of inputs.\\n/// @notice Off-chain, inputs can be retrieved via events.\\n/// @notice On-chain, only the input hashes are stored.\\n/// @notice See `LibInput` for more details on how such hashes are computed.\\ninterface IInputBox {\\n /// @notice MUST trigger when an input is added.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @param input The input blob\\n event InputAdded(\\n address indexed appContract,\\n uint256 indexed index,\\n bytes input\\n );\\n\\n /// @notice Input is too large.\\n /// @param appContract The application contract address\\n /// @param inputLength The input length\\n /// @param maxInputLength The maximum input length\\n error InputTooLarge(\\n address appContract,\\n uint256 inputLength,\\n uint256 maxInputLength\\n );\\n\\n /// @notice Send an input to an application.\\n /// @param appContract The application contract address\\n /// @param payload The input payload\\n /// @return The hash of the input blob\\n /// @dev MUST fire an `InputAdded` event.\\n function addInput(\\n address appContract,\\n bytes calldata payload\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs sent to an application.\\n /// @param appContract The application contract address\\n function getNumberOfInputs(\\n address appContract\\n ) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in an application's input box.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @dev The provided index must be valid.\\n function getInputHash(\\n address appContract,\\n uint256 index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xae7730cd7ab2b31a86d7c4933215853ea6c0b1b4dc60d4ec24e5cfc2ec005fe3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/ERC1155SinglePortal.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 {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\nimport {IERC1155SinglePortal} from \\\"./IERC1155SinglePortal.sol\\\";\\nimport {Portal} from \\\"./Portal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {InputEncoding} from \\\"../common/InputEncoding.sol\\\";\\n\\n/// @title ERC-1155 Single Transfer Portal\\n///\\n/// @notice This contract allows anyone to perform single transfers of\\n/// ERC-1155 tokens to an application contract while informing the off-chain machine.\\ncontract ERC1155SinglePortal is IERC1155SinglePortal, Portal {\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) Portal(inputBox) {}\\n\\n function depositSingleERC1155Token(\\n IERC1155 token,\\n address appContract,\\n uint256 tokenId,\\n uint256 value,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) external override {\\n token.safeTransferFrom(\\n msg.sender,\\n appContract,\\n tokenId,\\n value,\\n baseLayerData\\n );\\n\\n bytes memory payload = InputEncoding.encodeSingleERC1155Deposit(\\n token,\\n msg.sender,\\n tokenId,\\n value,\\n baseLayerData,\\n execLayerData\\n );\\n\\n _inputBox.addInput(appContract, payload);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view virtual override(IERC165, Portal) returns (bool) {\\n return\\n interfaceId == type(IERC1155SinglePortal).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n}\\n\",\"keccak256\":\"0x9c7ae1f9049f30a608fc394ea02644c8f2f40fbae7059d243c568006c86b215f\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IERC1155SinglePortal.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 {IPortal} from \\\"./IPortal.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title ERC-1155 Single Transfer Portal interface\\ninterface IERC1155SinglePortal is IPortal {\\n // Permissionless functions\\n\\n /// @notice Transfer ERC-1155 tokens of a single type to an application contract\\n /// and add an input to the application's input box to signal such operation.\\n ///\\n /// The caller must enable approval for the portal to manage all of their tokens\\n /// beforehand, by calling the `setApprovalForAll` function in the token contract.\\n ///\\n /// @param token The ERC-1155 token contract\\n /// @param appContract The application contract address\\n /// @param tokenId The identifier of the token being transferred\\n /// @param value Transfer amount\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n function depositSingleERC1155Token(\\n IERC1155 token,\\n address appContract,\\n uint256 tokenId,\\n uint256 value,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0x0e239fc05c89858218fb6e663ccb7c26171afe6be7e63d4ba93423cf823e445a\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IPortal.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 {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\n/// @title Portal interface\\ninterface IPortal is IERC165 {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this portal.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0xbc364030939ea4a214e2f3673eaca1c500fcfd4929239a3b5d804ffc5687ed37\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/Portal.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 {IPortal} from \\\"./IPortal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {ERC165, IERC165} from \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\n/// @title Portal\\n/// @notice This contract serves as a base for all the other portals.\\ncontract Portal is IPortal, ERC165 {\\n /// @notice The input box used by the portal.\\n IInputBox internal immutable _inputBox;\\n\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) {\\n _inputBox = inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return _inputBox;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view virtual override(ERC165, IERC165) returns (bool) {\\n return\\n interfaceId == type(IPortal).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n}\\n\",\"keccak256\":\"0x0cd3da30a41e1085163195b99526cedced7665c89d291d287500d53e5160e5dc\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b5060405161060b38038061060b83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b60805161057a6100916000396000818160520152610178015261057a6000f3fe608060405234801561001057600080fd5b50600436106100405760003560e01c8062aace9a1461004557806301ffc9a714610081578063dec07dca146100a4575b600080fd5b6040516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001681526020015b60405180910390f35b61009461008f366004610295565b6100b9565b6040519015158152602001610078565b6100b76100b2366004610327565b6100e4565b005b60006001600160e01b03198216636f603ee560e11b14806100de57506100de826101fe565b92915050565b604051637921219560e11b81526001600160a01b0389169063f242432a9061011a9033908b908b908b908b908b906004016103f8565b600060405180830381600087803b15801561013457600080fd5b505af1158015610148573d6000803e3d6000fd5b50505050600061015e8933898989898989610232565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd63906101af908b908590600401610463565b6020604051808303816000875af11580156101ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f291906104a5565b50505050505050505050565b60006001600160e01b031982166255674d60e11b14806100de57506301ffc9a760e01b6001600160e01b03198316146100de565b606060008585858560405160200161024d94939291906104be565b604051602081830303815290604052905089898989846040516020016102779594939291906104f0565b60405160208183030381529060405291505098975050505050505050565b6000602082840312156102a757600080fd5b81356001600160e01b0319811681146102bf57600080fd5b9392505050565b6001600160a01b03811681146102db57600080fd5b50565b60008083601f8401126102f057600080fd5b50813567ffffffffffffffff81111561030857600080fd5b60208301915083602082850101111561032057600080fd5b9250929050565b60008060008060008060008060c0898b03121561034357600080fd5b883561034e816102c6565b9750602089013561035e816102c6565b96506040890135955060608901359450608089013567ffffffffffffffff8082111561038957600080fd5b6103958c838d016102de565b909650945060a08b01359150808211156103ae57600080fd5b506103bb8b828c016102de565b999c989b5096995094979396929594505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03878116825286166020820152604081018590526060810184905260a06080820181905260009061043390830184866103cf565b98975050505050505050565b60005b8381101561045a578181015183820152602001610442565b50506000910152565b60018060a01b0383168152604060208201526000825180604084015261049081606085016020870161043f565b601f01601f1916919091016060019392505050565b6000602082840312156104b757600080fd5b5051919050565b6040815260006104d26040830186886103cf565b82810360208401526104e58185876103cf565b979650505050505050565b60006bffffffffffffffffffffffff19808860601b168352808760601b16601484015250846028830152836048830152825161053381606885016020870161043f565b91909101606801969550505050505056fea264697066735822122033661412ecfee4599f6fb9695aa43c28b25f2c64310271e660ac3ed07b304ea864736f6c63430008170033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100405760003560e01c8062aace9a1461004557806301ffc9a714610081578063dec07dca146100a4575b600080fd5b6040516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001681526020015b60405180910390f35b61009461008f366004610295565b6100b9565b6040519015158152602001610078565b6100b76100b2366004610327565b6100e4565b005b60006001600160e01b03198216636f603ee560e11b14806100de57506100de826101fe565b92915050565b604051637921219560e11b81526001600160a01b0389169063f242432a9061011a9033908b908b908b908b908b906004016103f8565b600060405180830381600087803b15801561013457600080fd5b505af1158015610148573d6000803e3d6000fd5b50505050600061015e8933898989898989610232565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd63906101af908b908590600401610463565b6020604051808303816000875af11580156101ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f291906104a5565b50505050505050505050565b60006001600160e01b031982166255674d60e11b14806100de57506301ffc9a760e01b6001600160e01b03198316146100de565b606060008585858560405160200161024d94939291906104be565b604051602081830303815290604052905089898989846040516020016102779594939291906104f0565b60405160208183030381529060405291505098975050505050505050565b6000602082840312156102a757600080fd5b81356001600160e01b0319811681146102bf57600080fd5b9392505050565b6001600160a01b03811681146102db57600080fd5b50565b60008083601f8401126102f057600080fd5b50813567ffffffffffffffff81111561030857600080fd5b60208301915083602082850101111561032057600080fd5b9250929050565b60008060008060008060008060c0898b03121561034357600080fd5b883561034e816102c6565b9750602089013561035e816102c6565b96506040890135955060608901359450608089013567ffffffffffffffff8082111561038957600080fd5b6103958c838d016102de565b909650945060a08b01359150808211156103ae57600080fd5b506103bb8b828c016102de565b999c989b5096995094979396929594505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03878116825286166020820152604081018590526060810184905260a06080820181905260009061043390830184866103cf565b98975050505050505050565b60005b8381101561045a578181015183820152602001610442565b50506000910152565b60018060a01b0383168152604060208201526000825180604084015261049081606085016020870161043f565b601f01601f1916919091016060019392505050565b6000602082840312156104b757600080fd5b5051919050565b6040815260006104d26040830186886103cf565b82810360208401526104e58185876103cf565b979650505050505050565b60006bffffffffffffffffffffffff19808860601b168352808760601b16601484015250846028830152836048830152825161053381606885016020870161043f565b91909101606801969550505050505056fea264697066735822122033661412ecfee4599f6fb9695aa43c28b25f2c64310271e660ac3ed07b304ea864736f6c63430008170033", + "numDeployments": 5, + "solcInputHash": "8db616d9d86bc002576bd1bb74fd4f72", + "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"inputBox\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"contract IERC1155\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"baseLayerData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"execLayerData\",\"type\":\"bytes\"}],\"name\":\"depositSingleERC1155Token\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getInputBox\",\"outputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"inputBox\":\"The input box used by the portal\"}},\"depositSingleERC1155Token(address,address,uint256,uint256,bytes,bytes)\":{\"params\":{\"appContract\":\"The application contract address\",\"baseLayerData\":\"Additional data to be interpreted by the base layer\",\"execLayerData\":\"Additional data to be interpreted by the execution layer\",\"token\":\"The ERC-1155 token contract\",\"tokenId\":\"The identifier of the token being transferred\",\"value\":\"Transfer amount\"}},\"getInputBox()\":{\"returns\":{\"_0\":\"The input box\"}}},\"title\":\"ERC-1155 Single Transfer Portal\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs the portal.\"},\"depositSingleERC1155Token(address,address,uint256,uint256,bytes,bytes)\":{\"notice\":\"Transfer ERC-1155 tokens of a single type to an application contract and add an input to the application's input box to signal such operation. The caller must enable approval for the portal to manage all of their tokens beforehand, by calling the `setApprovalForAll` function in the token contract.\"},\"getInputBox()\":{\"notice\":\"Get the input box used by this portal.\"}},\"notice\":\"This contract allows anyone to perform single transfers of ERC-1155 tokens to an application contract while informing the off-chain machine.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/portals/ERC1155SinglePortal.sol\":\"ERC1155SinglePortal\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the value of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155Received} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `value` amount.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.\\n *\\n * Requirements:\\n *\\n * - `ids` and `values` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x6caffc9cfdc623eca9f87a686071708af5d5c17454d65022843fdddbc53c0cce\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\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 value of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the value of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens as the allowance of `spender` over the\\n * 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 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\\n * allowance mechanism. `value` 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 value) external returns (bool);\\n}\\n\",\"keccak256\":\"0xc6a8ff0ea489379b61faa647490411b80102578440ab9d84e9a957cc12164e70\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or\\n * {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the address zero.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5ef46daa3b58ef2702279d514780316efaa952915ee1aa3396f041ee2982b0b4\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x4296879f55019b23e135000eb36896057e7101fb7fb859c5ef690cf14643757b\",\"license\":\"MIT\"},\"contracts/common/InputEncoding.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 {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title Input Encoding Library\\n\\n/// @notice Defines the encoding of inputs added by core trustless and\\n/// permissionless contracts, such as portals.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Wei being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeEtherDeposit(\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-20 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param value The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeERC20Deposit(\\n IERC20 token,\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-721 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param tokenId The token identifier\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeERC721Deposit(\\n IERC721 token,\\n address sender,\\n uint256 tokenId,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 single token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenId The identifier of the token being transferred\\n /// @param value Transfer amount\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeSingleERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256 tokenId,\\n uint256 value,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n value, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 batch token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenIds The identifiers of the tokens being transferred\\n /// @param values Transfer amounts per token type\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeBatchERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256[] calldata tokenIds,\\n uint256[] calldata values,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(\\n tokenIds,\\n values,\\n baseLayerData,\\n execLayerData\\n );\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n data // arbitrary size\\n );\\n }\\n}\\n\",\"keccak256\":\"0x1a7e17a9739f27dd761234c388bc6ba30b4aacdf31fc750a29e5c11f0b08bcae\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputBox.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/// @notice Provides data availability of inputs for applications.\\n/// @notice Each application has its own append-only list of inputs.\\n/// @notice Off-chain, inputs can be retrieved via events.\\n/// @notice On-chain, only the input hashes are stored.\\n/// @notice See `LibInput` for more details on how such hashes are computed.\\ninterface IInputBox {\\n /// @notice MUST trigger when an input is added.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @param input The input blob\\n event InputAdded(\\n address indexed appContract,\\n uint256 indexed index,\\n bytes input\\n );\\n\\n /// @notice Input is too large.\\n /// @param appContract The application contract address\\n /// @param inputLength The input length\\n /// @param maxInputLength The maximum input length\\n error InputTooLarge(\\n address appContract,\\n uint256 inputLength,\\n uint256 maxInputLength\\n );\\n\\n /// @notice Send an input to an application.\\n /// @param appContract The application contract address\\n /// @param payload The input payload\\n /// @return The hash of the input blob\\n /// @dev MUST fire an `InputAdded` event.\\n function addInput(\\n address appContract,\\n bytes calldata payload\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs sent to an application.\\n /// @param appContract The application contract address\\n function getNumberOfInputs(\\n address appContract\\n ) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in an application's input box.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @dev The provided index must be valid.\\n function getInputHash(\\n address appContract,\\n uint256 index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xae7730cd7ab2b31a86d7c4933215853ea6c0b1b4dc60d4ec24e5cfc2ec005fe3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/ERC1155SinglePortal.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 {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\nimport {IERC1155SinglePortal} from \\\"./IERC1155SinglePortal.sol\\\";\\nimport {Portal} from \\\"./Portal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {InputEncoding} from \\\"../common/InputEncoding.sol\\\";\\n\\n/// @title ERC-1155 Single Transfer Portal\\n///\\n/// @notice This contract allows anyone to perform single transfers of\\n/// ERC-1155 tokens to an application contract while informing the off-chain machine.\\ncontract ERC1155SinglePortal is IERC1155SinglePortal, Portal {\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) Portal(inputBox) {}\\n\\n function depositSingleERC1155Token(\\n IERC1155 token,\\n address appContract,\\n uint256 tokenId,\\n uint256 value,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) external override {\\n token.safeTransferFrom(\\n msg.sender,\\n appContract,\\n tokenId,\\n value,\\n baseLayerData\\n );\\n\\n bytes memory payload = InputEncoding.encodeSingleERC1155Deposit(\\n token,\\n msg.sender,\\n tokenId,\\n value,\\n baseLayerData,\\n execLayerData\\n );\\n\\n _inputBox.addInput(appContract, payload);\\n }\\n}\\n\",\"keccak256\":\"0x4180bab75b3ecf0e7880ffc32dcaf658326d9fb02490523c2288a537a315606a\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IERC1155SinglePortal.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 {IPortal} from \\\"./IPortal.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title ERC-1155 Single Transfer Portal interface\\ninterface IERC1155SinglePortal is IPortal {\\n // Permissionless functions\\n\\n /// @notice Transfer ERC-1155 tokens of a single type to an application contract\\n /// and add an input to the application's input box to signal such operation.\\n ///\\n /// The caller must enable approval for the portal to manage all of their tokens\\n /// beforehand, by calling the `setApprovalForAll` function in the token contract.\\n ///\\n /// @param token The ERC-1155 token contract\\n /// @param appContract The application contract address\\n /// @param tokenId The identifier of the token being transferred\\n /// @param value Transfer amount\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n function depositSingleERC1155Token(\\n IERC1155 token,\\n address appContract,\\n uint256 tokenId,\\n uint256 value,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0x0e239fc05c89858218fb6e663ccb7c26171afe6be7e63d4ba93423cf823e445a\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IPortal.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 {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\n\\n/// @title Portal interface\\ninterface IPortal {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this portal.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x390bc7ed84639e38e40bef8085486119d6c42057f91f3ab8286a9246198682e2\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/Portal.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 {IPortal} from \\\"./IPortal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\n\\n/// @title Portal\\n/// @notice This contract serves as a base for all the other portals.\\ncontract Portal is IPortal {\\n /// @notice The input box used by the portal.\\n IInputBox internal immutable _inputBox;\\n\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) {\\n _inputBox = inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return _inputBox;\\n }\\n}\\n\",\"keccak256\":\"0x0597a118880f0fe29f38931452342e8294dafc3699100cbf3454b6c5faa5f48a\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", + "bytecode": "0x60a060405234801561001057600080fd5b5060405161054e38038061054e83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516104bd61009160003960008181603c015261012001526104bd6000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a578063dec07dca14610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a61008536600461026a565b61008c565b005b604051637921219560e11b81526001600160a01b0389169063f242432a906100c29033908b908b908b908b908b9060040161033b565b600060405180830381600087803b1580156100dc57600080fd5b505af11580156100f0573d6000803e3d6000fd5b50505050600061010689338989898989896101a6565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd6390610157908b9085906004016103a6565b6020604051808303816000875af1158015610176573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019a91906103e8565b50505050505050505050565b60606000858585856040516020016101c19493929190610401565b604051602081830303815290604052905089898989846040516020016101eb959493929190610433565b60405160208183030381529060405291505098975050505050505050565b6001600160a01b038116811461021e57600080fd5b50565b60008083601f84011261023357600080fd5b50813567ffffffffffffffff81111561024b57600080fd5b60208301915083602082850101111561026357600080fd5b9250929050565b60008060008060008060008060c0898b03121561028657600080fd5b883561029181610209565b975060208901356102a181610209565b96506040890135955060608901359450608089013567ffffffffffffffff808211156102cc57600080fd5b6102d88c838d01610221565b909650945060a08b01359150808211156102f157600080fd5b506102fe8b828c01610221565b999c989b5096995094979396929594505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03878116825286166020820152604081018590526060810184905260a0608082018190526000906103769083018486610312565b98975050505050505050565b60005b8381101561039d578181015183820152602001610385565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526103d3816060850160208701610382565b601f01601f1916919091016060019392505050565b6000602082840312156103fa57600080fd5b5051919050565b604081526000610415604083018688610312565b8281036020840152610428818587610312565b979650505050505050565b60006bffffffffffffffffffffffff19808860601b168352808760601b166014840152508460288301528360488301528251610476816068850160208701610382565b91909101606801969550505050505056fea2646970667358221220d41fd809f8973ec185f1d3497cbb7b9e865e5fedf38a2c16ada1c6b0ec7c11ee64736f6c63430008170033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a578063dec07dca14610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a61008536600461026a565b61008c565b005b604051637921219560e11b81526001600160a01b0389169063f242432a906100c29033908b908b908b908b908b9060040161033b565b600060405180830381600087803b1580156100dc57600080fd5b505af11580156100f0573d6000803e3d6000fd5b50505050600061010689338989898989896101a6565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd6390610157908b9085906004016103a6565b6020604051808303816000875af1158015610176573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019a91906103e8565b50505050505050505050565b60606000858585856040516020016101c19493929190610401565b604051602081830303815290604052905089898989846040516020016101eb959493929190610433565b60405160208183030381529060405291505098975050505050505050565b6001600160a01b038116811461021e57600080fd5b50565b60008083601f84011261023357600080fd5b50813567ffffffffffffffff81111561024b57600080fd5b60208301915083602082850101111561026357600080fd5b9250929050565b60008060008060008060008060c0898b03121561028657600080fd5b883561029181610209565b975060208901356102a181610209565b96506040890135955060608901359450608089013567ffffffffffffffff808211156102cc57600080fd5b6102d88c838d01610221565b909650945060a08b01359150808211156102f157600080fd5b506102fe8b828c01610221565b999c989b5096995094979396929594505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03878116825286166020820152604081018590526060810184905260a0608082018190526000906103769083018486610312565b98975050505050505050565b60005b8381101561039d578181015183820152602001610385565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526103d3816060850160208701610382565b601f01601f1916919091016060019392505050565b6000602082840312156103fa57600080fd5b5051919050565b604081526000610415604083018688610312565b8281036020840152610428818587610312565b979650505050505050565b60006bffffffffffffffffffffffff19808860601b168352808760601b166014840152508460288301528360488301528251610476816068850160208701610382565b91909101606801969550505050505056fea2646970667358221220d41fd809f8973ec185f1d3497cbb7b9e865e5fedf38a2c16ada1c6b0ec7c11ee64736f6c63430008170033", "devdoc": { "kind": "dev", "methods": { diff --git a/deployments/sepolia/ERC20Portal.json b/deployments/sepolia/ERC20Portal.json index 1f262af9..a851c2db 100644 --- a/deployments/sepolia/ERC20Portal.json +++ b/deployments/sepolia/ERC20Portal.json @@ -1,5 +1,5 @@ { - "address": "0x406f11E905D58E3DE4f7ff0DBe8e69d38BF496F2", + "address": "0xB0e28881FF7ee9CD5B1229d570540d74bce23D39", "abi": [ { "inputs": [ @@ -57,51 +57,32 @@ ], "stateMutability": "view", "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" } ], - "transactionHash": "0x7d6c4c7e8818bbafb20540117384a5fa7fc3893a0546bc94f11e95b5be220c30", + "transactionHash": "0xdcf8770360fa0764400d68df0aa6ac61e7ca5172561d227817c64c8722be9966", "receipt": { "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0xB25D9D56f5877Ca869A0362c324aCC2F1465AF1B", + "from": "0xeA4037a524309056545fbAd9A688f449E7e05ffB", "contractAddress": null, - "transactionIndex": 126, - "gasUsed": "308342", + "transactionIndex": 27, + "gasUsed": "269088", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x36c6439627f6d8bf2c54832269cc8b6dae07c1fe0b84ee4229574305233c6779", - "transactionHash": "0x7d6c4c7e8818bbafb20540117384a5fa7fc3893a0546bc94f11e95b5be220c30", + "blockHash": "0x02ec49ee9f2f61247496cce9b7cd6176cedbd6758d1201ff60af476e9dd1ba98", + "transactionHash": "0xdcf8770360fa0764400d68df0aa6ac61e7ca5172561d227817c64c8722be9966", "logs": [], - "blockNumber": 6099736, - "cumulativeGasUsed": "11559662", + "blockNumber": 6850936, + "cumulativeGasUsed": "4866979", "status": 1, "byzantium": true }, "args": [ - "0x58Df21fE097d4bE5dCf61e01d9ea3f6B81c2E1dB" + "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6" ], - "numDeployments": 8, - "solcInputHash": "d5e580c56a1973c1da5089d8c687e7bd", - "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"inputBox\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ERC20TransferFailed\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"execLayerData\",\"type\":\"bytes\"}],\"name\":\"depositERC20Tokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getInputBox\",\"outputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"inputBox\":\"The input box used by the portal\"}},\"depositERC20Tokens(address,address,uint256,bytes)\":{\"params\":{\"appContract\":\"The application contract address\",\"execLayerData\":\"Additional data to be interpreted by the execution layer\",\"token\":\"The ERC-20 token contract\",\"value\":\"The amount of tokens to be transferred\"}},\"getInputBox()\":{\"returns\":{\"_0\":\"The input box\"}}},\"title\":\"ERC-20 Portal\",\"version\":1},\"userdoc\":{\"errors\":{\"ERC20TransferFailed()\":[{\"notice\":\"Failed to transfer ERC-20 tokens to application\"}]},\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs the portal.\"},\"depositERC20Tokens(address,address,uint256,bytes)\":{\"notice\":\"Transfer ERC-20 tokens to an application contract and add an input to the application's input box to signal such operation. The caller must allow the portal to withdraw at least `value` tokens from their account beforehand, by calling the `approve` function in the token contract.\"},\"getInputBox()\":{\"notice\":\"Get the input box used by this portal.\"}},\"notice\":\"This contract allows anyone to perform transfers of ERC-20 tokens to an application contract while informing the off-chain machine.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/portals/ERC20Portal.sol\":\"ERC20Portal\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the value of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155Received} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `value` amount.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.\\n *\\n * Requirements:\\n *\\n * - `ids` and `values` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x6caffc9cfdc623eca9f87a686071708af5d5c17454d65022843fdddbc53c0cce\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\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 value of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the value of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens as the allowance of `spender` over the\\n * 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 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\\n * allowance mechanism. `value` 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 value) external returns (bool);\\n}\\n\",\"keccak256\":\"0xc6a8ff0ea489379b61faa647490411b80102578440ab9d84e9a957cc12164e70\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or\\n * {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the address zero.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5ef46daa3b58ef2702279d514780316efaa952915ee1aa3396f041ee2982b0b4\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0x9e8778b14317ba9e256c30a76fd6c32b960af621987f56069e1e819c77c6a133\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x4296879f55019b23e135000eb36896057e7101fb7fb859c5ef690cf14643757b\",\"license\":\"MIT\"},\"contracts/common/InputEncoding.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 {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title Input Encoding Library\\n\\n/// @notice Defines the encoding of inputs added by core trustless and\\n/// permissionless contracts, such as portals.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Wei being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeEtherDeposit(\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-20 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param value The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeERC20Deposit(\\n IERC20 token,\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-721 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param tokenId The token identifier\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeERC721Deposit(\\n IERC721 token,\\n address sender,\\n uint256 tokenId,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 single token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenId The identifier of the token being transferred\\n /// @param value Transfer amount\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeSingleERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256 tokenId,\\n uint256 value,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n value, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 batch token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenIds The identifiers of the tokens being transferred\\n /// @param values Transfer amounts per token type\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeBatchERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256[] calldata tokenIds,\\n uint256[] calldata values,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(\\n tokenIds,\\n values,\\n baseLayerData,\\n execLayerData\\n );\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n data // arbitrary size\\n );\\n }\\n}\\n\",\"keccak256\":\"0x1a7e17a9739f27dd761234c388bc6ba30b4aacdf31fc750a29e5c11f0b08bcae\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputBox.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/// @notice Provides data availability of inputs for applications.\\n/// @notice Each application has its own append-only list of inputs.\\n/// @notice Off-chain, inputs can be retrieved via events.\\n/// @notice On-chain, only the input hashes are stored.\\n/// @notice See `LibInput` for more details on how such hashes are computed.\\ninterface IInputBox {\\n /// @notice MUST trigger when an input is added.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @param input The input blob\\n event InputAdded(\\n address indexed appContract,\\n uint256 indexed index,\\n bytes input\\n );\\n\\n /// @notice Input is too large.\\n /// @param appContract The application contract address\\n /// @param inputLength The input length\\n /// @param maxInputLength The maximum input length\\n error InputTooLarge(\\n address appContract,\\n uint256 inputLength,\\n uint256 maxInputLength\\n );\\n\\n /// @notice Send an input to an application.\\n /// @param appContract The application contract address\\n /// @param payload The input payload\\n /// @return The hash of the input blob\\n /// @dev MUST fire an `InputAdded` event.\\n function addInput(\\n address appContract,\\n bytes calldata payload\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs sent to an application.\\n /// @param appContract The application contract address\\n function getNumberOfInputs(\\n address appContract\\n ) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in an application's input box.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @dev The provided index must be valid.\\n function getInputHash(\\n address appContract,\\n uint256 index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xae7730cd7ab2b31a86d7c4933215853ea6c0b1b4dc60d4ec24e5cfc2ec005fe3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/ERC20Portal.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 {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\nimport {IERC20Portal} from \\\"./IERC20Portal.sol\\\";\\nimport {Portal} from \\\"./Portal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {InputEncoding} from \\\"../common/InputEncoding.sol\\\";\\n\\n/// @title ERC-20 Portal\\n///\\n/// @notice This contract allows anyone to perform transfers of\\n/// ERC-20 tokens to an application contract while informing the off-chain machine.\\ncontract ERC20Portal is IERC20Portal, Portal {\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) Portal(inputBox) {}\\n\\n function depositERC20Tokens(\\n IERC20 token,\\n address appContract,\\n uint256 value,\\n bytes calldata execLayerData\\n ) external override {\\n bool success = token.transferFrom(msg.sender, appContract, value);\\n\\n if (!success) {\\n revert ERC20TransferFailed();\\n }\\n\\n bytes memory payload = InputEncoding.encodeERC20Deposit(\\n token,\\n msg.sender,\\n value,\\n execLayerData\\n );\\n\\n _inputBox.addInput(appContract, payload);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view virtual override(IERC165, Portal) returns (bool) {\\n return\\n interfaceId == type(IERC20Portal).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n}\\n\",\"keccak256\":\"0x53af74a92a1022620fd90d31dfaa43f4991f475fa576bdefffd8e719632a5b80\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IERC20Portal.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 {IPortal} from \\\"./IPortal.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title ERC-20 Portal interface\\ninterface IERC20Portal is IPortal {\\n // Errors\\n\\n /// @notice Failed to transfer ERC-20 tokens to application\\n error ERC20TransferFailed();\\n\\n // Permissionless functions\\n\\n /// @notice Transfer ERC-20 tokens to an application contract\\n /// and add an input to the application's input box to signal such operation.\\n ///\\n /// The caller must allow the portal to withdraw at least `value` tokens\\n /// from their account beforehand, by calling the `approve` function in the\\n /// token contract.\\n ///\\n /// @param token The ERC-20 token contract\\n /// @param appContract The application contract address\\n /// @param value The amount of tokens to be transferred\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n function depositERC20Tokens(\\n IERC20 token,\\n address appContract,\\n uint256 value,\\n bytes calldata execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0x21cec3e05b4901bdb2334b214437c9b588a547850a221b04a3a0a45dd6074aa0\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IPortal.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 {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\n/// @title Portal interface\\ninterface IPortal is IERC165 {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this portal.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0xbc364030939ea4a214e2f3673eaca1c500fcfd4929239a3b5d804ffc5687ed37\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/Portal.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 {IPortal} from \\\"./IPortal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {ERC165, IERC165} from \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\n/// @title Portal\\n/// @notice This contract serves as a base for all the other portals.\\ncontract Portal is IPortal, ERC165 {\\n /// @notice The input box used by the portal.\\n IInputBox internal immutable _inputBox;\\n\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) {\\n _inputBox = inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return _inputBox;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view virtual override(ERC165, IERC165) returns (bool) {\\n return\\n interfaceId == type(IPortal).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n}\\n\",\"keccak256\":\"0x0cd3da30a41e1085163195b99526cedced7665c89d291d287500d53e5160e5dc\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b5060405161052438038061052483398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b60805161049361009160003960008181605201526101aa01526104936000f3fe608060405234801561001057600080fd5b50600436106100405760003560e01c8062aace9a1461004557806301ffc9a71461008157806395854b81146100a4575b600080fd5b6040516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001681526020015b60405180910390f35b61009461008f366004610297565b6100b9565b6040519015158152602001610078565b6100b76100b23660046102e0565b6100e4565b005b60006001600160e01b031982166395854b8160e01b14806100de57506100de8261022e565b92915050565b6040516323b872dd60e01b81523360048201526001600160a01b03858116602483015260448201859052600091908716906323b872dd906064016020604051808303816000875af115801561013d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610161919061037f565b90508061018157604051633c9fd93960e21b815260040160405180910390fd5b60006101908733878787610262565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd63906101e190899085906004016103a1565b6020604051808303816000875af1158015610200573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102249190610400565b5050505050505050565b60006001600160e01b031982166255674d60e11b14806100de57506301ffc9a760e01b6001600160e01b03198316146100de565b6060858585858560405160200161027d959493929190610419565b604051602081830303815290604052905095945050505050565b6000602082840312156102a957600080fd5b81356001600160e01b0319811681146102c157600080fd5b9392505050565b6001600160a01b03811681146102dd57600080fd5b50565b6000806000806000608086880312156102f857600080fd5b8535610303816102c8565b94506020860135610313816102c8565b935060408601359250606086013567ffffffffffffffff8082111561033757600080fd5b818801915088601f83011261034b57600080fd5b81358181111561035a57600080fd5b89602082850101111561036c57600080fd5b9699959850939650602001949392505050565b60006020828403121561039157600080fd5b815180151581146102c157600080fd5b60018060a01b03831681526000602060406020840152835180604085015260005b818110156103de578581018301518582016060015282016103c2565b506000606082860101526060601f19601f830116850101925050509392505050565b60006020828403121561041257600080fd5b5051919050565b60006bffffffffffffffffffffffff19808860601b168352808760601b1660148401525084602883015282846048840137506000910160480190815294935050505056fea26469706673582212200792adba725da6a4f057cf11a16a67abc80d7fc58dd83dd8c1faaf643bf4168064736f6c63430008170033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100405760003560e01c8062aace9a1461004557806301ffc9a71461008157806395854b81146100a4575b600080fd5b6040516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001681526020015b60405180910390f35b61009461008f366004610297565b6100b9565b6040519015158152602001610078565b6100b76100b23660046102e0565b6100e4565b005b60006001600160e01b031982166395854b8160e01b14806100de57506100de8261022e565b92915050565b6040516323b872dd60e01b81523360048201526001600160a01b03858116602483015260448201859052600091908716906323b872dd906064016020604051808303816000875af115801561013d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610161919061037f565b90508061018157604051633c9fd93960e21b815260040160405180910390fd5b60006101908733878787610262565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd63906101e190899085906004016103a1565b6020604051808303816000875af1158015610200573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102249190610400565b5050505050505050565b60006001600160e01b031982166255674d60e11b14806100de57506301ffc9a760e01b6001600160e01b03198316146100de565b6060858585858560405160200161027d959493929190610419565b604051602081830303815290604052905095945050505050565b6000602082840312156102a957600080fd5b81356001600160e01b0319811681146102c157600080fd5b9392505050565b6001600160a01b03811681146102dd57600080fd5b50565b6000806000806000608086880312156102f857600080fd5b8535610303816102c8565b94506020860135610313816102c8565b935060408601359250606086013567ffffffffffffffff8082111561033757600080fd5b818801915088601f83011261034b57600080fd5b81358181111561035a57600080fd5b89602082850101111561036c57600080fd5b9699959850939650602001949392505050565b60006020828403121561039157600080fd5b815180151581146102c157600080fd5b60018060a01b03831681526000602060406020840152835180604085015260005b818110156103de578581018301518582016060015282016103c2565b506000606082860101526060601f19601f830116850101925050509392505050565b60006020828403121561041257600080fd5b5051919050565b60006bffffffffffffffffffffffff19808860601b168352808760601b1660148401525084602883015282846048840137506000910160480190815294935050505056fea26469706673582212200792adba725da6a4f057cf11a16a67abc80d7fc58dd83dd8c1faaf643bf4168064736f6c63430008170033", + "numDeployments": 9, + "solcInputHash": "8db616d9d86bc002576bd1bb74fd4f72", + "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"inputBox\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ERC20TransferFailed\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"execLayerData\",\"type\":\"bytes\"}],\"name\":\"depositERC20Tokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getInputBox\",\"outputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"inputBox\":\"The input box used by the portal\"}},\"depositERC20Tokens(address,address,uint256,bytes)\":{\"params\":{\"appContract\":\"The application contract address\",\"execLayerData\":\"Additional data to be interpreted by the execution layer\",\"token\":\"The ERC-20 token contract\",\"value\":\"The amount of tokens to be transferred\"}},\"getInputBox()\":{\"returns\":{\"_0\":\"The input box\"}}},\"title\":\"ERC-20 Portal\",\"version\":1},\"userdoc\":{\"errors\":{\"ERC20TransferFailed()\":[{\"notice\":\"Failed to transfer ERC-20 tokens to application\"}]},\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs the portal.\"},\"depositERC20Tokens(address,address,uint256,bytes)\":{\"notice\":\"Transfer ERC-20 tokens to an application contract and add an input to the application's input box to signal such operation. The caller must allow the portal to withdraw at least `value` tokens from their account beforehand, by calling the `approve` function in the token contract.\"},\"getInputBox()\":{\"notice\":\"Get the input box used by this portal.\"}},\"notice\":\"This contract allows anyone to perform transfers of ERC-20 tokens to an application contract while informing the off-chain machine.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/portals/ERC20Portal.sol\":\"ERC20Portal\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the value of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155Received} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `value` amount.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.\\n *\\n * Requirements:\\n *\\n * - `ids` and `values` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x6caffc9cfdc623eca9f87a686071708af5d5c17454d65022843fdddbc53c0cce\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\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 value of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the value of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens as the allowance of `spender` over the\\n * 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 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\\n * allowance mechanism. `value` 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 value) external returns (bool);\\n}\\n\",\"keccak256\":\"0xc6a8ff0ea489379b61faa647490411b80102578440ab9d84e9a957cc12164e70\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or\\n * {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the address zero.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5ef46daa3b58ef2702279d514780316efaa952915ee1aa3396f041ee2982b0b4\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x4296879f55019b23e135000eb36896057e7101fb7fb859c5ef690cf14643757b\",\"license\":\"MIT\"},\"contracts/common/InputEncoding.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 {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title Input Encoding Library\\n\\n/// @notice Defines the encoding of inputs added by core trustless and\\n/// permissionless contracts, such as portals.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Wei being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeEtherDeposit(\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-20 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param value The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeERC20Deposit(\\n IERC20 token,\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-721 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param tokenId The token identifier\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeERC721Deposit(\\n IERC721 token,\\n address sender,\\n uint256 tokenId,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 single token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenId The identifier of the token being transferred\\n /// @param value Transfer amount\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeSingleERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256 tokenId,\\n uint256 value,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n value, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 batch token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenIds The identifiers of the tokens being transferred\\n /// @param values Transfer amounts per token type\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeBatchERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256[] calldata tokenIds,\\n uint256[] calldata values,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(\\n tokenIds,\\n values,\\n baseLayerData,\\n execLayerData\\n );\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n data // arbitrary size\\n );\\n }\\n}\\n\",\"keccak256\":\"0x1a7e17a9739f27dd761234c388bc6ba30b4aacdf31fc750a29e5c11f0b08bcae\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputBox.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/// @notice Provides data availability of inputs for applications.\\n/// @notice Each application has its own append-only list of inputs.\\n/// @notice Off-chain, inputs can be retrieved via events.\\n/// @notice On-chain, only the input hashes are stored.\\n/// @notice See `LibInput` for more details on how such hashes are computed.\\ninterface IInputBox {\\n /// @notice MUST trigger when an input is added.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @param input The input blob\\n event InputAdded(\\n address indexed appContract,\\n uint256 indexed index,\\n bytes input\\n );\\n\\n /// @notice Input is too large.\\n /// @param appContract The application contract address\\n /// @param inputLength The input length\\n /// @param maxInputLength The maximum input length\\n error InputTooLarge(\\n address appContract,\\n uint256 inputLength,\\n uint256 maxInputLength\\n );\\n\\n /// @notice Send an input to an application.\\n /// @param appContract The application contract address\\n /// @param payload The input payload\\n /// @return The hash of the input blob\\n /// @dev MUST fire an `InputAdded` event.\\n function addInput(\\n address appContract,\\n bytes calldata payload\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs sent to an application.\\n /// @param appContract The application contract address\\n function getNumberOfInputs(\\n address appContract\\n ) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in an application's input box.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @dev The provided index must be valid.\\n function getInputHash(\\n address appContract,\\n uint256 index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xae7730cd7ab2b31a86d7c4933215853ea6c0b1b4dc60d4ec24e5cfc2ec005fe3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/ERC20Portal.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 {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {IERC20Portal} from \\\"./IERC20Portal.sol\\\";\\nimport {Portal} from \\\"./Portal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {InputEncoding} from \\\"../common/InputEncoding.sol\\\";\\n\\n/// @title ERC-20 Portal\\n///\\n/// @notice This contract allows anyone to perform transfers of\\n/// ERC-20 tokens to an application contract while informing the off-chain machine.\\ncontract ERC20Portal is IERC20Portal, Portal {\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) Portal(inputBox) {}\\n\\n function depositERC20Tokens(\\n IERC20 token,\\n address appContract,\\n uint256 value,\\n bytes calldata execLayerData\\n ) external override {\\n bool success = token.transferFrom(msg.sender, appContract, value);\\n\\n if (!success) {\\n revert ERC20TransferFailed();\\n }\\n\\n bytes memory payload = InputEncoding.encodeERC20Deposit(\\n token,\\n msg.sender,\\n value,\\n execLayerData\\n );\\n\\n _inputBox.addInput(appContract, payload);\\n }\\n}\\n\",\"keccak256\":\"0x4ae5d4ce43579aa46e86bf18a82d04dce812eeec7e89ad9aac88d510eefc6de8\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IERC20Portal.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 {IPortal} from \\\"./IPortal.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title ERC-20 Portal interface\\ninterface IERC20Portal is IPortal {\\n // Errors\\n\\n /// @notice Failed to transfer ERC-20 tokens to application\\n error ERC20TransferFailed();\\n\\n // Permissionless functions\\n\\n /// @notice Transfer ERC-20 tokens to an application contract\\n /// and add an input to the application's input box to signal such operation.\\n ///\\n /// The caller must allow the portal to withdraw at least `value` tokens\\n /// from their account beforehand, by calling the `approve` function in the\\n /// token contract.\\n ///\\n /// @param token The ERC-20 token contract\\n /// @param appContract The application contract address\\n /// @param value The amount of tokens to be transferred\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n function depositERC20Tokens(\\n IERC20 token,\\n address appContract,\\n uint256 value,\\n bytes calldata execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0x21cec3e05b4901bdb2334b214437c9b588a547850a221b04a3a0a45dd6074aa0\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IPortal.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 {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\n\\n/// @title Portal interface\\ninterface IPortal {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this portal.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x390bc7ed84639e38e40bef8085486119d6c42057f91f3ab8286a9246198682e2\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/Portal.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 {IPortal} from \\\"./IPortal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\n\\n/// @title Portal\\n/// @notice This contract serves as a base for all the other portals.\\ncontract Portal is IPortal {\\n /// @notice The input box used by the portal.\\n IInputBox internal immutable _inputBox;\\n\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) {\\n _inputBox = inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return _inputBox;\\n }\\n}\\n\",\"keccak256\":\"0x0597a118880f0fe29f38931452342e8294dafc3699100cbf3454b6c5faa5f48a\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", + "bytecode": "0x60a060405234801561001057600080fd5b5060405161046e38038061046e83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516103dd61009160003960008181603c015261015201526103dd6000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806395854b8114610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a610085366004610223565b61008c565b005b6040516323b872dd60e01b81523360048201526001600160a01b03858116602483015260448201859052600091908716906323b872dd906064016020604051808303816000875af11580156100e5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061010991906102c2565b90508061012957604051633c9fd93960e21b815260040160405180910390fd5b600061013887338787876101d6565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061018990899085906004016102eb565b6020604051808303816000875af11580156101a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101cc919061034a565b5050505050505050565b606085858585856040516020016101f1959493929190610363565b604051602081830303815290604052905095945050505050565b6001600160a01b038116811461022057600080fd5b50565b60008060008060006080868803121561023b57600080fd5b85356102468161020b565b945060208601356102568161020b565b935060408601359250606086013567ffffffffffffffff8082111561027a57600080fd5b818801915088601f83011261028e57600080fd5b81358181111561029d57600080fd5b8960208285010111156102af57600080fd5b9699959850939650602001949392505050565b6000602082840312156102d457600080fd5b815180151581146102e457600080fd5b9392505050565b60018060a01b03831681526000602060406020840152835180604085015260005b818110156103285785810183015185820160600152820161030c565b506000606082860101526060601f19601f830116850101925050509392505050565b60006020828403121561035c57600080fd5b5051919050565b60006bffffffffffffffffffffffff19808860601b168352808760601b1660148401525084602883015282846048840137506000910160480190815294935050505056fea26469706673582212206e9c57997e262a5573f4d46a834e8afe9777fcbdf098307d8711bdff9b91b3dd64736f6c63430008170033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806395854b8114610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a610085366004610223565b61008c565b005b6040516323b872dd60e01b81523360048201526001600160a01b03858116602483015260448201859052600091908716906323b872dd906064016020604051808303816000875af11580156100e5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061010991906102c2565b90508061012957604051633c9fd93960e21b815260040160405180910390fd5b600061013887338787876101d6565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061018990899085906004016102eb565b6020604051808303816000875af11580156101a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101cc919061034a565b5050505050505050565b606085858585856040516020016101f1959493929190610363565b604051602081830303815290604052905095945050505050565b6001600160a01b038116811461022057600080fd5b50565b60008060008060006080868803121561023b57600080fd5b85356102468161020b565b945060208601356102568161020b565b935060408601359250606086013567ffffffffffffffff8082111561027a57600080fd5b818801915088601f83011261028e57600080fd5b81358181111561029d57600080fd5b8960208285010111156102af57600080fd5b9699959850939650602001949392505050565b6000602082840312156102d457600080fd5b815180151581146102e457600080fd5b9392505050565b60018060a01b03831681526000602060406020840152835180604085015260005b818110156103285785810183015185820160600152820161030c565b506000606082860101526060601f19601f830116850101925050509392505050565b60006020828403121561035c57600080fd5b5051919050565b60006bffffffffffffffffffffffff19808860601b168352808760601b1660148401525084602883015282846048840137506000910160480190815294935050505056fea26469706673582212206e9c57997e262a5573f4d46a834e8afe9777fcbdf098307d8711bdff9b91b3dd64736f6c63430008170033", "devdoc": { "kind": "dev", "methods": { diff --git a/deployments/sepolia/ERC721Portal.json b/deployments/sepolia/ERC721Portal.json index 45f69a85..c9898a72 100644 --- a/deployments/sepolia/ERC721Portal.json +++ b/deployments/sepolia/ERC721Portal.json @@ -1,5 +1,5 @@ { - "address": "0x922a84c4a6dED3598Dd5E2b9c7575CF652049E3A", + "address": "0x874b3245ead7474Cb9f3b83cD1446dC522f6bd36", "abi": [ { "inputs": [ @@ -57,51 +57,32 @@ ], "stateMutability": "view", "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" } ], - "transactionHash": "0xa9cfbda4483913035ee0a693e1435717c54d65df46d214a4bde7383ba5763f96", + "transactionHash": "0xd326bebdf996cbb50dcaa855bc894e94521584385e3f2d6b42a0d1c35623c129", "receipt": { "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0xB25D9D56f5877Ca869A0362c324aCC2F1465AF1B", + "from": "0xeA4037a524309056545fbAd9A688f449E7e05ffB", "contractAddress": null, - "transactionIndex": 170, - "gasUsed": "349264", + "transactionIndex": 28, + "gasUsed": "308450", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x99f3c0159b264e48fe11dd4c48d84fa1a4bbc91c36925e97129bd3bf96c72780", - "transactionHash": "0xa9cfbda4483913035ee0a693e1435717c54d65df46d214a4bde7383ba5763f96", + "blockHash": "0x812730cc2168edb6b60dd2b2dd1065be0a8aa06d5d45613ca9875d4314d859c0", + "transactionHash": "0xd326bebdf996cbb50dcaa855bc894e94521584385e3f2d6b42a0d1c35623c129", "logs": [], - "blockNumber": 6099737, - "cumulativeGasUsed": "14868820", + "blockNumber": 6850937, + "cumulativeGasUsed": "7514155", "status": 1, "byzantium": true }, "args": [ - "0x58Df21fE097d4bE5dCf61e01d9ea3f6B81c2E1dB" + "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6" ], - "numDeployments": 8, - "solcInputHash": "d5e580c56a1973c1da5089d8c687e7bd", - "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"inputBox\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"contract IERC721\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"baseLayerData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"execLayerData\",\"type\":\"bytes\"}],\"name\":\"depositERC721Token\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getInputBox\",\"outputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"inputBox\":\"The input box used by the portal\"}},\"depositERC721Token(address,address,uint256,bytes,bytes)\":{\"params\":{\"appContract\":\"The application contract address\",\"baseLayerData\":\"Additional data to be interpreted by the base layer\",\"execLayerData\":\"Additional data to be interpreted by the execution layer\",\"token\":\"The ERC-721 token contract\",\"tokenId\":\"The identifier of the token being transferred\"}},\"getInputBox()\":{\"returns\":{\"_0\":\"The input box\"}}},\"title\":\"ERC-721 Portal\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs the portal.\"},\"depositERC721Token(address,address,uint256,bytes,bytes)\":{\"notice\":\"Transfer an ERC-721 token to an application contract and add an input to the application's input box to signal such operation. The caller must change the approved address for the ERC-721 token to the portal address beforehand, by calling the `approve` function in the token contract.\"},\"getInputBox()\":{\"notice\":\"Get the input box used by this portal.\"}},\"notice\":\"This contract allows anyone to perform transfers of ERC-721 tokens to an application contract while informing the off-chain machine.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/portals/ERC721Portal.sol\":\"ERC721Portal\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the value of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155Received} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `value` amount.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.\\n *\\n * Requirements:\\n *\\n * - `ids` and `values` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x6caffc9cfdc623eca9f87a686071708af5d5c17454d65022843fdddbc53c0cce\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\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 value of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the value of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens as the allowance of `spender` over the\\n * 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 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\\n * allowance mechanism. `value` 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 value) external returns (bool);\\n}\\n\",\"keccak256\":\"0xc6a8ff0ea489379b61faa647490411b80102578440ab9d84e9a957cc12164e70\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or\\n * {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the address zero.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5ef46daa3b58ef2702279d514780316efaa952915ee1aa3396f041ee2982b0b4\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0x9e8778b14317ba9e256c30a76fd6c32b960af621987f56069e1e819c77c6a133\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x4296879f55019b23e135000eb36896057e7101fb7fb859c5ef690cf14643757b\",\"license\":\"MIT\"},\"contracts/common/InputEncoding.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 {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title Input Encoding Library\\n\\n/// @notice Defines the encoding of inputs added by core trustless and\\n/// permissionless contracts, such as portals.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Wei being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeEtherDeposit(\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-20 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param value The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeERC20Deposit(\\n IERC20 token,\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-721 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param tokenId The token identifier\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeERC721Deposit(\\n IERC721 token,\\n address sender,\\n uint256 tokenId,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 single token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenId The identifier of the token being transferred\\n /// @param value Transfer amount\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeSingleERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256 tokenId,\\n uint256 value,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n value, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 batch token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenIds The identifiers of the tokens being transferred\\n /// @param values Transfer amounts per token type\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeBatchERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256[] calldata tokenIds,\\n uint256[] calldata values,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(\\n tokenIds,\\n values,\\n baseLayerData,\\n execLayerData\\n );\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n data // arbitrary size\\n );\\n }\\n}\\n\",\"keccak256\":\"0x1a7e17a9739f27dd761234c388bc6ba30b4aacdf31fc750a29e5c11f0b08bcae\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputBox.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/// @notice Provides data availability of inputs for applications.\\n/// @notice Each application has its own append-only list of inputs.\\n/// @notice Off-chain, inputs can be retrieved via events.\\n/// @notice On-chain, only the input hashes are stored.\\n/// @notice See `LibInput` for more details on how such hashes are computed.\\ninterface IInputBox {\\n /// @notice MUST trigger when an input is added.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @param input The input blob\\n event InputAdded(\\n address indexed appContract,\\n uint256 indexed index,\\n bytes input\\n );\\n\\n /// @notice Input is too large.\\n /// @param appContract The application contract address\\n /// @param inputLength The input length\\n /// @param maxInputLength The maximum input length\\n error InputTooLarge(\\n address appContract,\\n uint256 inputLength,\\n uint256 maxInputLength\\n );\\n\\n /// @notice Send an input to an application.\\n /// @param appContract The application contract address\\n /// @param payload The input payload\\n /// @return The hash of the input blob\\n /// @dev MUST fire an `InputAdded` event.\\n function addInput(\\n address appContract,\\n bytes calldata payload\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs sent to an application.\\n /// @param appContract The application contract address\\n function getNumberOfInputs(\\n address appContract\\n ) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in an application's input box.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @dev The provided index must be valid.\\n function getInputHash(\\n address appContract,\\n uint256 index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xae7730cd7ab2b31a86d7c4933215853ea6c0b1b4dc60d4ec24e5cfc2ec005fe3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/ERC721Portal.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 {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\nimport {IERC721Portal} from \\\"./IERC721Portal.sol\\\";\\nimport {Portal} from \\\"./Portal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {InputEncoding} from \\\"../common/InputEncoding.sol\\\";\\n\\n/// @title ERC-721 Portal\\n///\\n/// @notice This contract allows anyone to perform transfers of\\n/// ERC-721 tokens to an application contract while informing the off-chain machine.\\ncontract ERC721Portal is IERC721Portal, Portal {\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) Portal(inputBox) {}\\n\\n function depositERC721Token(\\n IERC721 token,\\n address appContract,\\n uint256 tokenId,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) external override {\\n token.safeTransferFrom(msg.sender, appContract, tokenId, baseLayerData);\\n\\n bytes memory payload = InputEncoding.encodeERC721Deposit(\\n token,\\n msg.sender,\\n tokenId,\\n baseLayerData,\\n execLayerData\\n );\\n\\n _inputBox.addInput(appContract, payload);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view virtual override(IERC165, Portal) returns (bool) {\\n return\\n interfaceId == type(IERC721Portal).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n}\\n\",\"keccak256\":\"0xf1c10d9a2960cfee7f80cc71750cb49d4706b8e7fcbd3ae393b268ac8f177430\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IERC721Portal.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 {IPortal} from \\\"./IPortal.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title ERC-721 Portal interface\\ninterface IERC721Portal is IPortal {\\n // Permissionless functions\\n\\n /// @notice Transfer an ERC-721 token to an application contract\\n /// and add an input to the application's input box to signal such operation.\\n ///\\n /// The caller must change the approved address for the ERC-721 token\\n /// to the portal address beforehand, by calling the `approve` function in the\\n /// token contract.\\n ///\\n /// @param token The ERC-721 token contract\\n /// @param appContract The application contract address\\n /// @param tokenId The identifier of the token being transferred\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n function depositERC721Token(\\n IERC721 token,\\n address appContract,\\n uint256 tokenId,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0x6efef50a83bbd007d4bdcc856227ebf781a937b692ddf60845f29a4ff9e52918\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IPortal.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 {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\n/// @title Portal interface\\ninterface IPortal is IERC165 {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this portal.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0xbc364030939ea4a214e2f3673eaca1c500fcfd4929239a3b5d804ffc5687ed37\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/Portal.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 {IPortal} from \\\"./IPortal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {ERC165, IERC165} from \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\n/// @title Portal\\n/// @notice This contract serves as a base for all the other portals.\\ncontract Portal is IPortal, ERC165 {\\n /// @notice The input box used by the portal.\\n IInputBox internal immutable _inputBox;\\n\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) {\\n _inputBox = inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return _inputBox;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view virtual override(ERC165, IERC165) returns (bool) {\\n return\\n interfaceId == type(IPortal).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n}\\n\",\"keccak256\":\"0x0cd3da30a41e1085163195b99526cedced7665c89d291d287500d53e5160e5dc\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b506040516105e13803806105e183398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b608051610550610091600039600081816052015261017501526105506000f3fe608060405234801561001057600080fd5b50600436106100405760003560e01c8062aace9a1461004557806301ffc9a71461008157806328911e83146100a4575b600080fd5b6040516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001681526020015b60405180910390f35b61009461008f36600461028e565b6100b9565b6040519015158152602001610078565b6100b76100b2366004610320565b6100e4565b005b60006001600160e01b031982166328911e8360e01b14806100de57506100de826101fa565b92915050565b604051635c46a7ef60e11b81526001600160a01b0388169063b88d4fde906101189033908a908a908a908a906004016103e8565b600060405180830381600087803b15801561013257600080fd5b505af1158015610146573d6000803e3d6000fd5b50505050600061015b8833888888888861022e565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd63906101ac908a90859060040161044b565b6020604051808303816000875af11580156101cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101ef919061048d565b505050505050505050565b60006001600160e01b031982166255674d60e11b14806100de57506301ffc9a760e01b6001600160e01b03198316146100de565b606060008585858560405160200161024994939291906104a6565b60405160208183030381529060405290508888888360405160200161027194939291906104cd565b604051602081830303815290604052915050979650505050505050565b6000602082840312156102a057600080fd5b81356001600160e01b0319811681146102b857600080fd5b9392505050565b6001600160a01b03811681146102d457600080fd5b50565b60008083601f8401126102e957600080fd5b50813567ffffffffffffffff81111561030157600080fd5b60208301915083602082850101111561031957600080fd5b9250929050565b600080600080600080600060a0888a03121561033b57600080fd5b8735610346816102bf565b96506020880135610356816102bf565b955060408801359450606088013567ffffffffffffffff8082111561037a57600080fd5b6103868b838c016102d7565b909650945060808a013591508082111561039f57600080fd5b506103ac8a828b016102d7565b989b979a50959850939692959293505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038681168252851660208201526040810184905260806060820181905260009061041c90830184866103bf565b979650505050505050565b60005b8381101561044257818101518382015260200161042a565b50506000910152565b60018060a01b03831681526040602082015260008251806040840152610478816060850160208701610427565b601f01601f1916919091016060019392505050565b60006020828403121561049f57600080fd5b5051919050565b6040815260006104ba6040830186886103bf565b828103602084015261041c8185876103bf565b60006bffffffffffffffffffffffff19808760601b168352808660601b16601484015250836028830152825161050a816048850160208701610427565b919091016048019594505050505056fea2646970667358221220f9f739ffb2a36e4d9099273b3917caf01e17d127729777d77dbad6a39366304864736f6c63430008170033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100405760003560e01c8062aace9a1461004557806301ffc9a71461008157806328911e83146100a4575b600080fd5b6040516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001681526020015b60405180910390f35b61009461008f36600461028e565b6100b9565b6040519015158152602001610078565b6100b76100b2366004610320565b6100e4565b005b60006001600160e01b031982166328911e8360e01b14806100de57506100de826101fa565b92915050565b604051635c46a7ef60e11b81526001600160a01b0388169063b88d4fde906101189033908a908a908a908a906004016103e8565b600060405180830381600087803b15801561013257600080fd5b505af1158015610146573d6000803e3d6000fd5b50505050600061015b8833888888888861022e565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd63906101ac908a90859060040161044b565b6020604051808303816000875af11580156101cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101ef919061048d565b505050505050505050565b60006001600160e01b031982166255674d60e11b14806100de57506301ffc9a760e01b6001600160e01b03198316146100de565b606060008585858560405160200161024994939291906104a6565b60405160208183030381529060405290508888888360405160200161027194939291906104cd565b604051602081830303815290604052915050979650505050505050565b6000602082840312156102a057600080fd5b81356001600160e01b0319811681146102b857600080fd5b9392505050565b6001600160a01b03811681146102d457600080fd5b50565b60008083601f8401126102e957600080fd5b50813567ffffffffffffffff81111561030157600080fd5b60208301915083602082850101111561031957600080fd5b9250929050565b600080600080600080600060a0888a03121561033b57600080fd5b8735610346816102bf565b96506020880135610356816102bf565b955060408801359450606088013567ffffffffffffffff8082111561037a57600080fd5b6103868b838c016102d7565b909650945060808a013591508082111561039f57600080fd5b506103ac8a828b016102d7565b989b979a50959850939692959293505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038681168252851660208201526040810184905260806060820181905260009061041c90830184866103bf565b979650505050505050565b60005b8381101561044257818101518382015260200161042a565b50506000910152565b60018060a01b03831681526040602082015260008251806040840152610478816060850160208701610427565b601f01601f1916919091016060019392505050565b60006020828403121561049f57600080fd5b5051919050565b6040815260006104ba6040830186886103bf565b828103602084015261041c8185876103bf565b60006bffffffffffffffffffffffff19808760601b168352808660601b16601484015250836028830152825161050a816048850160208701610427565b919091016048019594505050505056fea2646970667358221220f9f739ffb2a36e4d9099273b3917caf01e17d127729777d77dbad6a39366304864736f6c63430008170033", + "numDeployments": 9, + "solcInputHash": "8db616d9d86bc002576bd1bb74fd4f72", + "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"inputBox\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"contract IERC721\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"baseLayerData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"execLayerData\",\"type\":\"bytes\"}],\"name\":\"depositERC721Token\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getInputBox\",\"outputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"inputBox\":\"The input box used by the portal\"}},\"depositERC721Token(address,address,uint256,bytes,bytes)\":{\"params\":{\"appContract\":\"The application contract address\",\"baseLayerData\":\"Additional data to be interpreted by the base layer\",\"execLayerData\":\"Additional data to be interpreted by the execution layer\",\"token\":\"The ERC-721 token contract\",\"tokenId\":\"The identifier of the token being transferred\"}},\"getInputBox()\":{\"returns\":{\"_0\":\"The input box\"}}},\"title\":\"ERC-721 Portal\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs the portal.\"},\"depositERC721Token(address,address,uint256,bytes,bytes)\":{\"notice\":\"Transfer an ERC-721 token to an application contract and add an input to the application's input box to signal such operation. The caller must change the approved address for the ERC-721 token to the portal address beforehand, by calling the `approve` function in the token contract.\"},\"getInputBox()\":{\"notice\":\"Get the input box used by this portal.\"}},\"notice\":\"This contract allows anyone to perform transfers of ERC-721 tokens to an application contract while informing the off-chain machine.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/portals/ERC721Portal.sol\":\"ERC721Portal\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the value of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155Received} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `value` amount.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.\\n *\\n * Requirements:\\n *\\n * - `ids` and `values` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x6caffc9cfdc623eca9f87a686071708af5d5c17454d65022843fdddbc53c0cce\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\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 value of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the value of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens as the allowance of `spender` over the\\n * 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 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\\n * allowance mechanism. `value` 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 value) external returns (bool);\\n}\\n\",\"keccak256\":\"0xc6a8ff0ea489379b61faa647490411b80102578440ab9d84e9a957cc12164e70\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or\\n * {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the address zero.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5ef46daa3b58ef2702279d514780316efaa952915ee1aa3396f041ee2982b0b4\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x4296879f55019b23e135000eb36896057e7101fb7fb859c5ef690cf14643757b\",\"license\":\"MIT\"},\"contracts/common/InputEncoding.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 {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title Input Encoding Library\\n\\n/// @notice Defines the encoding of inputs added by core trustless and\\n/// permissionless contracts, such as portals.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Wei being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeEtherDeposit(\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-20 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param value The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeERC20Deposit(\\n IERC20 token,\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-721 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param tokenId The token identifier\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeERC721Deposit(\\n IERC721 token,\\n address sender,\\n uint256 tokenId,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 single token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenId The identifier of the token being transferred\\n /// @param value Transfer amount\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeSingleERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256 tokenId,\\n uint256 value,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n value, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 batch token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenIds The identifiers of the tokens being transferred\\n /// @param values Transfer amounts per token type\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeBatchERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256[] calldata tokenIds,\\n uint256[] calldata values,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(\\n tokenIds,\\n values,\\n baseLayerData,\\n execLayerData\\n );\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n data // arbitrary size\\n );\\n }\\n}\\n\",\"keccak256\":\"0x1a7e17a9739f27dd761234c388bc6ba30b4aacdf31fc750a29e5c11f0b08bcae\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputBox.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/// @notice Provides data availability of inputs for applications.\\n/// @notice Each application has its own append-only list of inputs.\\n/// @notice Off-chain, inputs can be retrieved via events.\\n/// @notice On-chain, only the input hashes are stored.\\n/// @notice See `LibInput` for more details on how such hashes are computed.\\ninterface IInputBox {\\n /// @notice MUST trigger when an input is added.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @param input The input blob\\n event InputAdded(\\n address indexed appContract,\\n uint256 indexed index,\\n bytes input\\n );\\n\\n /// @notice Input is too large.\\n /// @param appContract The application contract address\\n /// @param inputLength The input length\\n /// @param maxInputLength The maximum input length\\n error InputTooLarge(\\n address appContract,\\n uint256 inputLength,\\n uint256 maxInputLength\\n );\\n\\n /// @notice Send an input to an application.\\n /// @param appContract The application contract address\\n /// @param payload The input payload\\n /// @return The hash of the input blob\\n /// @dev MUST fire an `InputAdded` event.\\n function addInput(\\n address appContract,\\n bytes calldata payload\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs sent to an application.\\n /// @param appContract The application contract address\\n function getNumberOfInputs(\\n address appContract\\n ) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in an application's input box.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @dev The provided index must be valid.\\n function getInputHash(\\n address appContract,\\n uint256 index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xae7730cd7ab2b31a86d7c4933215853ea6c0b1b4dc60d4ec24e5cfc2ec005fe3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/ERC721Portal.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 {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\nimport {IERC721Portal} from \\\"./IERC721Portal.sol\\\";\\nimport {Portal} from \\\"./Portal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {InputEncoding} from \\\"../common/InputEncoding.sol\\\";\\n\\n/// @title ERC-721 Portal\\n///\\n/// @notice This contract allows anyone to perform transfers of\\n/// ERC-721 tokens to an application contract while informing the off-chain machine.\\ncontract ERC721Portal is IERC721Portal, Portal {\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) Portal(inputBox) {}\\n\\n function depositERC721Token(\\n IERC721 token,\\n address appContract,\\n uint256 tokenId,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) external override {\\n token.safeTransferFrom(msg.sender, appContract, tokenId, baseLayerData);\\n\\n bytes memory payload = InputEncoding.encodeERC721Deposit(\\n token,\\n msg.sender,\\n tokenId,\\n baseLayerData,\\n execLayerData\\n );\\n\\n _inputBox.addInput(appContract, payload);\\n }\\n}\\n\",\"keccak256\":\"0x7cd8a4f2e1d99940790a5d644965752f1ae257bbbefc7103d4be9e51730bad97\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IERC721Portal.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 {IPortal} from \\\"./IPortal.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title ERC-721 Portal interface\\ninterface IERC721Portal is IPortal {\\n // Permissionless functions\\n\\n /// @notice Transfer an ERC-721 token to an application contract\\n /// and add an input to the application's input box to signal such operation.\\n ///\\n /// The caller must change the approved address for the ERC-721 token\\n /// to the portal address beforehand, by calling the `approve` function in the\\n /// token contract.\\n ///\\n /// @param token The ERC-721 token contract\\n /// @param appContract The application contract address\\n /// @param tokenId The identifier of the token being transferred\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n function depositERC721Token(\\n IERC721 token,\\n address appContract,\\n uint256 tokenId,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0x6efef50a83bbd007d4bdcc856227ebf781a937b692ddf60845f29a4ff9e52918\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IPortal.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 {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\n\\n/// @title Portal interface\\ninterface IPortal {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this portal.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x390bc7ed84639e38e40bef8085486119d6c42057f91f3ab8286a9246198682e2\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/Portal.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 {IPortal} from \\\"./IPortal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\n\\n/// @title Portal\\n/// @notice This contract serves as a base for all the other portals.\\ncontract Portal is IPortal {\\n /// @notice The input box used by the portal.\\n IInputBox internal immutable _inputBox;\\n\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) {\\n _inputBox = inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return _inputBox;\\n }\\n}\\n\",\"keccak256\":\"0x0597a118880f0fe29f38931452342e8294dafc3699100cbf3454b6c5faa5f48a\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", + "bytecode": "0x60a060405234801561001057600080fd5b5060405161052438038061052483398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b60805161049361009160003960008181603c015261011d01526104936000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806328911e8314610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a610085366004610263565b61008c565b005b604051635c46a7ef60e11b81526001600160a01b0388169063b88d4fde906100c09033908a908a908a908a9060040161032b565b600060405180830381600087803b1580156100da57600080fd5b505af11580156100ee573d6000803e3d6000fd5b505050506000610103883388888888886101a2565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd6390610154908a90859060040161038e565b6020604051808303816000875af1158015610173573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019791906103d0565b505050505050505050565b60606000858585856040516020016101bd94939291906103e9565b6040516020818303038152906040529050888888836040516020016101e59493929190610410565b604051602081830303815290604052915050979650505050505050565b6001600160a01b038116811461021757600080fd5b50565b60008083601f84011261022c57600080fd5b50813567ffffffffffffffff81111561024457600080fd5b60208301915083602082850101111561025c57600080fd5b9250929050565b600080600080600080600060a0888a03121561027e57600080fd5b873561028981610202565b9650602088013561029981610202565b955060408801359450606088013567ffffffffffffffff808211156102bd57600080fd5b6102c98b838c0161021a565b909650945060808a01359150808211156102e257600080fd5b506102ef8a828b0161021a565b989b979a50959850939692959293505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038681168252851660208201526040810184905260806060820181905260009061035f9083018486610302565b979650505050505050565b60005b8381101561038557818101518382015260200161036d565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526103bb81606085016020870161036a565b601f01601f1916919091016060019392505050565b6000602082840312156103e257600080fd5b5051919050565b6040815260006103fd604083018688610302565b828103602084015261035f818587610302565b60006bffffffffffffffffffffffff19808760601b168352808660601b16601484015250836028830152825161044d81604885016020870161036a565b919091016048019594505050505056fea264697066735822122009038c6a3d5cfcce855ebe74770593d9af2426033a9dba50dac6b7c3ff7e335564736f6c63430008170033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806328911e8314610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a610085366004610263565b61008c565b005b604051635c46a7ef60e11b81526001600160a01b0388169063b88d4fde906100c09033908a908a908a908a9060040161032b565b600060405180830381600087803b1580156100da57600080fd5b505af11580156100ee573d6000803e3d6000fd5b505050506000610103883388888888886101a2565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd6390610154908a90859060040161038e565b6020604051808303816000875af1158015610173573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019791906103d0565b505050505050505050565b60606000858585856040516020016101bd94939291906103e9565b6040516020818303038152906040529050888888836040516020016101e59493929190610410565b604051602081830303815290604052915050979650505050505050565b6001600160a01b038116811461021757600080fd5b50565b60008083601f84011261022c57600080fd5b50813567ffffffffffffffff81111561024457600080fd5b60208301915083602082850101111561025c57600080fd5b9250929050565b600080600080600080600060a0888a03121561027e57600080fd5b873561028981610202565b9650602088013561029981610202565b955060408801359450606088013567ffffffffffffffff808211156102bd57600080fd5b6102c98b838c0161021a565b909650945060808a01359150808211156102e257600080fd5b506102ef8a828b0161021a565b989b979a50959850939692959293505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038681168252851660208201526040810184905260806060820181905260009061035f9083018486610302565b979650505050505050565b60005b8381101561038557818101518382015260200161036d565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526103bb81606085016020870161036a565b601f01601f1916919091016060019392505050565b6000602082840312156103e257600080fd5b5051919050565b6040815260006103fd604083018688610302565b828103602084015261035f818587610302565b60006bffffffffffffffffffffffff19808760601b168352808660601b16601484015250836028830152825161044d81604885016020870161036a565b919091016048019594505050505056fea264697066735822122009038c6a3d5cfcce855ebe74770593d9af2426033a9dba50dac6b7c3ff7e335564736f6c63430008170033", "devdoc": { "kind": "dev", "methods": { diff --git a/deployments/sepolia/EtherPortal.json b/deployments/sepolia/EtherPortal.json index 7f8c42c5..53c3a69f 100644 --- a/deployments/sepolia/EtherPortal.json +++ b/deployments/sepolia/EtherPortal.json @@ -1,5 +1,5 @@ { - "address": "0xa1D048Bf4231b532b866de31AD42443D38A7Dc5B", + "address": "0xfa2292f6D85ea4e629B156A4f99219e30D12EE17", "abi": [ { "inputs": [ @@ -47,51 +47,32 @@ ], "stateMutability": "view", "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" } ], - "transactionHash": "0xc520633eedc36fed0a332a72489908051693d397185730b1480b6a50d077cef3", + "transactionHash": "0x9ca23a79ea4ff97005b94cfd2daf7634694bc4e363e26d24cab8d0543d27282c", "receipt": { "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0xB25D9D56f5877Ca869A0362c324aCC2F1465AF1B", + "from": "0xeA4037a524309056545fbAd9A688f449E7e05ffB", "contractAddress": null, - "transactionIndex": 73, - "gasUsed": "281741", + "transactionIndex": 26, + "gasUsed": "238142", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xbb2e7da6b982faf35e147b17a5adcb283be2ba0903774f2da10b5cdd28159cbd", - "transactionHash": "0xc520633eedc36fed0a332a72489908051693d397185730b1480b6a50d077cef3", + "blockHash": "0x8c30d4b8c9581659d38216045c7d1542255b0a024051d211ec2be8df0733a039", + "transactionHash": "0x9ca23a79ea4ff97005b94cfd2daf7634694bc4e363e26d24cab8d0543d27282c", "logs": [], - "blockNumber": 6099598, - "cumulativeGasUsed": "8149966", + "blockNumber": 6850935, + "cumulativeGasUsed": "5130560", "status": 1, "byzantium": true }, "args": [ - "0x58Df21fE097d4bE5dCf61e01d9ea3f6B81c2E1dB" + "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6" ], - "numDeployments": 8, - "solcInputHash": "d5e580c56a1973c1da5089d8c687e7bd", - "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"inputBox\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"EtherTransferFailed\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"execLayerData\",\"type\":\"bytes\"}],\"name\":\"depositEther\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getInputBox\",\"outputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"inputBox\":\"The input box used by the portal\"}},\"depositEther(address,bytes)\":{\"details\":\"Any Ether sent through this function will be forwarded to the application contract. If the transfer fails, an `EtherTransferFailed` error will be raised.\",\"params\":{\"appContract\":\"The application contract address\",\"execLayerData\":\"Additional data to be interpreted by the execution layer\"}},\"getInputBox()\":{\"returns\":{\"_0\":\"The input box\"}}},\"title\":\"Ether Portal\",\"version\":1},\"userdoc\":{\"errors\":{\"EtherTransferFailed()\":[{\"notice\":\"Failed to transfer Ether to application\"}]},\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs the portal.\"},\"depositEther(address,bytes)\":{\"notice\":\"Transfer Ether to an application contract and add an input to the application's input box to signal such operation.\"},\"getInputBox()\":{\"notice\":\"Get the input box used by this portal.\"}},\"notice\":\"This contract allows anyone to perform transfers of Ether to an application contract while informing the off-chain machine.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/portals/EtherPortal.sol\":\"EtherPortal\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the value of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155Received} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `value` amount.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.\\n *\\n * Requirements:\\n *\\n * - `ids` and `values` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x6caffc9cfdc623eca9f87a686071708af5d5c17454d65022843fdddbc53c0cce\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\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 value of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the value of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens as the allowance of `spender` over the\\n * 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 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\\n * allowance mechanism. `value` 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 value) external returns (bool);\\n}\\n\",\"keccak256\":\"0xc6a8ff0ea489379b61faa647490411b80102578440ab9d84e9a957cc12164e70\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or\\n * {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the address zero.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5ef46daa3b58ef2702279d514780316efaa952915ee1aa3396f041ee2982b0b4\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0x9e8778b14317ba9e256c30a76fd6c32b960af621987f56069e1e819c77c6a133\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x4296879f55019b23e135000eb36896057e7101fb7fb859c5ef690cf14643757b\",\"license\":\"MIT\"},\"contracts/common/InputEncoding.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 {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title Input Encoding Library\\n\\n/// @notice Defines the encoding of inputs added by core trustless and\\n/// permissionless contracts, such as portals.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Wei being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeEtherDeposit(\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-20 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param value The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeERC20Deposit(\\n IERC20 token,\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-721 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param tokenId The token identifier\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeERC721Deposit(\\n IERC721 token,\\n address sender,\\n uint256 tokenId,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 single token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenId The identifier of the token being transferred\\n /// @param value Transfer amount\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeSingleERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256 tokenId,\\n uint256 value,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n value, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 batch token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenIds The identifiers of the tokens being transferred\\n /// @param values Transfer amounts per token type\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeBatchERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256[] calldata tokenIds,\\n uint256[] calldata values,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(\\n tokenIds,\\n values,\\n baseLayerData,\\n execLayerData\\n );\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n data // arbitrary size\\n );\\n }\\n}\\n\",\"keccak256\":\"0x1a7e17a9739f27dd761234c388bc6ba30b4aacdf31fc750a29e5c11f0b08bcae\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputBox.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/// @notice Provides data availability of inputs for applications.\\n/// @notice Each application has its own append-only list of inputs.\\n/// @notice Off-chain, inputs can be retrieved via events.\\n/// @notice On-chain, only the input hashes are stored.\\n/// @notice See `LibInput` for more details on how such hashes are computed.\\ninterface IInputBox {\\n /// @notice MUST trigger when an input is added.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @param input The input blob\\n event InputAdded(\\n address indexed appContract,\\n uint256 indexed index,\\n bytes input\\n );\\n\\n /// @notice Input is too large.\\n /// @param appContract The application contract address\\n /// @param inputLength The input length\\n /// @param maxInputLength The maximum input length\\n error InputTooLarge(\\n address appContract,\\n uint256 inputLength,\\n uint256 maxInputLength\\n );\\n\\n /// @notice Send an input to an application.\\n /// @param appContract The application contract address\\n /// @param payload The input payload\\n /// @return The hash of the input blob\\n /// @dev MUST fire an `InputAdded` event.\\n function addInput(\\n address appContract,\\n bytes calldata payload\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs sent to an application.\\n /// @param appContract The application contract address\\n function getNumberOfInputs(\\n address appContract\\n ) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in an application's input box.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @dev The provided index must be valid.\\n function getInputHash(\\n address appContract,\\n uint256 index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xae7730cd7ab2b31a86d7c4933215853ea6c0b1b4dc60d4ec24e5cfc2ec005fe3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/EtherPortal.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 {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\nimport {IEtherPortal} from \\\"./IEtherPortal.sol\\\";\\nimport {Portal} from \\\"./Portal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {InputEncoding} from \\\"../common/InputEncoding.sol\\\";\\n\\n/// @title Ether Portal\\n///\\n/// @notice This contract allows anyone to perform transfers of\\n/// Ether to an application contract while informing the off-chain machine.\\ncontract EtherPortal is IEtherPortal, Portal {\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) Portal(inputBox) {}\\n\\n function depositEther(\\n address appContract,\\n bytes calldata execLayerData\\n ) external payable override {\\n (bool success, ) = appContract.call{value: msg.value}(\\\"\\\");\\n\\n if (!success) {\\n revert EtherTransferFailed();\\n }\\n\\n bytes memory payload = InputEncoding.encodeEtherDeposit(\\n msg.sender,\\n msg.value,\\n execLayerData\\n );\\n\\n _inputBox.addInput(appContract, payload);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view virtual override(IERC165, Portal) returns (bool) {\\n return\\n interfaceId == type(IEtherPortal).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n}\\n\",\"keccak256\":\"0x2f5ecaf15045ff60f1bddca2fd3960e1125680ab8871133360381a9107a7583c\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IEtherPortal.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 {IPortal} from \\\"./IPortal.sol\\\";\\n\\n/// @title Ether Portal interface\\ninterface IEtherPortal is IPortal {\\n // Errors\\n\\n /// @notice Failed to transfer Ether to application\\n error EtherTransferFailed();\\n\\n // Permissionless functions\\n\\n /// @notice Transfer Ether to an application contract\\n /// and add an input to the application's input box to signal such operation.\\n ///\\n /// @param appContract The application contract address\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n ///\\n /// @dev Any Ether sent through this function will be forwarded to the application contract.\\n /// If the transfer fails, an `EtherTransferFailed` error will be raised.\\n function depositEther(\\n address appContract,\\n bytes calldata execLayerData\\n ) external payable;\\n}\\n\",\"keccak256\":\"0xfbb2628d07d5ac3a62e2aa7507be93a8ab68110985086c3af6d2e9e3bfcf4827\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IPortal.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 {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\n/// @title Portal interface\\ninterface IPortal is IERC165 {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this portal.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0xbc364030939ea4a214e2f3673eaca1c500fcfd4929239a3b5d804ffc5687ed37\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/Portal.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 {IPortal} from \\\"./IPortal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {ERC165, IERC165} from \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\n/// @title Portal\\n/// @notice This contract serves as a base for all the other portals.\\ncontract Portal is IPortal, ERC165 {\\n /// @notice The input box used by the portal.\\n IInputBox internal immutable _inputBox;\\n\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) {\\n _inputBox = inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return _inputBox;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view virtual override(ERC165, IERC165) returns (bool) {\\n return\\n interfaceId == type(IPortal).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n}\\n\",\"keccak256\":\"0x0cd3da30a41e1085163195b99526cedced7665c89d291d287500d53e5160e5dc\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b506040516104a93803806104a983398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b608051610418610091600039600081816052015261018d01526104186000f3fe6080604052600436106100335760003560e01c8062aace9a1461003857806301ffc9a714610081578063938c054f146100b1575b600080fd5b34801561004457600080fd5b506040516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001681526020015b60405180910390f35b34801561008d57600080fd5b506100a161009c366004610275565b6100c6565b6040519015158152602001610078565b6100c46100bf3660046102a6565b6100f1565b005b60006001600160e01b0319821663938c054f60e01b14806100eb57506100eb8261020f565b92915050565b6000836001600160a01b03163460405160006040518083038185875af1925050503d806000811461013e576040519150601f19603f3d011682016040523d82523d6000602084013e610143565b606091505b505090508061016557604051630ce8f45160e31b815260040160405180910390fd5b600061017333348686610243565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd63906101c49088908590600401610337565b6020604051808303816000875af11580156101e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102079190610396565b505050505050565b60006001600160e01b031982166255674d60e11b14806100eb57506301ffc9a760e01b6001600160e01b03198316146100eb565b60608484848460405160200161025c94939291906103af565b6040516020818303038152906040529050949350505050565b60006020828403121561028757600080fd5b81356001600160e01b03198116811461029f57600080fd5b9392505050565b6000806000604084860312156102bb57600080fd5b83356001600160a01b03811681146102d257600080fd5b9250602084013567ffffffffffffffff808211156102ef57600080fd5b818601915086601f83011261030357600080fd5b81358181111561031257600080fd5b87602082850101111561032457600080fd5b6020830194508093505050509250925092565b60018060a01b03831681526000602060406020840152835180604085015260005b8181101561037457858101830151858201606001528201610358565b506000606082860101526060601f19601f830116850101925050509392505050565b6000602082840312156103a857600080fd5b5051919050565b6bffffffffffffffffffffffff198560601b1681528360148201528183603483013760009101603401908152939250505056fea26469706673582212202588d293c24863bfdc388b1c9315c6b032777b3e65b354b40077d2036dc9b35964736f6c63430008170033", - "deployedBytecode": "0x6080604052600436106100335760003560e01c8062aace9a1461003857806301ffc9a714610081578063938c054f146100b1575b600080fd5b34801561004457600080fd5b506040516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001681526020015b60405180910390f35b34801561008d57600080fd5b506100a161009c366004610275565b6100c6565b6040519015158152602001610078565b6100c46100bf3660046102a6565b6100f1565b005b60006001600160e01b0319821663938c054f60e01b14806100eb57506100eb8261020f565b92915050565b6000836001600160a01b03163460405160006040518083038185875af1925050503d806000811461013e576040519150601f19603f3d011682016040523d82523d6000602084013e610143565b606091505b505090508061016557604051630ce8f45160e31b815260040160405180910390fd5b600061017333348686610243565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd63906101c49088908590600401610337565b6020604051808303816000875af11580156101e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102079190610396565b505050505050565b60006001600160e01b031982166255674d60e11b14806100eb57506301ffc9a760e01b6001600160e01b03198316146100eb565b60608484848460405160200161025c94939291906103af565b6040516020818303038152906040529050949350505050565b60006020828403121561028757600080fd5b81356001600160e01b03198116811461029f57600080fd5b9392505050565b6000806000604084860312156102bb57600080fd5b83356001600160a01b03811681146102d257600080fd5b9250602084013567ffffffffffffffff808211156102ef57600080fd5b818601915086601f83011261030357600080fd5b81358181111561031257600080fd5b87602082850101111561032457600080fd5b6020830194508093505050509250925092565b60018060a01b03831681526000602060406020840152835180604085015260005b8181101561037457858101830151858201606001528201610358565b506000606082860101526060601f19601f830116850101925050509392505050565b6000602082840312156103a857600080fd5b5051919050565b6bffffffffffffffffffffffff198560601b1681528360148201528183603483013760009101603401908152939250505056fea26469706673582212202588d293c24863bfdc388b1c9315c6b032777b3e65b354b40077d2036dc9b35964736f6c63430008170033", + "numDeployments": 9, + "solcInputHash": "8db616d9d86bc002576bd1bb74fd4f72", + "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"inputBox\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"EtherTransferFailed\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"execLayerData\",\"type\":\"bytes\"}],\"name\":\"depositEther\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getInputBox\",\"outputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"inputBox\":\"The input box used by the portal\"}},\"depositEther(address,bytes)\":{\"details\":\"Any Ether sent through this function will be forwarded to the application contract. If the transfer fails, an `EtherTransferFailed` error will be raised.\",\"params\":{\"appContract\":\"The application contract address\",\"execLayerData\":\"Additional data to be interpreted by the execution layer\"}},\"getInputBox()\":{\"returns\":{\"_0\":\"The input box\"}}},\"title\":\"Ether Portal\",\"version\":1},\"userdoc\":{\"errors\":{\"EtherTransferFailed()\":[{\"notice\":\"Failed to transfer Ether to application\"}]},\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs the portal.\"},\"depositEther(address,bytes)\":{\"notice\":\"Transfer Ether to an application contract and add an input to the application's input box to signal such operation.\"},\"getInputBox()\":{\"notice\":\"Get the input box used by this portal.\"}},\"notice\":\"This contract allows anyone to perform transfers of Ether to an application contract while informing the off-chain machine.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/portals/EtherPortal.sol\":\"EtherPortal\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the value of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155Received} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `value` amount.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.\\n *\\n * Requirements:\\n *\\n * - `ids` and `values` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x6caffc9cfdc623eca9f87a686071708af5d5c17454d65022843fdddbc53c0cce\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\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 value of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the value of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens as the allowance of `spender` over the\\n * 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 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\\n * allowance mechanism. `value` 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 value) external returns (bool);\\n}\\n\",\"keccak256\":\"0xc6a8ff0ea489379b61faa647490411b80102578440ab9d84e9a957cc12164e70\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or\\n * {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the address zero.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5ef46daa3b58ef2702279d514780316efaa952915ee1aa3396f041ee2982b0b4\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x4296879f55019b23e135000eb36896057e7101fb7fb859c5ef690cf14643757b\",\"license\":\"MIT\"},\"contracts/common/InputEncoding.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 {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title Input Encoding Library\\n\\n/// @notice Defines the encoding of inputs added by core trustless and\\n/// permissionless contracts, such as portals.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Wei being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeEtherDeposit(\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-20 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param value The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeERC20Deposit(\\n IERC20 token,\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-721 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param tokenId The token identifier\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeERC721Deposit(\\n IERC721 token,\\n address sender,\\n uint256 tokenId,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 single token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenId The identifier of the token being transferred\\n /// @param value Transfer amount\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeSingleERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256 tokenId,\\n uint256 value,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n value, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 batch token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenIds The identifiers of the tokens being transferred\\n /// @param values Transfer amounts per token type\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeBatchERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256[] calldata tokenIds,\\n uint256[] calldata values,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(\\n tokenIds,\\n values,\\n baseLayerData,\\n execLayerData\\n );\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n data // arbitrary size\\n );\\n }\\n}\\n\",\"keccak256\":\"0x1a7e17a9739f27dd761234c388bc6ba30b4aacdf31fc750a29e5c11f0b08bcae\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputBox.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/// @notice Provides data availability of inputs for applications.\\n/// @notice Each application has its own append-only list of inputs.\\n/// @notice Off-chain, inputs can be retrieved via events.\\n/// @notice On-chain, only the input hashes are stored.\\n/// @notice See `LibInput` for more details on how such hashes are computed.\\ninterface IInputBox {\\n /// @notice MUST trigger when an input is added.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @param input The input blob\\n event InputAdded(\\n address indexed appContract,\\n uint256 indexed index,\\n bytes input\\n );\\n\\n /// @notice Input is too large.\\n /// @param appContract The application contract address\\n /// @param inputLength The input length\\n /// @param maxInputLength The maximum input length\\n error InputTooLarge(\\n address appContract,\\n uint256 inputLength,\\n uint256 maxInputLength\\n );\\n\\n /// @notice Send an input to an application.\\n /// @param appContract The application contract address\\n /// @param payload The input payload\\n /// @return The hash of the input blob\\n /// @dev MUST fire an `InputAdded` event.\\n function addInput(\\n address appContract,\\n bytes calldata payload\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs sent to an application.\\n /// @param appContract The application contract address\\n function getNumberOfInputs(\\n address appContract\\n ) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in an application's input box.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @dev The provided index must be valid.\\n function getInputHash(\\n address appContract,\\n uint256 index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xae7730cd7ab2b31a86d7c4933215853ea6c0b1b4dc60d4ec24e5cfc2ec005fe3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/EtherPortal.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 {IEtherPortal} from \\\"./IEtherPortal.sol\\\";\\nimport {Portal} from \\\"./Portal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {InputEncoding} from \\\"../common/InputEncoding.sol\\\";\\n\\n/// @title Ether Portal\\n///\\n/// @notice This contract allows anyone to perform transfers of\\n/// Ether to an application contract while informing the off-chain machine.\\ncontract EtherPortal is IEtherPortal, Portal {\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) Portal(inputBox) {}\\n\\n function depositEther(\\n address appContract,\\n bytes calldata execLayerData\\n ) external payable override {\\n (bool success, ) = appContract.call{value: msg.value}(\\\"\\\");\\n\\n if (!success) {\\n revert EtherTransferFailed();\\n }\\n\\n bytes memory payload = InputEncoding.encodeEtherDeposit(\\n msg.sender,\\n msg.value,\\n execLayerData\\n );\\n\\n _inputBox.addInput(appContract, payload);\\n }\\n}\\n\",\"keccak256\":\"0x2dccf35f2991f89967925ab64c1484ac2615dfb7180f816ae6dc3463762377fb\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IEtherPortal.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 {IPortal} from \\\"./IPortal.sol\\\";\\n\\n/// @title Ether Portal interface\\ninterface IEtherPortal is IPortal {\\n // Errors\\n\\n /// @notice Failed to transfer Ether to application\\n error EtherTransferFailed();\\n\\n // Permissionless functions\\n\\n /// @notice Transfer Ether to an application contract\\n /// and add an input to the application's input box to signal such operation.\\n ///\\n /// @param appContract The application contract address\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n ///\\n /// @dev Any Ether sent through this function will be forwarded to the application contract.\\n /// If the transfer fails, an `EtherTransferFailed` error will be raised.\\n function depositEther(\\n address appContract,\\n bytes calldata execLayerData\\n ) external payable;\\n}\\n\",\"keccak256\":\"0xfbb2628d07d5ac3a62e2aa7507be93a8ab68110985086c3af6d2e9e3bfcf4827\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IPortal.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 {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\n\\n/// @title Portal interface\\ninterface IPortal {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this portal.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x390bc7ed84639e38e40bef8085486119d6c42057f91f3ab8286a9246198682e2\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/Portal.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 {IPortal} from \\\"./IPortal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\n\\n/// @title Portal\\n/// @notice This contract serves as a base for all the other portals.\\ncontract Portal is IPortal {\\n /// @notice The input box used by the portal.\\n IInputBox internal immutable _inputBox;\\n\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) {\\n _inputBox = inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return _inputBox;\\n }\\n}\\n\",\"keccak256\":\"0x0597a118880f0fe29f38931452342e8294dafc3699100cbf3454b6c5faa5f48a\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", + "bytecode": "0x60a060405234801561001057600080fd5b506040516103df3803806103df83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b60805161034e61009160003960008181603c0152610128015261034e6000f3fe6080604052600436106100285760003560e01c8062aace9a1461002d578063938c054f14610077575b600080fd5b34801561003957600080fd5b507f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a6100853660046101dc565b61008c565b005b6000836001600160a01b03163460405160006040518083038185875af1925050503d80600081146100d9576040519150601f19603f3d011682016040523d82523d6000602084013e6100de565b606091505b505090508061010057604051630ce8f45160e31b815260040160405180910390fd5b600061010e333486866101aa565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061015f908890859060040161026d565b6020604051808303816000875af115801561017e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a291906102cc565b505050505050565b6060848484846040516020016101c394939291906102e5565b6040516020818303038152906040529050949350505050565b6000806000604084860312156101f157600080fd5b83356001600160a01b038116811461020857600080fd5b9250602084013567ffffffffffffffff8082111561022557600080fd5b818601915086601f83011261023957600080fd5b81358181111561024857600080fd5b87602082850101111561025a57600080fd5b6020830194508093505050509250925092565b60018060a01b03831681526000602060406020840152835180604085015260005b818110156102aa5785810183015185820160600152820161028e565b506000606082860101526060601f19601f830116850101925050509392505050565b6000602082840312156102de57600080fd5b5051919050565b6bffffffffffffffffffffffff198560601b1681528360148201528183603483013760009101603401908152939250505056fea2646970667358221220e52bd9bc274e5c6b8dd2815a9a07e76c86edd92be566abb0729d8f7b78e6ca4664736f6c63430008170033", + "deployedBytecode": "0x6080604052600436106100285760003560e01c8062aace9a1461002d578063938c054f14610077575b600080fd5b34801561003957600080fd5b507f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a6100853660046101dc565b61008c565b005b6000836001600160a01b03163460405160006040518083038185875af1925050503d80600081146100d9576040519150601f19603f3d011682016040523d82523d6000602084013e6100de565b606091505b505090508061010057604051630ce8f45160e31b815260040160405180910390fd5b600061010e333486866101aa565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061015f908890859060040161026d565b6020604051808303816000875af115801561017e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a291906102cc565b505050505050565b6060848484846040516020016101c394939291906102e5565b6040516020818303038152906040529050949350505050565b6000806000604084860312156101f157600080fd5b83356001600160a01b038116811461020857600080fd5b9250602084013567ffffffffffffffff8082111561022557600080fd5b818601915086601f83011261023957600080fd5b81358181111561024857600080fd5b87602082850101111561025a57600080fd5b6020830194508093505050509250925092565b60018060a01b03831681526000602060406020840152835180604085015260005b818110156102aa5785810183015185820160600152820161028e565b506000606082860101526060601f19601f830116850101925050509392505050565b6000602082840312156102de57600080fd5b5051919050565b6bffffffffffffffffffffffff198560601b1681528360148201528183603483013760009101603401908152939250505056fea2646970667358221220e52bd9bc274e5c6b8dd2815a9a07e76c86edd92be566abb0729d8f7b78e6ca4664736f6c63430008170033", "devdoc": { "kind": "dev", "methods": { diff --git a/deployments/sepolia/InputBox.json b/deployments/sepolia/InputBox.json index 85ce8d96..2d3c599f 100644 --- a/deployments/sepolia/InputBox.json +++ b/deployments/sepolia/InputBox.json @@ -1,5 +1,5 @@ { - "address": "0x58Df21fE097d4bE5dCf61e01d9ea3f6B81c2E1dB", + "address": "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6", "abi": [ { "inputs": [ @@ -115,28 +115,28 @@ "type": "function" } ], - "transactionHash": "0x9f46e8647c1539745f80cd805310600ac56603eee6911b2d4841df43b0ecab01", + "transactionHash": "0x04cc7acd980738ce5854385a83d27e175e86ae6154768624907454573444f5da", "receipt": { "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0xB25D9D56f5877Ca869A0362c324aCC2F1465AF1B", + "from": "0xeA4037a524309056545fbAd9A688f449E7e05ffB", "contractAddress": null, - "transactionIndex": 66, + "transactionIndex": 55, "gasUsed": "275862", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x8d2a4536300d8478123833c0bfb0d8e10a0e668402bf0c68e578d5e023e5b793", - "transactionHash": "0x9f46e8647c1539745f80cd805310600ac56603eee6911b2d4841df43b0ecab01", + "blockHash": "0x71c64ba068730993f9626ece96ab04f816920b3f09d07832ad053e58839ead7e", + "transactionHash": "0x04cc7acd980738ce5854385a83d27e175e86ae6154768624907454573444f5da", "logs": [], - "blockNumber": 6099597, - "cumulativeGasUsed": "7188101", + "blockNumber": 6850934, + "cumulativeGasUsed": "9069402", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 7, - "solcInputHash": "d5e580c56a1973c1da5089d8c687e7bd", - "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"inputLength\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxInputLength\",\"type\":\"uint256\"}],\"name\":\"InputTooLarge\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"input\",\"type\":\"bytes\"}],\"name\":\"InputAdded\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"}],\"name\":\"addInput\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getInputHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"}],\"name\":\"getNumberOfInputs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"InputTooLarge(address,uint256,uint256)\":[{\"params\":{\"appContract\":\"The application contract address\",\"inputLength\":\"The input length\",\"maxInputLength\":\"The maximum input length\"}}]},\"events\":{\"InputAdded(address,uint256,bytes)\":{\"params\":{\"appContract\":\"The application contract address\",\"index\":\"The input index\",\"input\":\"The input blob\"}}},\"kind\":\"dev\",\"methods\":{\"addInput(address,bytes)\":{\"details\":\"MUST fire an `InputAdded` event.\",\"params\":{\"appContract\":\"The application contract address\",\"payload\":\"The input payload\"},\"returns\":{\"_0\":\"The hash of the input blob\"}},\"getInputHash(address,uint256)\":{\"details\":\"The provided index must be valid.\",\"params\":{\"appContract\":\"The application contract address\",\"index\":\"The input index\"}},\"getNumberOfInputs(address)\":{\"params\":{\"appContract\":\"The application contract address\"}}},\"version\":1},\"userdoc\":{\"errors\":{\"InputTooLarge(address,uint256,uint256)\":[{\"notice\":\"Input is too large.\"}]},\"events\":{\"InputAdded(address,uint256,bytes)\":{\"notice\":\"MUST trigger when an input is added.\"}},\"kind\":\"user\",\"methods\":{\"addInput(address,bytes)\":{\"notice\":\"Send an input to an application.\"},\"getInputHash(address,uint256)\":{\"notice\":\"Get the hash of an input in an application's input box.\"},\"getNumberOfInputs(address)\":{\"notice\":\"Get the number of inputs sent to an application.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/inputs/InputBox.sol\":\"InputBox\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/common/CanonicalMachine.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 Canonical Machine Constants Library\\n///\\n/// @notice Defines several constants related to the reference implementation\\n/// of the RISC-V machine that runs Linux, also known as the \\\"Cartesi Machine\\\".\\nlibrary CanonicalMachine {\\n /// @notice Maximum input size (2 megabytes).\\n uint256 constant INPUT_MAX_SIZE = 1 << 21;\\n\\n /// @notice Log of maximum number of inputs per epoch.\\n uint256 constant LOG2_MAX_INPUTS_PER_EPOCH = 32;\\n\\n /// @notice Log of maximum number of outputs per input.\\n uint256 constant LOG2_MAX_OUTPUTS_PER_INPUT = 16;\\n}\\n\",\"keccak256\":\"0xad91c1e0080fd40f53def31cb87106dedef26fc506aa569f43a77b8fcdc53a77\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/common/Inputs.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 Inputs\\n/// @notice Defines the signatures of inputs.\\ninterface Inputs {\\n /// @notice An advance request from an EVM-compatible blockchain to a Cartesi Machine.\\n /// @param chainId The chain ID\\n /// @param appContract The application contract address\\n /// @param msgSender The address of whoever sent the input\\n /// @param blockNumber The number of the block in which the input was added\\n /// @param blockTimestamp The timestamp of the block in which the input was added\\n /// @param prevRandao The latest RANDAO mix of the post beacon state of the previous block\\n /// @param index The index of the input in the input box\\n /// @param payload The payload provided by the message sender\\n /// @dev See EIP-4399 for safe usage of `prevRandao`.\\n function EvmAdvance(\\n uint256 chainId,\\n address appContract,\\n address msgSender,\\n uint256 blockNumber,\\n uint256 blockTimestamp,\\n uint256 prevRandao,\\n uint256 index,\\n bytes calldata payload\\n ) external;\\n}\\n\",\"keccak256\":\"0x7aecef1d525512ceb9daa886f8c4488e8221941ec928a0319827e50491eae053\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputBox.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/// @notice Provides data availability of inputs for applications.\\n/// @notice Each application has its own append-only list of inputs.\\n/// @notice Off-chain, inputs can be retrieved via events.\\n/// @notice On-chain, only the input hashes are stored.\\n/// @notice See `LibInput` for more details on how such hashes are computed.\\ninterface IInputBox {\\n /// @notice MUST trigger when an input is added.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @param input The input blob\\n event InputAdded(\\n address indexed appContract,\\n uint256 indexed index,\\n bytes input\\n );\\n\\n /// @notice Input is too large.\\n /// @param appContract The application contract address\\n /// @param inputLength The input length\\n /// @param maxInputLength The maximum input length\\n error InputTooLarge(\\n address appContract,\\n uint256 inputLength,\\n uint256 maxInputLength\\n );\\n\\n /// @notice Send an input to an application.\\n /// @param appContract The application contract address\\n /// @param payload The input payload\\n /// @return The hash of the input blob\\n /// @dev MUST fire an `InputAdded` event.\\n function addInput(\\n address appContract,\\n bytes calldata payload\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs sent to an application.\\n /// @param appContract The application contract address\\n function getNumberOfInputs(\\n address appContract\\n ) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in an application's input box.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @dev The provided index must be valid.\\n function getInputHash(\\n address appContract,\\n uint256 index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xae7730cd7ab2b31a86d7c4933215853ea6c0b1b4dc60d4ec24e5cfc2ec005fe3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/InputBox.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.18;\\n\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\nimport {CanonicalMachine} from \\\"../common/CanonicalMachine.sol\\\";\\nimport {Inputs} from \\\"../common/Inputs.sol\\\";\\n\\ncontract InputBox is IInputBox {\\n /// @notice Mapping of application contract addresses to arrays of input hashes.\\n mapping(address => bytes32[]) private _inputBoxes;\\n\\n /// @inheritdoc IInputBox\\n function addInput(\\n address appContract,\\n bytes calldata payload\\n ) external override returns (bytes32) {\\n bytes32[] storage inputBox = _inputBoxes[appContract];\\n\\n uint256 index = inputBox.length;\\n\\n bytes memory input = abi.encodeCall(\\n Inputs.EvmAdvance,\\n (\\n block.chainid,\\n appContract,\\n msg.sender,\\n block.number,\\n block.timestamp,\\n block.prevrandao,\\n index,\\n payload\\n )\\n );\\n\\n if (input.length > CanonicalMachine.INPUT_MAX_SIZE) {\\n revert InputTooLarge(\\n appContract,\\n input.length,\\n CanonicalMachine.INPUT_MAX_SIZE\\n );\\n }\\n\\n bytes32 inputHash = keccak256(input);\\n\\n inputBox.push(inputHash);\\n\\n emit InputAdded(appContract, index, input);\\n\\n return inputHash;\\n }\\n\\n /// @inheritdoc IInputBox\\n function getNumberOfInputs(\\n address appContract\\n ) external view override returns (uint256) {\\n return _inputBoxes[appContract].length;\\n }\\n\\n /// @inheritdoc IInputBox\\n function getInputHash(\\n address appContract,\\n uint256 index\\n ) external view override returns (bytes32) {\\n return _inputBoxes[appContract][index];\\n }\\n}\\n\",\"keccak256\":\"0x635160a90d6dcb47dc6f697093f7b1349621f1a7914b050f70d1983d7f67627e\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50610404806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80631789cd631461004657806361a93c871461006b578063677087c914610094575b600080fd5b610059610054366004610226565b6100a7565b60405190815260200160405180910390f35b6100596100793660046102a9565b6001600160a01b031660009081526020819052604090205490565b6100596100a23660046102cb565b6101cd565b6001600160a01b0383166000908152602081905260408082208054915190919083906100e79046908990339043904290449089908e908e906024016102f5565b60408051601f198184030181529190526020810180516001600160e01b031663415bf36360e01b179052805190915062200000101561015b5780516040516304f90dc560e51b81526001600160a01b0389166004820152602481019190915262200000604482015260640160405180910390fd5b8051602080830191909120845460018101865560008681529290922090910181905560405183906001600160a01b038a16907fc05d337121a6e8605c6ec0b72aa29c4210ffe6e5b9cefdd6a7058188a8f66f98906101ba908690610369565b60405180910390a3979650505050505050565b6001600160a01b03821660009081526020819052604081208054839081106101f7576101f76103b8565b9060005260206000200154905092915050565b80356001600160a01b038116811461022157600080fd5b919050565b60008060006040848603121561023b57600080fd5b6102448461020a565b9250602084013567ffffffffffffffff8082111561026157600080fd5b818601915086601f83011261027557600080fd5b81358181111561028457600080fd5b87602082850101111561029657600080fd5b6020830194508093505050509250925092565b6000602082840312156102bb57600080fd5b6102c48261020a565b9392505050565b600080604083850312156102de57600080fd5b6102e78361020a565b946020939093013593505050565b8981526001600160a01b03898116602083015288166040820152606081018790526080810186905260a0810185905260c0810184905261010060e08201819052810182905260006101208385828501376000838501820152601f909301601f19169091019091019998505050505050505050565b60006020808352835180602085015260005b818110156103975785810183015185820160400152820161037b565b506000604082860101526040601f19601f8301168501019250505092915050565b634e487b7160e01b600052603260045260246000fdfea2646970667358221220f8e6472972e1d1e5ce9415f785505a4597f00af72e0fca678c374a8bfe24119864736f6c63430008170033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80631789cd631461004657806361a93c871461006b578063677087c914610094575b600080fd5b610059610054366004610226565b6100a7565b60405190815260200160405180910390f35b6100596100793660046102a9565b6001600160a01b031660009081526020819052604090205490565b6100596100a23660046102cb565b6101cd565b6001600160a01b0383166000908152602081905260408082208054915190919083906100e79046908990339043904290449089908e908e906024016102f5565b60408051601f198184030181529190526020810180516001600160e01b031663415bf36360e01b179052805190915062200000101561015b5780516040516304f90dc560e51b81526001600160a01b0389166004820152602481019190915262200000604482015260640160405180910390fd5b8051602080830191909120845460018101865560008681529290922090910181905560405183906001600160a01b038a16907fc05d337121a6e8605c6ec0b72aa29c4210ffe6e5b9cefdd6a7058188a8f66f98906101ba908690610369565b60405180910390a3979650505050505050565b6001600160a01b03821660009081526020819052604081208054839081106101f7576101f76103b8565b9060005260206000200154905092915050565b80356001600160a01b038116811461022157600080fd5b919050565b60008060006040848603121561023b57600080fd5b6102448461020a565b9250602084013567ffffffffffffffff8082111561026157600080fd5b818601915086601f83011261027557600080fd5b81358181111561028457600080fd5b87602082850101111561029657600080fd5b6020830194508093505050509250925092565b6000602082840312156102bb57600080fd5b6102c48261020a565b9392505050565b600080604083850312156102de57600080fd5b6102e78361020a565b946020939093013593505050565b8981526001600160a01b03898116602083015288166040820152606081018790526080810186905260a0810185905260c0810184905261010060e08201819052810182905260006101208385828501376000838501820152601f909301601f19169091019091019998505050505050505050565b60006020808352835180602085015260005b818110156103975785810183015185820160400152820161037b565b506000604082860101526040601f19601f8301168501019250505092915050565b634e487b7160e01b600052603260045260246000fdfea2646970667358221220f8e6472972e1d1e5ce9415f785505a4597f00af72e0fca678c374a8bfe24119864736f6c63430008170033", + "numDeployments": 8, + "solcInputHash": "8db616d9d86bc002576bd1bb74fd4f72", + "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"inputLength\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxInputLength\",\"type\":\"uint256\"}],\"name\":\"InputTooLarge\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"input\",\"type\":\"bytes\"}],\"name\":\"InputAdded\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"}],\"name\":\"addInput\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getInputHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"}],\"name\":\"getNumberOfInputs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"InputTooLarge(address,uint256,uint256)\":[{\"params\":{\"appContract\":\"The application contract address\",\"inputLength\":\"The input length\",\"maxInputLength\":\"The maximum input length\"}}]},\"events\":{\"InputAdded(address,uint256,bytes)\":{\"params\":{\"appContract\":\"The application contract address\",\"index\":\"The input index\",\"input\":\"The input blob\"}}},\"kind\":\"dev\",\"methods\":{\"addInput(address,bytes)\":{\"details\":\"MUST fire an `InputAdded` event.\",\"params\":{\"appContract\":\"The application contract address\",\"payload\":\"The input payload\"},\"returns\":{\"_0\":\"The hash of the input blob\"}},\"getInputHash(address,uint256)\":{\"details\":\"The provided index must be valid.\",\"params\":{\"appContract\":\"The application contract address\",\"index\":\"The input index\"}},\"getNumberOfInputs(address)\":{\"params\":{\"appContract\":\"The application contract address\"}}},\"version\":1},\"userdoc\":{\"errors\":{\"InputTooLarge(address,uint256,uint256)\":[{\"notice\":\"Input is too large.\"}]},\"events\":{\"InputAdded(address,uint256,bytes)\":{\"notice\":\"MUST trigger when an input is added.\"}},\"kind\":\"user\",\"methods\":{\"addInput(address,bytes)\":{\"notice\":\"Send an input to an application.\"},\"getInputHash(address,uint256)\":{\"notice\":\"Get the hash of an input in an application's input box.\"},\"getNumberOfInputs(address)\":{\"notice\":\"Get the number of inputs sent to an application.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/inputs/InputBox.sol\":\"InputBox\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/common/CanonicalMachine.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 Canonical Machine Constants Library\\n///\\n/// @notice Defines several constants related to the reference implementation\\n/// of the RISC-V machine that runs Linux, also known as the \\\"Cartesi Machine\\\".\\nlibrary CanonicalMachine {\\n /// @notice Maximum input size (2 megabytes).\\n uint256 constant INPUT_MAX_SIZE = 1 << 21;\\n\\n /// @notice Log2 of maximum number of outputs.\\n uint256 constant LOG2_MAX_OUTPUTS = 63;\\n}\\n\",\"keccak256\":\"0xd433ed779b77fa74a86514a17eb76c9d4f250c5506a223541eb12963192d7ce0\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/common/Inputs.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 Inputs\\n/// @notice Defines the signatures of inputs.\\ninterface Inputs {\\n /// @notice An advance request from an EVM-compatible blockchain to a Cartesi Machine.\\n /// @param chainId The chain ID\\n /// @param appContract The application contract address\\n /// @param msgSender The address of whoever sent the input\\n /// @param blockNumber The number of the block in which the input was added\\n /// @param blockTimestamp The timestamp of the block in which the input was added\\n /// @param prevRandao The latest RANDAO mix of the post beacon state of the previous block\\n /// @param index The index of the input in the input box\\n /// @param payload The payload provided by the message sender\\n /// @dev See EIP-4399 for safe usage of `prevRandao`.\\n function EvmAdvance(\\n uint256 chainId,\\n address appContract,\\n address msgSender,\\n uint256 blockNumber,\\n uint256 blockTimestamp,\\n uint256 prevRandao,\\n uint256 index,\\n bytes calldata payload\\n ) external;\\n}\\n\",\"keccak256\":\"0x7aecef1d525512ceb9daa886f8c4488e8221941ec928a0319827e50491eae053\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputBox.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/// @notice Provides data availability of inputs for applications.\\n/// @notice Each application has its own append-only list of inputs.\\n/// @notice Off-chain, inputs can be retrieved via events.\\n/// @notice On-chain, only the input hashes are stored.\\n/// @notice See `LibInput` for more details on how such hashes are computed.\\ninterface IInputBox {\\n /// @notice MUST trigger when an input is added.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @param input The input blob\\n event InputAdded(\\n address indexed appContract,\\n uint256 indexed index,\\n bytes input\\n );\\n\\n /// @notice Input is too large.\\n /// @param appContract The application contract address\\n /// @param inputLength The input length\\n /// @param maxInputLength The maximum input length\\n error InputTooLarge(\\n address appContract,\\n uint256 inputLength,\\n uint256 maxInputLength\\n );\\n\\n /// @notice Send an input to an application.\\n /// @param appContract The application contract address\\n /// @param payload The input payload\\n /// @return The hash of the input blob\\n /// @dev MUST fire an `InputAdded` event.\\n function addInput(\\n address appContract,\\n bytes calldata payload\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs sent to an application.\\n /// @param appContract The application contract address\\n function getNumberOfInputs(\\n address appContract\\n ) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in an application's input box.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @dev The provided index must be valid.\\n function getInputHash(\\n address appContract,\\n uint256 index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xae7730cd7ab2b31a86d7c4933215853ea6c0b1b4dc60d4ec24e5cfc2ec005fe3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/InputBox.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.18;\\n\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\nimport {CanonicalMachine} from \\\"../common/CanonicalMachine.sol\\\";\\nimport {Inputs} from \\\"../common/Inputs.sol\\\";\\n\\ncontract InputBox is IInputBox {\\n /// @notice Mapping of application contract addresses to arrays of input hashes.\\n mapping(address => bytes32[]) private _inputBoxes;\\n\\n /// @inheritdoc IInputBox\\n function addInput(\\n address appContract,\\n bytes calldata payload\\n ) external override returns (bytes32) {\\n bytes32[] storage inputBox = _inputBoxes[appContract];\\n\\n uint256 index = inputBox.length;\\n\\n bytes memory input = abi.encodeCall(\\n Inputs.EvmAdvance,\\n (\\n block.chainid,\\n appContract,\\n msg.sender,\\n block.number,\\n block.timestamp,\\n block.prevrandao,\\n index,\\n payload\\n )\\n );\\n\\n if (input.length > CanonicalMachine.INPUT_MAX_SIZE) {\\n revert InputTooLarge(\\n appContract,\\n input.length,\\n CanonicalMachine.INPUT_MAX_SIZE\\n );\\n }\\n\\n bytes32 inputHash = keccak256(input);\\n\\n inputBox.push(inputHash);\\n\\n emit InputAdded(appContract, index, input);\\n\\n return inputHash;\\n }\\n\\n /// @inheritdoc IInputBox\\n function getNumberOfInputs(\\n address appContract\\n ) external view override returns (uint256) {\\n return _inputBoxes[appContract].length;\\n }\\n\\n /// @inheritdoc IInputBox\\n function getInputHash(\\n address appContract,\\n uint256 index\\n ) external view override returns (bytes32) {\\n return _inputBoxes[appContract][index];\\n }\\n}\\n\",\"keccak256\":\"0x635160a90d6dcb47dc6f697093f7b1349621f1a7914b050f70d1983d7f67627e\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610404806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80631789cd631461004657806361a93c871461006b578063677087c914610094575b600080fd5b610059610054366004610226565b6100a7565b60405190815260200160405180910390f35b6100596100793660046102a9565b6001600160a01b031660009081526020819052604090205490565b6100596100a23660046102cb565b6101cd565b6001600160a01b0383166000908152602081905260408082208054915190919083906100e79046908990339043904290449089908e908e906024016102f5565b60408051601f198184030181529190526020810180516001600160e01b031663415bf36360e01b179052805190915062200000101561015b5780516040516304f90dc560e51b81526001600160a01b0389166004820152602481019190915262200000604482015260640160405180910390fd5b8051602080830191909120845460018101865560008681529290922090910181905560405183906001600160a01b038a16907fc05d337121a6e8605c6ec0b72aa29c4210ffe6e5b9cefdd6a7058188a8f66f98906101ba908690610369565b60405180910390a3979650505050505050565b6001600160a01b03821660009081526020819052604081208054839081106101f7576101f76103b8565b9060005260206000200154905092915050565b80356001600160a01b038116811461022157600080fd5b919050565b60008060006040848603121561023b57600080fd5b6102448461020a565b9250602084013567ffffffffffffffff8082111561026157600080fd5b818601915086601f83011261027557600080fd5b81358181111561028457600080fd5b87602082850101111561029657600080fd5b6020830194508093505050509250925092565b6000602082840312156102bb57600080fd5b6102c48261020a565b9392505050565b600080604083850312156102de57600080fd5b6102e78361020a565b946020939093013593505050565b8981526001600160a01b03898116602083015288166040820152606081018790526080810186905260a0810185905260c0810184905261010060e08201819052810182905260006101208385828501376000838501820152601f909301601f19169091019091019998505050505050505050565b60006020808352835180602085015260005b818110156103975785810183015185820160400152820161037b565b506000604082860101526040601f19601f8301168501019250505092915050565b634e487b7160e01b600052603260045260246000fdfea26469706673582212203788fdfb8b6a2c0572bcd866dab8de747866dc2030920f38cce6fb32a7b57abc64736f6c63430008170033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80631789cd631461004657806361a93c871461006b578063677087c914610094575b600080fd5b610059610054366004610226565b6100a7565b60405190815260200160405180910390f35b6100596100793660046102a9565b6001600160a01b031660009081526020819052604090205490565b6100596100a23660046102cb565b6101cd565b6001600160a01b0383166000908152602081905260408082208054915190919083906100e79046908990339043904290449089908e908e906024016102f5565b60408051601f198184030181529190526020810180516001600160e01b031663415bf36360e01b179052805190915062200000101561015b5780516040516304f90dc560e51b81526001600160a01b0389166004820152602481019190915262200000604482015260640160405180910390fd5b8051602080830191909120845460018101865560008681529290922090910181905560405183906001600160a01b038a16907fc05d337121a6e8605c6ec0b72aa29c4210ffe6e5b9cefdd6a7058188a8f66f98906101ba908690610369565b60405180910390a3979650505050505050565b6001600160a01b03821660009081526020819052604081208054839081106101f7576101f76103b8565b9060005260206000200154905092915050565b80356001600160a01b038116811461022157600080fd5b919050565b60008060006040848603121561023b57600080fd5b6102448461020a565b9250602084013567ffffffffffffffff8082111561026157600080fd5b818601915086601f83011261027557600080fd5b81358181111561028457600080fd5b87602082850101111561029657600080fd5b6020830194508093505050509250925092565b6000602082840312156102bb57600080fd5b6102c48261020a565b9392505050565b600080604083850312156102de57600080fd5b6102e78361020a565b946020939093013593505050565b8981526001600160a01b03898116602083015288166040820152606081018790526080810186905260a0810185905260c0810184905261010060e08201819052810182905260006101208385828501376000838501820152601f909301601f19169091019091019998505050505050505050565b60006020808352835180602085015260005b818110156103975785810183015185820160400152820161037b565b506000604082860101526040601f19601f8301168501019250505092915050565b634e487b7160e01b600052603260045260246000fdfea26469706673582212203788fdfb8b6a2c0572bcd866dab8de747866dc2030920f38cce6fb32a7b57abc64736f6c63430008170033", "devdoc": { "errors": { "InputTooLarge(address,uint256,uint256)": [ @@ -215,7 +215,7 @@ "storageLayout": { "storage": [ { - "astId": 3859, + "astId": 3594, "contract": "contracts/inputs/InputBox.sol:InputBox", "label": "_inputBoxes", "offset": 0, diff --git a/deployments/sepolia/QuorumFactory.json b/deployments/sepolia/QuorumFactory.json index 271e4127..44e9089a 100644 --- a/deployments/sepolia/QuorumFactory.json +++ b/deployments/sepolia/QuorumFactory.json @@ -1,12 +1,12 @@ { - "address": "0xB41851d69891748b27779e382cc8de6e8C128e1C", + "address": "0x22AFD9162079c7Ac0aF874054298Bf46F29157F1", "abi": [ { "anonymous": false, "inputs": [ { "indexed": false, - "internalType": "contract Quorum", + "internalType": "contract IQuorum", "name": "quorum", "type": "address" } @@ -21,6 +21,11 @@ "name": "validators", "type": "address[]" }, + { + "internalType": "uint256", + "name": "epochLength", + "type": "uint256" + }, { "internalType": "bytes32", "name": "salt", @@ -44,12 +49,22 @@ "internalType": "address[]", "name": "validators", "type": "address[]" + }, + { + "internalType": "uint256", + "name": "epochLength", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" } ], "name": "newQuorum", "outputs": [ { - "internalType": "contract Quorum", + "internalType": "contract IQuorum", "name": "", "type": "address" } @@ -65,15 +80,15 @@ "type": "address[]" }, { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" + "internalType": "uint256", + "name": "epochLength", + "type": "uint256" } ], "name": "newQuorum", "outputs": [ { - "internalType": "contract Quorum", + "internalType": "contract IQuorum", "name": "", "type": "address" } @@ -82,28 +97,28 @@ "type": "function" } ], - "transactionHash": "0x62c5c32c87a0908fd95f3a4b142244ae6f695b029631fd68382c28a096c21e2c", + "transactionHash": "0x55e2aba0d58418dee2a8aa0b9ed7987bf68a425edf0123329cd01410f4148173", "receipt": { "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0xB25D9D56f5877Ca869A0362c324aCC2F1465AF1B", + "from": "0xeA4037a524309056545fbAd9A688f449E7e05ffB", "contractAddress": null, - "transactionIndex": 102, - "gasUsed": "792878", + "transactionIndex": 20, + "gasUsed": "747585", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x1ebf5c5d78217f24624a634383b6cd80d0e6e5ebae294aed1984ce2afb8c1253", - "transactionHash": "0x62c5c32c87a0908fd95f3a4b142244ae6f695b029631fd68382c28a096c21e2c", + "blockHash": "0xe207835cf5a874030118c49318edeab1018f4670774fd7770d586aa169a0e6c8", + "transactionHash": "0x55e2aba0d58418dee2a8aa0b9ed7987bf68a425edf0123329cd01410f4148173", "logs": [], - "blockNumber": 6099741, - "cumulativeGasUsed": "10105978", + "blockNumber": 6850942, + "cumulativeGasUsed": "5170571", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 1, - "solcInputHash": "d5e580c56a1973c1da5089d8c687e7bd", - "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract Quorum\",\"name\":\"quorum\",\"type\":\"address\"}],\"name\":\"QuorumCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"validators\",\"type\":\"address[]\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"}],\"name\":\"calculateQuorumAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"validators\",\"type\":\"address[]\"}],\"name\":\"newQuorum\",\"outputs\":[{\"internalType\":\"contract Quorum\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"validators\",\"type\":\"address[]\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"}],\"name\":\"newQuorum\",\"outputs\":[{\"internalType\":\"contract Quorum\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"QuorumCreated(address)\":{\"details\":\"MUST be triggered on a successful call to `newQuorum`.\",\"params\":{\"quorum\":\"The quorum\"}}},\"kind\":\"dev\",\"methods\":{\"calculateQuorumAddress(address[],bytes32)\":{\"details\":\"Beware that only the `newQuorum` function with the `salt` parameter is able to deterministically deploy a quorum.\",\"params\":{\"salt\":\"The salt used to deterministically generate the quorum address\",\"validators\":\"the list of validators\"},\"returns\":{\"_0\":\"The deterministic quorum address\"}},\"newQuorum(address[])\":{\"details\":\"On success, MUST emit a `QuorumCreated` event.\",\"params\":{\"validators\":\"the list of validators\"},\"returns\":{\"_0\":\"The quorum\"}},\"newQuorum(address[],bytes32)\":{\"details\":\"On success, MUST emit a `QuorumCreated` event.\",\"params\":{\"salt\":\"The salt used to deterministically generate the quorum address\",\"validators\":\"the list of validators\"},\"returns\":{\"_0\":\"The quorum\"}}},\"title\":\"Quorum Factory\",\"version\":1},\"userdoc\":{\"events\":{\"QuorumCreated(address)\":{\"notice\":\"A new quorum was deployed.\"}},\"kind\":\"user\",\"methods\":{\"calculateQuorumAddress(address[],bytes32)\":{\"notice\":\"Calculate the address of a quorum to be deployed deterministically.\"},\"newQuorum(address[])\":{\"notice\":\"Deploy a new quorum.\"},\"newQuorum(address[],bytes32)\":{\"notice\":\"Deploy a new quorum deterministically.\"}},\"notice\":\"Allows anyone to reliably deploy a new `Quorum` contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/consensus/quorum/QuorumFactory.sol\":\"QuorumFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Not enough balance for performing a CREATE2 deploy.\\n */\\n error Create2InsufficientBalance(uint256 balance, uint256 needed);\\n\\n /**\\n * @dev There's no code to deploy.\\n */\\n error Create2EmptyBytecode();\\n\\n /**\\n * @dev The deployment failed.\\n */\\n error Create2FailedDeployment();\\n\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\\n if (address(this).balance < amount) {\\n revert Create2InsufficientBalance(address(this).balance, amount);\\n }\\n if (bytecode.length == 0) {\\n revert Create2EmptyBytecode();\\n }\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n if (addr == address(0)) {\\n revert Create2FailedDeployment();\\n }\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2b9807d194b92f1068d868e9587d27037264a9a067c778486f86ae21c61cbd5e\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/structs/BitMaps.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/BitMaps.sol)\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Library for managing uint256 to bool mapping in a compact and efficient way, provided the keys are sequential.\\n * Largely inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor].\\n *\\n * BitMaps pack 256 booleans across each bit of a single 256-bit slot of `uint256` type.\\n * Hence booleans corresponding to 256 _sequential_ indices would only consume a single slot,\\n * unlike the regular `bool` which would consume an entire slot for a single value.\\n *\\n * This results in gas savings in two ways:\\n *\\n * - Setting a zero value to non-zero only once every 256 times\\n * - Accessing the same warm slot for every 256 _sequential_ indices\\n */\\nlibrary BitMaps {\\n struct BitMap {\\n mapping(uint256 bucket => uint256) _data;\\n }\\n\\n /**\\n * @dev Returns whether the bit at `index` is set.\\n */\\n function get(BitMap storage bitmap, uint256 index) internal view returns (bool) {\\n uint256 bucket = index >> 8;\\n uint256 mask = 1 << (index & 0xff);\\n return bitmap._data[bucket] & mask != 0;\\n }\\n\\n /**\\n * @dev Sets the bit at `index` to the boolean `value`.\\n */\\n function setTo(BitMap storage bitmap, uint256 index, bool value) internal {\\n if (value) {\\n set(bitmap, index);\\n } else {\\n unset(bitmap, index);\\n }\\n }\\n\\n /**\\n * @dev Sets the bit at `index`.\\n */\\n function set(BitMap storage bitmap, uint256 index) internal {\\n uint256 bucket = index >> 8;\\n uint256 mask = 1 << (index & 0xff);\\n bitmap._data[bucket] |= mask;\\n }\\n\\n /**\\n * @dev Unsets the bit at `index`.\\n */\\n function unset(BitMap storage bitmap, uint256 index) internal {\\n uint256 bucket = index >> 8;\\n uint256 mask = 1 << (index & 0xff);\\n bitmap._data[bucket] &= ~mask;\\n }\\n}\\n\",\"keccak256\":\"0x3616f1b0d0a9ee1ca8f0953ecaceb9230e36f691c7974d30f964212acff52d2b\",\"license\":\"MIT\"},\"contracts/common/InputRange.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/// @notice A range of input indices.\\n/// @param firstIndex The index of the first input\\n/// @param lastIndex The index of the last input\\nstruct InputRange {\\n uint64 firstIndex;\\n uint64 lastIndex;\\n}\\n\",\"keccak256\":\"0x4825516380f1fb39d5b15e99c1b08e07c636dc062ad3036093e78ba8e624cd33\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"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\\\";\\nimport {InputRange} from \\\"../common/InputRange.sol\\\";\\n\\n/// @notice Stores epoch hashes for several applications and input ranges.\\n/// @dev This contract was designed to be inherited by implementations of the `IConsensus` interface\\n/// that only need a simple mechanism of storage and retrieval of epoch hashes.\\nabstract contract AbstractConsensus is IConsensus {\\n /// @notice Indexes epoch hashes by application contract address, first input index and last input index.\\n mapping(address => mapping(uint256 => mapping(uint256 => bytes32)))\\n private _epochHashes;\\n\\n /// @notice Get the epoch hash for a certain application and input range.\\n /// @param appContract The application contract address\\n /// @param r The input range\\n /// @return epochHash The epoch hash\\n /// @dev For claimed epochs, returns the epoch hash of the last accepted claim.\\n /// @dev For unclaimed epochs, returns `bytes32(0)`.\\n function getEpochHash(\\n address appContract,\\n InputRange calldata r\\n ) public view override returns (bytes32 epochHash) {\\n epochHash = _epochHashes[appContract][r.firstIndex][r.lastIndex];\\n }\\n\\n /// @notice Accept a claim.\\n /// @param appContract The application contract address\\n /// @param r The input range\\n /// @param epochHash The epoch hash\\n /// @dev On successs, emits a `ClaimAcceptance` event.\\n function _acceptClaim(\\n address appContract,\\n InputRange calldata r,\\n bytes32 epochHash\\n ) internal {\\n _epochHashes[appContract][r.firstIndex][r.lastIndex] = epochHash;\\n emit ClaimAcceptance(appContract, r, epochHash);\\n }\\n}\\n\",\"keccak256\":\"0x2e41db152b70de9fe9917780efeba10ea3c0e1a1a2c96b158d81b1129a877eb5\",\"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\\nimport {InputRange} from \\\"../common/InputRange.sol\\\";\\n\\n/// @notice Provides data availability of epoch hashes for applications.\\n/// @notice An epoch hash is produced after the machine processes a range of inputs and the epoch is finalized.\\n/// This hash can be later used to prove that any given output was produced by the machine during the epoch.\\n/// @notice After an epoch is finalized, a validator may submit a claim containing the application contract address,\\n/// the range of inputs accepted during the epoch, and the epoch hash.\\n/// @notice Validators may synchronize epoch finalization, but such mechanism is not specified by this interface.\\n/// @notice A validator should be able to save transaction fees by not submitting a claim if it was...\\n/// - already submitted by the validator (see the `ClaimSubmission` event) or;\\n/// - already accepted by the consensus (see the `ClaimAcceptance` event).\\n/// @notice The acceptance criteria for claims may depend on the type of consensus, and is not specified by this interface.\\n/// For example, a claim may be accepted if it was...\\n/// - submitted by an authority or;\\n/// - submitted by the majority of a quorum or;\\n/// - submitted and not proven wrong after some period of time.\\ninterface IConsensus {\\n /// @notice MUST trigger when a claim is submitted.\\n /// @param submitter The submitter address\\n /// @param appContract The application contract address\\n /// @param inputRange The input range\\n /// @param epochHash The epoch hash\\n /// @dev Overwrites any previous submissions regarding `submitter`, `appContract` and `inputRange`.\\n event ClaimSubmission(\\n address indexed submitter,\\n address indexed appContract,\\n InputRange inputRange,\\n bytes32 epochHash\\n );\\n\\n /// @notice MUST trigger when a claim is accepted.\\n /// @param appContract The application contract address\\n /// @param inputRange The input range\\n /// @param epochHash The epoch hash\\n /// @dev MUST be triggered after some `ClaimSubmission` event regarding `appContract`, `inputRange` and `epochHash`.\\n /// @dev Overwrites any previous acceptances regarding `appContract` and `inputRange`.\\n event ClaimAcceptance(\\n address indexed appContract,\\n InputRange inputRange,\\n bytes32 epochHash\\n );\\n\\n /// @notice Submit a claim to the consensus.\\n /// @param appContract The application contract address\\n /// @param inputRange The input range\\n /// @param epochHash The epoch hash\\n /// @dev MUST fire a `ClaimSubmission` event.\\n /// @dev MAY fire a `ClaimAcceptance` event, if the acceptance criteria is met.\\n function submitClaim(\\n address appContract,\\n InputRange calldata inputRange,\\n bytes32 epochHash\\n ) external;\\n\\n /// @notice Get the epoch hash for a certain application and input range.\\n /// @param appContract The application contract address\\n /// @param inputRange The input range\\n /// @return epochHash The epoch hash\\n /// @dev For claimed epochs, must return the epoch hash of the last accepted claim.\\n /// @dev For unclaimed epochs, MUST either revert or return `bytes32(0)`.\\n function getEpochHash(\\n address appContract,\\n InputRange calldata inputRange\\n ) external view returns (bytes32 epochHash);\\n}\\n\",\"keccak256\":\"0xd2ea451e450f6b3b01bd77b95dbb00465d263cae9285a03c8ffd0d96c4d75dc1\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/quorum/IQuorumFactory.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 {Quorum} from \\\"./Quorum.sol\\\";\\n\\n/// @title Quorum Factory interface\\ninterface IQuorumFactory {\\n // Events\\n\\n /// @notice A new quorum was deployed.\\n /// @param quorum The quorum\\n /// @dev MUST be triggered on a successful call to `newQuorum`.\\n event QuorumCreated(Quorum quorum);\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new quorum.\\n /// @param validators the list of validators\\n /// @return The quorum\\n /// @dev On success, MUST emit a `QuorumCreated` event.\\n function newQuorum(address[] calldata validators) external returns (Quorum);\\n\\n /// @notice Deploy a new quorum deterministically.\\n /// @param validators the list of validators\\n /// @param salt The salt used to deterministically generate the quorum address\\n /// @return The quorum\\n /// @dev On success, MUST emit a `QuorumCreated` event.\\n function newQuorum(\\n address[] calldata validators,\\n bytes32 salt\\n ) external returns (Quorum);\\n\\n /// @notice Calculate the address of a quorum to be deployed deterministically.\\n /// @param validators the list of validators\\n /// @param salt The salt used to deterministically generate the quorum address\\n /// @return The deterministic quorum address\\n /// @dev Beware that only the `newQuorum` function with the `salt` parameter\\n /// is able to deterministically deploy a quorum.\\n function calculateQuorumAddress(\\n address[] calldata validators,\\n bytes32 salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0xcca705e094a685e5a4252adef5ac71d42bc811b5a5294ea86da9469aded40373\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/quorum/Quorum.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 {BitMaps} from \\\"@openzeppelin/contracts/utils/structs/BitMaps.sol\\\";\\n\\nimport {AbstractConsensus} from \\\"../AbstractConsensus.sol\\\";\\nimport {InputRange} from \\\"../../common/InputRange.sol\\\";\\n\\n/// @notice A consensus model controlled by a small, immutable set of `n` validators.\\n/// @notice You can know the value of `n` by calling the `numOfValidators` function.\\n/// @notice Upon construction, each validator is assigned a unique number between 1 and `n`.\\n/// These numbers are used internally instead of addresses for optimization reasons.\\n/// @notice You can list the validators in the quorum by calling the `validatorById`\\n/// function for each ID from 1 to `n`.\\ncontract Quorum is AbstractConsensus {\\n using BitMaps for BitMaps.BitMap;\\n\\n /// @notice The total number of validators.\\n /// @notice See the `numOfValidators` function.\\n uint256 private immutable _numOfValidators;\\n\\n /// @notice Validator IDs indexed by address.\\n /// @notice See the `validatorId` function.\\n /// @dev Non-validators are assigned to ID zero.\\n /// @dev Validators have IDs greater than zero.\\n mapping(address => uint256) private _validatorId;\\n\\n /// @notice Validator addresses indexed by ID.\\n /// @notice See the `validatorById` function.\\n /// @dev Invalid IDs map to address zero.\\n mapping(uint256 => address) private _validatorById;\\n\\n /// @notice Votes in favor of a particular claim.\\n /// @param inFavorCount The number of validators in favor of the claim\\n /// @param inFavorById The set of validators in favor of the claim\\n /// @dev `inFavorById` is a bitmap indexed by validator IDs.\\n struct Votes {\\n uint256 inFavorCount;\\n BitMaps.BitMap inFavorById;\\n }\\n\\n /// @notice Votes indexed by claim\\n /// (application contract address, first input index, last input index, and epoch hash).\\n /// @dev See the `numOfValidatorsInFavorOf` and `isValidatorInFavorOf` functions.\\n mapping(address => mapping(uint256 => mapping(uint256 => mapping(bytes32 => Votes))))\\n private _votes;\\n\\n /// @param validators The array of validator addresses\\n /// @dev Duplicates in the `validators` array are ignored.\\n constructor(address[] memory validators) {\\n uint256 n;\\n for (uint256 i; i < validators.length; ++i) {\\n address validator = validators[i];\\n if (_validatorId[validator] == 0) {\\n uint256 id = ++n;\\n _validatorId[validator] = id;\\n _validatorById[id] = validator;\\n }\\n }\\n _numOfValidators = n;\\n }\\n\\n /// @notice Submit a claim.\\n /// @notice If the majority of the quorum submit a claim, it is accepted.\\n /// @param appContract The application contract address\\n /// @param r The input range\\n /// @param epochHash The epoch hash\\n /// @dev Can only be called by a validator.\\n function submitClaim(\\n address appContract,\\n InputRange calldata r,\\n bytes32 epochHash\\n ) external {\\n uint256 id = _validatorId[msg.sender];\\n require(id > 0, \\\"Quorum: caller is not validator\\\");\\n\\n emit ClaimSubmission(msg.sender, appContract, r, epochHash);\\n\\n Votes storage votes = _getVotes(appContract, r, epochHash);\\n\\n if (!votes.inFavorById.get(id)) {\\n votes.inFavorById.set(id);\\n if (++votes.inFavorCount == 1 + _numOfValidators / 2) {\\n _acceptClaim(appContract, r, epochHash);\\n }\\n }\\n }\\n\\n /// @notice Get the number of validators.\\n function numOfValidators() external view returns (uint256) {\\n return _numOfValidators;\\n }\\n\\n /// @notice Get the ID of a validator.\\n /// @param validator The validator address\\n /// @dev Validators have IDs greater than zero.\\n /// @dev Non-validators are assigned to ID zero.\\n function validatorId(address validator) external view returns (uint256) {\\n return _validatorId[validator];\\n }\\n\\n /// @notice Get the address of a validator by its ID.\\n /// @param id The validator ID\\n /// @dev Validator IDs range from 1 to `N`, the total number of validators.\\n /// @dev Invalid IDs map to address zero.\\n function validatorById(uint256 id) external view returns (address) {\\n return _validatorById[id];\\n }\\n\\n /// @notice Get the number of validators in favor of a claim.\\n /// @param appContract The application contract address\\n /// @param r The input range\\n /// @param epochHash The epoch hash\\n /// @return Number of validators in favor of claim\\n function numOfValidatorsInFavorOf(\\n address appContract,\\n InputRange calldata r,\\n bytes32 epochHash\\n ) external view returns (uint256) {\\n return _getVotes(appContract, r, epochHash).inFavorCount;\\n }\\n\\n /// @notice Check whether a validator is in favor of a claim.\\n /// @param appContract The application contract address\\n /// @param r The input range\\n /// @param epochHash The epoch hash\\n /// @param id The ID of the validator\\n /// @return Whether validator is in favor of claim\\n /// @dev Assumes the provided ID is valid.\\n function isValidatorInFavorOf(\\n address appContract,\\n InputRange calldata r,\\n bytes32 epochHash,\\n uint256 id\\n ) external view returns (bool) {\\n return _getVotes(appContract, r, epochHash).inFavorById.get(id);\\n }\\n\\n /// @notice Get a `Votes` structure from storage from a given claim.\\n /// @param appContract The application contract address\\n /// @param r The input range\\n /// @param epochHash The epoch hash\\n /// @return The `Votes` structure related to given claim\\n function _getVotes(\\n address appContract,\\n InputRange calldata r,\\n bytes32 epochHash\\n ) internal view returns (Votes storage) {\\n return _votes[appContract][r.firstIndex][r.lastIndex][epochHash];\\n }\\n}\\n\",\"keccak256\":\"0xb71b0a8f14a6ba381f7921212827b014fb4d025be94ce7c52f564ecbd0cc55ea\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/quorum/QuorumFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Create2} from \\\"@openzeppelin/contracts/utils/Create2.sol\\\";\\n\\nimport {IQuorumFactory} from \\\"./IQuorumFactory.sol\\\";\\nimport {Quorum} from \\\"./Quorum.sol\\\";\\n\\n/// @title Quorum Factory\\n/// @notice Allows anyone to reliably deploy a new `Quorum` contract.\\ncontract QuorumFactory is IQuorumFactory {\\n function newQuorum(\\n address[] calldata validators\\n ) external override returns (Quorum) {\\n Quorum quorum = new Quorum(validators);\\n\\n emit QuorumCreated(quorum);\\n\\n return quorum;\\n }\\n\\n function newQuorum(\\n address[] calldata validators,\\n bytes32 salt\\n ) external override returns (Quorum) {\\n Quorum quorum = new Quorum{salt: salt}(validators);\\n\\n emit QuorumCreated(quorum);\\n\\n return quorum;\\n }\\n\\n function calculateQuorumAddress(\\n address[] calldata validators,\\n bytes32 salt\\n ) external view override returns (address) {\\n return\\n Create2.computeAddress(\\n salt,\\n keccak256(\\n abi.encodePacked(\\n type(Quorum).creationCode,\\n abi.encode(validators)\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0xb1923c3b0af1c983824913a5ef4db0d567aa33d3d1a05fe8ee258a31782973b5\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50610d60806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063073e5afa146100465780634254a77e14610075578063cd4d3dec14610088575b600080fd5b6100596100543660046102b2565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b6100596100833660046102f4565b61011a565b6100596100963660046102f4565b61019f565b60008083836040516100ac90610259565b6100b7929190610340565b604051809103906000f0801580156100d3573d6000803e3d6000fd5b506040516001600160a01b03821681529091507f446698b70271bce331e53210572bd37ac8c590b6cdca2e6763e6448243cba8029060200160405180910390a19392505050565b60008082858560405161012c90610259565b610137929190610340565b8190604051809103906000f5905080158015610157573d6000803e3d6000fd5b506040516001600160a01b03821681529091507f446698b70271bce331e53210572bd37ac8c590b6cdca2e6763e6448243cba8029060200160405180910390a1949350505050565b600061021382604051806020016101b590610259565b601f1982820381018352601f9091011660408190526101da9088908890602001610340565b60408051601f19818403018152908290526101f892916020016103c5565b6040516020818303038152906040528051906020012061021b565b949350505050565b600061022883833061022f565b9392505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b610950806103db83390190565b60008083601f84011261027857600080fd5b50813567ffffffffffffffff81111561029057600080fd5b6020830191508360208260051b85010111156102ab57600080fd5b9250929050565b600080602083850312156102c557600080fd5b823567ffffffffffffffff8111156102dc57600080fd5b6102e885828601610266565b90969095509350505050565b60008060006040848603121561030957600080fd5b833567ffffffffffffffff81111561032057600080fd5b61032c86828701610266565b909790965060209590950135949350505050565b6020808252818101839052600090846040840183805b878110156103885783356001600160a01b038116808214610375578384fd5b8452509284019291840191600101610356565b5090979650505050505050565b6000815160005b818110156103b6576020818501810151868301520161039c565b50600093019283525090919050565b60006102136103d48386610395565b8461039556fe60a060405234801561001057600080fd5b5060405161095038038061095083398101604081905261002f91610114565b6000805b82518110156100d8576000838281518110610050576100506101d8565b6020026020010151905060016000826001600160a01b03166001600160a01b03168152602001908152602001600020546000036100cf576000610092846101ee565b6001600160a01b03831660008181526001602090815260408083208590558483526002909152902080546001600160a01b03191690911790559350505b50600101610033565b5060805250610215565b634e487b7160e01b600052604160045260246000fd5b80516001600160a01b038116811461010f57600080fd5b919050565b6000602080838503121561012757600080fd5b82516001600160401b038082111561013e57600080fd5b818501915085601f83011261015257600080fd5b815181811115610164576101646100e2565b8060051b604051601f19603f83011681018181108582111715610189576101896100e2565b6040529182528482019250838101850191888311156101a757600080fd5b938501935b828510156101cc576101bd856100f8565b845293850193928501926101ac565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b60006001820161020e57634e487b7160e01b600052601160045260246000fd5b5060010190565b60805161071961023760003960008181610101015261029401526107196000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80637d094dd61161005b5780637d094dd614610125578063866b85fa14610138578063c1f59afc1461014d578063ddccf48c1461016057600080fd5b80630a6f1fe8146100825780631c45396a146100be5780631e526e45146100ff575b600080fd5b6100ab61009036600461050a565b6001600160a01b031660009081526001602052604090205490565b6040519081526020015b60405180910390f35b6100e76100cc36600461052c565b6000908152600260205260409020546001600160a01b031690565b6040516001600160a01b0390911681526020016100b5565b7f00000000000000000000000000000000000000000000000000000000000000006100ab565b6100ab61013336600461055d565b610183565b61014b61014636600461055d565b610199565b005b6100ab61015b36600461059a565b6102f0565b61017361016e3660046105ce565b610365565b60405190151581526020016100b5565b6000610190848484610388565b54949350505050565b33600090815260016020526040902054806101fa5760405162461bcd60e51b815260206004820152601f60248201527f51756f72756d3a2063616c6c6572206973206e6f742076616c696461746f7200604482015260640160405180910390fd5b836001600160a01b0316336001600160a01b03167f940326476a755934b6ae9d2b36ffcf1f447c3a8223f6d9f8a796b54fbfcce582858560405161023f929190610629565b60405180910390a36000610254858585610388565b90506102636001820183610410565b6102e957600882901c600090815260018281016020526040909120805460ff85169290921b90911790556102b860027f000000000000000000000000000000000000000000000000000000000000000061067a565b6102c390600161069c565b81600001600081546102d4906106af565b9182905550036102e9576102e9858585610435565b5050505050565b6001600160a01b0382166000908152602081815260408220908290610317908501856106c8565b67ffffffffffffffff168152602001908152602001600020600083602001602081019061034491906106c8565b67ffffffffffffffff16815260200190815260200160002054905092915050565b600061037f82610376878787610388565b60010190610410565b95945050505050565b6001600160a01b038316600090815260036020908152604082209082906103b1908601866106c8565b67ffffffffffffffff16815260200190815260200160002060008460200160208101906103de91906106c8565b67ffffffffffffffff168152602001908152602001600020600083815260200190815260200160002090509392505050565b600881901c600090815260208390526040902054600160ff83161b1615155b92915050565b6001600160a01b03831660009081526020818152604082208392909161045d908601866106c8565b67ffffffffffffffff168152602001908152602001600020600084602001602081019061048a91906106c8565b67ffffffffffffffff16815260200190815260200160002081905550826001600160a01b03167f4e068a6b8ed35e6ee03244135874f91ccebb5cd1f3a258a6dc2ad0ebd298847683836040516104e1929190610629565b60405180910390a2505050565b80356001600160a01b038116811461050557600080fd5b919050565b60006020828403121561051c57600080fd5b610525826104ee565b9392505050565b60006020828403121561053e57600080fd5b5035919050565b60006040828403121561055757600080fd5b50919050565b60008060006080848603121561057257600080fd5b61057b846104ee565b925061058a8560208601610545565b9150606084013590509250925092565b600080606083850312156105ad57600080fd5b6105b6836104ee565b91506105c58460208501610545565b90509250929050565b60008060008060a085870312156105e457600080fd5b6105ed856104ee565b93506105fc8660208701610545565b93969395505050506060820135916080013590565b803567ffffffffffffffff8116811461050557600080fd5b6060810167ffffffffffffffff8061064086610611565b1683528061065060208701610611565b166020840152508260408301529392505050565b634e487b7160e01b600052601160045260246000fd5b60008261069757634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561042f5761042f610664565b6000600182016106c1576106c1610664565b5060010190565b6000602082840312156106da57600080fd5b6105258261061156fea2646970667358221220157a6bffa7eaa9ca48d7a15a2149a3dbf5c9ab1640312cf2a2a555f1a84f020064736f6c63430008170033a26469706673582212201302a4a7cea7b4d5365e7b315030c118e7bdcc628cf4e01f3e46fd11f52d43b264736f6c63430008170033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c8063073e5afa146100465780634254a77e14610075578063cd4d3dec14610088575b600080fd5b6100596100543660046102b2565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b6100596100833660046102f4565b61011a565b6100596100963660046102f4565b61019f565b60008083836040516100ac90610259565b6100b7929190610340565b604051809103906000f0801580156100d3573d6000803e3d6000fd5b506040516001600160a01b03821681529091507f446698b70271bce331e53210572bd37ac8c590b6cdca2e6763e6448243cba8029060200160405180910390a19392505050565b60008082858560405161012c90610259565b610137929190610340565b8190604051809103906000f5905080158015610157573d6000803e3d6000fd5b506040516001600160a01b03821681529091507f446698b70271bce331e53210572bd37ac8c590b6cdca2e6763e6448243cba8029060200160405180910390a1949350505050565b600061021382604051806020016101b590610259565b601f1982820381018352601f9091011660408190526101da9088908890602001610340565b60408051601f19818403018152908290526101f892916020016103c5565b6040516020818303038152906040528051906020012061021b565b949350505050565b600061022883833061022f565b9392505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b610950806103db83390190565b60008083601f84011261027857600080fd5b50813567ffffffffffffffff81111561029057600080fd5b6020830191508360208260051b85010111156102ab57600080fd5b9250929050565b600080602083850312156102c557600080fd5b823567ffffffffffffffff8111156102dc57600080fd5b6102e885828601610266565b90969095509350505050565b60008060006040848603121561030957600080fd5b833567ffffffffffffffff81111561032057600080fd5b61032c86828701610266565b909790965060209590950135949350505050565b6020808252818101839052600090846040840183805b878110156103885783356001600160a01b038116808214610375578384fd5b8452509284019291840191600101610356565b5090979650505050505050565b6000815160005b818110156103b6576020818501810151868301520161039c565b50600093019283525090919050565b60006102136103d48386610395565b8461039556fe60a060405234801561001057600080fd5b5060405161095038038061095083398101604081905261002f91610114565b6000805b82518110156100d8576000838281518110610050576100506101d8565b6020026020010151905060016000826001600160a01b03166001600160a01b03168152602001908152602001600020546000036100cf576000610092846101ee565b6001600160a01b03831660008181526001602090815260408083208590558483526002909152902080546001600160a01b03191690911790559350505b50600101610033565b5060805250610215565b634e487b7160e01b600052604160045260246000fd5b80516001600160a01b038116811461010f57600080fd5b919050565b6000602080838503121561012757600080fd5b82516001600160401b038082111561013e57600080fd5b818501915085601f83011261015257600080fd5b815181811115610164576101646100e2565b8060051b604051601f19603f83011681018181108582111715610189576101896100e2565b6040529182528482019250838101850191888311156101a757600080fd5b938501935b828510156101cc576101bd856100f8565b845293850193928501926101ac565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b60006001820161020e57634e487b7160e01b600052601160045260246000fd5b5060010190565b60805161071961023760003960008181610101015261029401526107196000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80637d094dd61161005b5780637d094dd614610125578063866b85fa14610138578063c1f59afc1461014d578063ddccf48c1461016057600080fd5b80630a6f1fe8146100825780631c45396a146100be5780631e526e45146100ff575b600080fd5b6100ab61009036600461050a565b6001600160a01b031660009081526001602052604090205490565b6040519081526020015b60405180910390f35b6100e76100cc36600461052c565b6000908152600260205260409020546001600160a01b031690565b6040516001600160a01b0390911681526020016100b5565b7f00000000000000000000000000000000000000000000000000000000000000006100ab565b6100ab61013336600461055d565b610183565b61014b61014636600461055d565b610199565b005b6100ab61015b36600461059a565b6102f0565b61017361016e3660046105ce565b610365565b60405190151581526020016100b5565b6000610190848484610388565b54949350505050565b33600090815260016020526040902054806101fa5760405162461bcd60e51b815260206004820152601f60248201527f51756f72756d3a2063616c6c6572206973206e6f742076616c696461746f7200604482015260640160405180910390fd5b836001600160a01b0316336001600160a01b03167f940326476a755934b6ae9d2b36ffcf1f447c3a8223f6d9f8a796b54fbfcce582858560405161023f929190610629565b60405180910390a36000610254858585610388565b90506102636001820183610410565b6102e957600882901c600090815260018281016020526040909120805460ff85169290921b90911790556102b860027f000000000000000000000000000000000000000000000000000000000000000061067a565b6102c390600161069c565b81600001600081546102d4906106af565b9182905550036102e9576102e9858585610435565b5050505050565b6001600160a01b0382166000908152602081815260408220908290610317908501856106c8565b67ffffffffffffffff168152602001908152602001600020600083602001602081019061034491906106c8565b67ffffffffffffffff16815260200190815260200160002054905092915050565b600061037f82610376878787610388565b60010190610410565b95945050505050565b6001600160a01b038316600090815260036020908152604082209082906103b1908601866106c8565b67ffffffffffffffff16815260200190815260200160002060008460200160208101906103de91906106c8565b67ffffffffffffffff168152602001908152602001600020600083815260200190815260200160002090509392505050565b600881901c600090815260208390526040902054600160ff83161b1615155b92915050565b6001600160a01b03831660009081526020818152604082208392909161045d908601866106c8565b67ffffffffffffffff168152602001908152602001600020600084602001602081019061048a91906106c8565b67ffffffffffffffff16815260200190815260200160002081905550826001600160a01b03167f4e068a6b8ed35e6ee03244135874f91ccebb5cd1f3a258a6dc2ad0ebd298847683836040516104e1929190610629565b60405180910390a2505050565b80356001600160a01b038116811461050557600080fd5b919050565b60006020828403121561051c57600080fd5b610525826104ee565b9392505050565b60006020828403121561053e57600080fd5b5035919050565b60006040828403121561055757600080fd5b50919050565b60008060006080848603121561057257600080fd5b61057b846104ee565b925061058a8560208601610545565b9150606084013590509250925092565b600080606083850312156105ad57600080fd5b6105b6836104ee565b91506105c58460208501610545565b90509250929050565b60008060008060a085870312156105e457600080fd5b6105ed856104ee565b93506105fc8660208701610545565b93969395505050506060820135916080013590565b803567ffffffffffffffff8116811461050557600080fd5b6060810167ffffffffffffffff8061064086610611565b1683528061065060208701610611565b166020840152508260408301529392505050565b634e487b7160e01b600052601160045260246000fd5b60008261069757634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561042f5761042f610664565b6000600182016106c1576106c1610664565b5060010190565b6000602082840312156106da57600080fd5b6105258261061156fea2646970667358221220157a6bffa7eaa9ca48d7a15a2149a3dbf5c9ab1640312cf2a2a555f1a84f020064736f6c63430008170033a26469706673582212201302a4a7cea7b4d5365e7b315030c118e7bdcc628cf4e01f3e46fd11f52d43b264736f6c63430008170033", + "numDeployments": 2, + "solcInputHash": "3277ebc53d2ec4c7847e5faa9f9b26b3", + "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract IQuorum\",\"name\":\"quorum\",\"type\":\"address\"}],\"name\":\"QuorumCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"validators\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"epochLength\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"}],\"name\":\"calculateQuorumAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"validators\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"epochLength\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"}],\"name\":\"newQuorum\",\"outputs\":[{\"internalType\":\"contract IQuorum\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"validators\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"epochLength\",\"type\":\"uint256\"}],\"name\":\"newQuorum\",\"outputs\":[{\"internalType\":\"contract IQuorum\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"QuorumCreated(address)\":{\"details\":\"MUST be triggered on a successful call to `newQuorum`.\",\"params\":{\"quorum\":\"The quorum\"}}},\"kind\":\"dev\",\"methods\":{\"calculateQuorumAddress(address[],uint256,bytes32)\":{\"details\":\"Beware that only the `newQuorum` function with the `salt` parameter is able to deterministically deploy a quorum.\",\"params\":{\"epochLength\":\"The epoch length\",\"salt\":\"The salt used to deterministically generate the quorum address\",\"validators\":\"the list of validators\"},\"returns\":{\"_0\":\"The deterministic quorum address\"}},\"newQuorum(address[],uint256)\":{\"details\":\"On success, MUST emit a `QuorumCreated` event.Duplicates in the `validators` array are ignored.Reverts if the epoch length is zero.\",\"params\":{\"epochLength\":\"The epoch length\",\"validators\":\"the list of validators\"},\"returns\":{\"_0\":\"The quorum\"}},\"newQuorum(address[],uint256,bytes32)\":{\"details\":\"On success, MUST emit a `QuorumCreated` event.Duplicates in the `validators` array are ignored.Reverts if the epoch length is zero.\",\"params\":{\"epochLength\":\"The epoch length\",\"salt\":\"The salt used to deterministically generate the quorum address\",\"validators\":\"the list of validators\"},\"returns\":{\"_0\":\"The quorum\"}}},\"title\":\"Quorum Factory\",\"version\":1},\"userdoc\":{\"events\":{\"QuorumCreated(address)\":{\"notice\":\"A new quorum was deployed.\"}},\"kind\":\"user\",\"methods\":{\"calculateQuorumAddress(address[],uint256,bytes32)\":{\"notice\":\"Calculate the address of a quorum to be deployed deterministically.\"},\"newQuorum(address[],uint256)\":{\"notice\":\"Deploy a new quorum.\"},\"newQuorum(address[],uint256,bytes32)\":{\"notice\":\"Deploy a new quorum deterministically.\"}},\"notice\":\"Allows anyone to reliably deploy a new `IQuorum` contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/consensus/quorum/QuorumFactory.sol\":\"QuorumFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Not enough balance for performing a CREATE2 deploy.\\n */\\n error Create2InsufficientBalance(uint256 balance, uint256 needed);\\n\\n /**\\n * @dev There's no code to deploy.\\n */\\n error Create2EmptyBytecode();\\n\\n /**\\n * @dev The deployment failed.\\n */\\n error Create2FailedDeployment();\\n\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\\n if (address(this).balance < amount) {\\n revert Create2InsufficientBalance(address(this).balance, amount);\\n }\\n if (bytecode.length == 0) {\\n revert Create2EmptyBytecode();\\n }\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n if (addr == address(0)) {\\n revert Create2FailedDeployment();\\n }\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2b9807d194b92f1068d868e9587d27037264a9a067c778486f86ae21c61cbd5e\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/structs/BitMaps.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/BitMaps.sol)\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Library for managing uint256 to bool mapping in a compact and efficient way, provided the keys are sequential.\\n * Largely inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor].\\n *\\n * BitMaps pack 256 booleans across each bit of a single 256-bit slot of `uint256` type.\\n * Hence booleans corresponding to 256 _sequential_ indices would only consume a single slot,\\n * unlike the regular `bool` which would consume an entire slot for a single value.\\n *\\n * This results in gas savings in two ways:\\n *\\n * - Setting a zero value to non-zero only once every 256 times\\n * - Accessing the same warm slot for every 256 _sequential_ indices\\n */\\nlibrary BitMaps {\\n struct BitMap {\\n mapping(uint256 bucket => uint256) _data;\\n }\\n\\n /**\\n * @dev Returns whether the bit at `index` is set.\\n */\\n function get(BitMap storage bitmap, uint256 index) internal view returns (bool) {\\n uint256 bucket = index >> 8;\\n uint256 mask = 1 << (index & 0xff);\\n return bitmap._data[bucket] & mask != 0;\\n }\\n\\n /**\\n * @dev Sets the bit at `index` to the boolean `value`.\\n */\\n function setTo(BitMap storage bitmap, uint256 index, bool value) internal {\\n if (value) {\\n set(bitmap, index);\\n } else {\\n unset(bitmap, index);\\n }\\n }\\n\\n /**\\n * @dev Sets the bit at `index`.\\n */\\n function set(BitMap storage bitmap, uint256 index) internal {\\n uint256 bucket = index >> 8;\\n uint256 mask = 1 << (index & 0xff);\\n bitmap._data[bucket] |= mask;\\n }\\n\\n /**\\n * @dev Unsets the bit at `index`.\\n */\\n function unset(BitMap storage bitmap, uint256 index) internal {\\n uint256 bucket = index >> 8;\\n uint256 mask = 1 << (index & 0xff);\\n bitmap._data[bucket] &= ~mask;\\n }\\n}\\n\",\"keccak256\":\"0x3616f1b0d0a9ee1ca8f0953ecaceb9230e36f691c7974d30f964212acff52d2b\",\"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/// @notice Stores accepted claims for several applications.\\n/// @dev This contract was designed to be inherited by implementations of the `IConsensus` interface\\n/// that only need a simple mechanism of storage and retrieval of accepted claims.\\nabstract contract AbstractConsensus is IConsensus {\\n /// @notice The epoch length\\n uint256 private immutable _epochLength;\\n\\n /// @notice Indexes accepted claims by application contract address.\\n mapping(address => mapping(bytes32 => bool)) private _acceptedClaims;\\n\\n /// @param epochLength The epoch length\\n /// @dev Reverts if the epoch length is zero.\\n constructor(uint256 epochLength) {\\n require(epochLength > 0, \\\"epoch length must not be zero\\\");\\n _epochLength = epochLength;\\n }\\n\\n /// @inheritdoc IConsensus\\n function wasClaimAccepted(\\n address appContract,\\n bytes32 claim\\n ) public view override returns (bool) {\\n return _acceptedClaims[appContract][claim];\\n }\\n\\n /// @inheritdoc IConsensus\\n function getEpochLength() public view override returns (uint256) {\\n return _epochLength;\\n }\\n\\n /// @notice Accept a claim.\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The output Merkle root hash\\n /// @dev Emits a `ClaimAcceptance` event.\\n function _acceptClaim(\\n address appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n ) internal {\\n _acceptedClaims[appContract][claim] = true;\\n emit ClaimAcceptance(appContract, lastProcessedBlockNumber, claim);\\n }\\n}\\n\",\"keccak256\":\"0x8d94096a285a068e53dfa65f26d4aa8549c3edf0d80e1b3f4322a2df69e141b7\",\"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/// @notice Each application has its own stream of inputs.\\n/// See the `IInputBox` interface for calldata-based on-chain data availability.\\n/// @notice When an input is fed to the application, it may yield several outputs.\\n/// @notice Since genesis, a Merkle tree of all outputs ever produced is maintained\\n/// both inside and outside the Cartesi Machine.\\n/// @notice The claim that validators may submit to the consensus contract\\n/// is the root of this Merkle tree after processing all base layer blocks until some height.\\n/// @notice A validator should be able to save transaction fees by not submitting a claim if it was...\\n/// - already submitted by the validator (see the `ClaimSubmission` event) or;\\n/// - already accepted by the consensus (see the `ClaimAcceptance` event).\\n/// @notice The acceptance criteria for claims may depend on the type of consensus, and is not specified by this interface.\\n/// For example, a claim may be accepted if it was...\\n/// - submitted by an authority or;\\n/// - submitted by the majority of a quorum or;\\n/// - submitted and not proven wrong after some period of time or;\\n/// - submitted and proven correct through an on-chain tournament.\\ninterface IConsensus {\\n /// @notice MUST trigger when a claim is submitted.\\n /// @param submitter The submitter address\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The root of the Merkle tree of outputs\\n event ClaimSubmission(\\n address indexed submitter,\\n address indexed appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n );\\n\\n /// @notice MUST trigger when a claim is accepted.\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The root of the Merkle tree of outputs\\n event ClaimAcceptance(\\n address indexed appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n );\\n\\n /// @notice Submit a claim to the consensus.\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The root of the Merkle tree of outputs\\n /// @dev MUST fire a `ClaimSubmission` event.\\n /// @dev MAY fire a `ClaimAcceptance` event, if the acceptance criteria is met.\\n function submitClaim(\\n address appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n ) external;\\n\\n /// @notice Check if an output Merkle root hash was ever accepted by the consensus\\n /// for a particular application.\\n /// @param appContract The application contract address\\n /// @param claim The root of the Merkle tree of outputs\\n function wasClaimAccepted(\\n address appContract,\\n bytes32 claim\\n ) external view returns (bool);\\n\\n /// @notice Get the epoch length, in number of base layer blocks.\\n /// @dev The epoch number of a block is defined as\\n /// the integer division of the block number by the epoch length.\\n function getEpochLength() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x33ef3c4e213b2a3489b37d5ef553dc1165c598c56beb0ed8290723a5c74d821c\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/quorum/IQuorum.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/// @notice A consensus model controlled by a small, immutable set of `n` validators.\\n/// @notice You can know the value of `n` by calling the `numOfValidators` function.\\n/// @notice Upon construction, each validator is assigned a unique number between 1 and `n`.\\n/// These numbers are used internally instead of addresses for gas optimization reasons.\\n/// @notice You can list the validators in the quorum by calling the `validatorById`\\n/// function for each ID from 1 to `n`.\\ninterface IQuorum is IConsensus {\\n /// @notice Get the number of validators.\\n function numOfValidators() external view returns (uint256);\\n\\n /// @notice Get the ID of a validator.\\n /// @param validator The validator address\\n /// @dev Validators have IDs greater than zero.\\n /// @dev Non-validators are assigned to ID zero.\\n function validatorId(address validator) external view returns (uint256);\\n\\n /// @notice Get the address of a validator by its ID.\\n /// @param id The validator ID\\n /// @dev Validator IDs range from 1 to `N`, the total number of validators.\\n /// @dev Invalid IDs map to address zero.\\n function validatorById(uint256 id) external view returns (address);\\n\\n /// @notice Get the number of validators in favor of a claim.\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The output Merkle root hash\\n /// @return Number of validators in favor of claim\\n function numOfValidatorsInFavorOf(\\n address appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n ) external view returns (uint256);\\n\\n /// @notice Check whether a validator is in favor of a claim.\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The output Merkle root hash\\n /// @param id The ID of the validator\\n /// @return Whether validator is in favor of claim\\n /// @dev Assumes the provided ID is valid.\\n function isValidatorInFavorOf(\\n address appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim,\\n uint256 id\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x16194cde8b5d9f4cc290f84a9e812c5722217b3ef8c6aa45155ab136ec23e5e3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/quorum/IQuorumFactory.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 {IQuorum} from \\\"./IQuorum.sol\\\";\\n\\n/// @title Quorum Factory interface\\ninterface IQuorumFactory {\\n // Events\\n\\n /// @notice A new quorum was deployed.\\n /// @param quorum The quorum\\n /// @dev MUST be triggered on a successful call to `newQuorum`.\\n event QuorumCreated(IQuorum quorum);\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new quorum.\\n /// @param validators the list of validators\\n /// @param epochLength The epoch length\\n /// @return The quorum\\n /// @dev On success, MUST emit a `QuorumCreated` event.\\n /// @dev Duplicates in the `validators` array are ignored.\\n /// @dev Reverts if the epoch length is zero.\\n function newQuorum(\\n address[] calldata validators,\\n uint256 epochLength\\n ) external returns (IQuorum);\\n\\n /// @notice Deploy a new quorum deterministically.\\n /// @param validators the list of validators\\n /// @param epochLength The epoch length\\n /// @param salt The salt used to deterministically generate the quorum address\\n /// @return The quorum\\n /// @dev On success, MUST emit a `QuorumCreated` event.\\n /// @dev Duplicates in the `validators` array are ignored.\\n /// @dev Reverts if the epoch length is zero.\\n function newQuorum(\\n address[] calldata validators,\\n uint256 epochLength,\\n bytes32 salt\\n ) external returns (IQuorum);\\n\\n /// @notice Calculate the address of a quorum to be deployed deterministically.\\n /// @param validators the list of validators\\n /// @param epochLength The epoch length\\n /// @param salt The salt used to deterministically generate the quorum address\\n /// @return The deterministic quorum address\\n /// @dev Beware that only the `newQuorum` function with the `salt` parameter\\n /// is able to deterministically deploy a quorum.\\n function calculateQuorumAddress(\\n address[] calldata validators,\\n uint256 epochLength,\\n bytes32 salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0xada5bfce326546f17f2b5a963864190e43ca92eb4776f3a7228b198fcae9aac3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/quorum/Quorum.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 {BitMaps} from \\\"@openzeppelin/contracts/utils/structs/BitMaps.sol\\\";\\n\\nimport {IQuorum} from \\\"./IQuorum.sol\\\";\\nimport {AbstractConsensus} from \\\"../AbstractConsensus.sol\\\";\\n\\ncontract Quorum is IQuorum, AbstractConsensus {\\n using BitMaps for BitMaps.BitMap;\\n\\n /// @notice The total number of validators.\\n /// @notice See the `numOfValidators` function.\\n uint256 private immutable _numOfValidators;\\n\\n /// @notice Validator IDs indexed by address.\\n /// @notice See the `validatorId` function.\\n /// @dev Non-validators are assigned to ID zero.\\n /// @dev Validators have IDs greater than zero.\\n mapping(address => uint256) private _validatorId;\\n\\n /// @notice Validator addresses indexed by ID.\\n /// @notice See the `validatorById` function.\\n /// @dev Invalid IDs map to address zero.\\n mapping(uint256 => address) private _validatorById;\\n\\n /// @notice Votes in favor of a particular claim.\\n /// @param inFavorCount The number of validators in favor of the claim\\n /// @param inFavorById The set of validators in favor of the claim\\n /// @dev `inFavorById` is a bitmap indexed by validator IDs.\\n struct Votes {\\n uint256 inFavorCount;\\n BitMaps.BitMap inFavorById;\\n }\\n\\n /// @notice Votes indexed by application contract address,\\n /// last processed block number and claim.\\n /// @dev See the `numOfValidatorsInFavorOf` and `isValidatorInFavorOf` functions.\\n mapping(address => mapping(uint256 => mapping(bytes32 => Votes)))\\n private _votes;\\n\\n /// @param validators The array of validator addresses\\n /// @param epochLength The epoch length\\n /// @dev Duplicates in the `validators` array are ignored.\\n /// @dev Reverts if the epoch length is zero.\\n constructor(\\n address[] memory validators,\\n uint256 epochLength\\n ) AbstractConsensus(epochLength) {\\n uint256 n;\\n for (uint256 i; i < validators.length; ++i) {\\n address validator = validators[i];\\n if (_validatorId[validator] == 0) {\\n uint256 id = ++n;\\n _validatorId[validator] = id;\\n _validatorById[id] = validator;\\n }\\n }\\n _numOfValidators = n;\\n }\\n\\n function submitClaim(\\n address appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n ) external override {\\n uint256 id = _validatorId[msg.sender];\\n require(id > 0, \\\"Quorum: caller is not validator\\\");\\n\\n emit ClaimSubmission(\\n msg.sender,\\n appContract,\\n lastProcessedBlockNumber,\\n claim\\n );\\n\\n Votes storage votes = _getVotes(\\n appContract,\\n lastProcessedBlockNumber,\\n claim\\n );\\n\\n if (!votes.inFavorById.get(id)) {\\n votes.inFavorById.set(id);\\n if (++votes.inFavorCount == 1 + _numOfValidators / 2) {\\n _acceptClaim(appContract, lastProcessedBlockNumber, claim);\\n }\\n }\\n }\\n\\n function numOfValidators() external view override returns (uint256) {\\n return _numOfValidators;\\n }\\n\\n function validatorId(\\n address validator\\n ) external view override returns (uint256) {\\n return _validatorId[validator];\\n }\\n\\n function validatorById(\\n uint256 id\\n ) external view override returns (address) {\\n return _validatorById[id];\\n }\\n\\n function numOfValidatorsInFavorOf(\\n address appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n ) external view override returns (uint256) {\\n return\\n _getVotes(appContract, lastProcessedBlockNumber, claim)\\n .inFavorCount;\\n }\\n\\n function isValidatorInFavorOf(\\n address appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim,\\n uint256 id\\n ) external view override returns (bool) {\\n return\\n _getVotes(appContract, lastProcessedBlockNumber, claim)\\n .inFavorById\\n .get(id);\\n }\\n\\n /// @notice Get a `Votes` structure from storage from a given claim.\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The output Merkle root hash\\n /// @return The `Votes` structure related to a given claim\\n function _getVotes(\\n address appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n ) internal view returns (Votes storage) {\\n return _votes[appContract][lastProcessedBlockNumber][claim];\\n }\\n}\\n\",\"keccak256\":\"0x4e850dc37778ce8cd0017f81decc6cdd40492de6e221c1d2cdfc4c2762252367\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/quorum/QuorumFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Create2} from \\\"@openzeppelin/contracts/utils/Create2.sol\\\";\\n\\nimport {IQuorumFactory} from \\\"./IQuorumFactory.sol\\\";\\nimport {IQuorum} from \\\"./IQuorum.sol\\\";\\nimport {Quorum} from \\\"./Quorum.sol\\\";\\n\\n/// @title Quorum Factory\\n/// @notice Allows anyone to reliably deploy a new `IQuorum` contract.\\ncontract QuorumFactory is IQuorumFactory {\\n function newQuorum(\\n address[] calldata validators,\\n uint256 epochLength\\n ) external override returns (IQuorum) {\\n IQuorum quorum = new Quorum(validators, epochLength);\\n\\n emit QuorumCreated(quorum);\\n\\n return quorum;\\n }\\n\\n function newQuorum(\\n address[] calldata validators,\\n uint256 epochLength,\\n bytes32 salt\\n ) external override returns (IQuorum) {\\n IQuorum quorum = new Quorum{salt: salt}(validators, epochLength);\\n\\n emit QuorumCreated(quorum);\\n\\n return quorum;\\n }\\n\\n function calculateQuorumAddress(\\n address[] calldata validators,\\n uint256 epochLength,\\n bytes32 salt\\n ) external view override returns (address) {\\n return\\n Create2.computeAddress(\\n salt,\\n keccak256(\\n abi.encodePacked(\\n type(Quorum).creationCode,\\n abi.encode(validators, epochLength)\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x515c9f35a19239c71437e975ab8e57e87790b55ab650f3d6ee039b6b47d49932\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610c90806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80632f74f86214610046578063ca8f271c14610075578063d4af3bc814610088575b600080fd5b6100596100543660046102bb565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b6100596100833660046102bb565b610123565b61005961009636600461030c565b6101a2565b600080828686866040516100ae90610262565b6100ba93929190610358565b8190604051809103906000f59050801580156100da573d6000803e3d6000fd5b506040516001600160a01b03821681529091507f446698b70271bce331e53210572bd37ac8c590b6cdca2e6763e6448243cba8029060200160405180910390a195945050505050565b6000610199826040518060200161013990610262565b601f1982820381018352601f90910116604081905261016090899089908990602001610358565b60408051601f198184030181529082905261017e92916020016103e4565b60405160208183030381529060405280519060200120610224565b95945050505050565b6000808484846040516101b490610262565b6101c093929190610358565b604051809103906000f0801580156101dc573d6000803e3d6000fd5b506040516001600160a01b03821681529091507f446698b70271bce331e53210572bd37ac8c590b6cdca2e6763e6448243cba8029060200160405180910390a1949350505050565b6000610231838330610238565b9392505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b6108598061040283390190565b60008083601f84011261028157600080fd5b50813567ffffffffffffffff81111561029957600080fd5b6020830191508360208260051b85010111156102b457600080fd5b9250929050565b600080600080606085870312156102d157600080fd5b843567ffffffffffffffff8111156102e857600080fd5b6102f48782880161026f565b90989097506020870135966040013595509350505050565b60008060006040848603121561032157600080fd5b833567ffffffffffffffff81111561033857600080fd5b6103448682870161026f565b909790965060209590950135949350505050565b604080825281018390526000846060830182805b878110156103a05783356001600160a01b03811680821461038b578384fd5b8452506020938401939092019160010161036c565b505060209390930193909352509392505050565b6000815160005b818110156103d557602081850181015186830152016103bb565b50600093019283525090919050565b60006103f96103f383866103b4565b846103b4565b94935050505056fe60c060405234801561001057600080fd5b5060405161085938038061085983398101604081905261002f9161016e565b80600081116100845760405162461bcd60e51b815260206004820152601d60248201527f65706f6368206c656e677468206d757374206e6f74206265207a65726f000000604482015260640160405180910390fd5b6080526000805b83518110156101305760008482815181106100a8576100a861023a565b6020026020010151905060016000826001600160a01b03166001600160a01b03168152602001908152602001600020546000036101275760006100ea84610250565b6001600160a01b03831660008181526001602090815260408083208590558483526002909152902080546001600160a01b03191690911790559350505b5060010161008b565b5060a052506102779050565b634e487b7160e01b600052604160045260246000fd5b80516001600160a01b038116811461016957600080fd5b919050565b6000806040838503121561018157600080fd5b82516001600160401b038082111561019857600080fd5b818501915085601f8301126101ac57600080fd5b81516020828211156101c0576101c061013c565b8160051b604051601f19603f830116810181811086821117156101e5576101e561013c565b60405292835281830193508481018201928984111561020357600080fd5b948201945b838610156102285761021986610152565b85529482019493820193610208565b97909101519698969750505050505050565b634e487b7160e01b600052603260045260246000fd5b60006001820161027057634e487b7160e01b600052601160045260246000fd5b5060010190565b60805160a0516105b66102a36000396000818161010c01526102f70152600061019001526105b66000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c80636470af001161005b5780636470af00146101535780637051bfd5146101685780639618f35b1461017b578063cfe8a73b1461018e57600080fd5b80630a6f1fe81461008d5780631c45396a146100c95780631e526e451461010a5780634b84231c14610130575b600080fd5b6100b661009b36600461044b565b6001600160a01b031660009081526001602052604090205490565b6040519081526020015b60405180910390f35b6100f26100d736600461046d565b6000908152600260205260409020546001600160a01b031690565b6040516001600160a01b0390911681526020016100c0565b7f00000000000000000000000000000000000000000000000000000000000000006100b6565b61014361013e366004610486565b6101b4565b60405190151581526020016100c0565b6101666101613660046104bf565b6101f1565b005b6100b66101763660046104bf565b610353565b6101436101893660046104f2565b610369565b7f00000000000000000000000000000000000000000000000000000000000000006100b6565b60006101e8826101c5878787610395565b600882901c60009081526001918201602052604090205460ff9092161b16151590565b95945050505050565b33600090815260016020526040902054806102525760405162461bcd60e51b815260206004820152601f60248201527f51756f72756d3a2063616c6c6572206973206e6f742076616c696461746f7200604482015260640160405180910390fd5b60408051848152602081018490526001600160a01b0386169133917ff5a28e07a1b89d1ca3f9a2a7ef16bd650503a4791baf2e70dc401c21ee505f0a910160405180910390a360006102a5858585610395565b600883901c6000908152600180830160205260409091205491925060ff84161b1661034c57600882901c600090815260018281016020526040909120805460ff85169290921b909117905561031b60027f0000000000000000000000000000000000000000000000000000000000000000610532565b610326906001610554565b816000016000815461033790610567565b91829055500361034c5761034c8585856103c7565b5050505050565b6000610360848484610395565b54949350505050565b6001600160a01b03821660009081526020818152604080832084845290915290205460ff165b92915050565b6001600160a01b0383166000908152600360209081526040808320858452825280832084845290915290209392505050565b6001600160a01b038316600081815260208181526040808320858452825291829020805460ff1916600117905581518581529081018490527fd3e4892959c6ddb27e02bcaaebc0c1898d0f677b7360bf80339f10a8717957d3910160405180910390a2505050565b80356001600160a01b038116811461044657600080fd5b919050565b60006020828403121561045d57600080fd5b6104668261042f565b9392505050565b60006020828403121561047f57600080fd5b5035919050565b6000806000806080858703121561049c57600080fd5b6104a58561042f565b966020860135965060408601359560600135945092505050565b6000806000606084860312156104d457600080fd5b6104dd8461042f565b95602085013595506040909401359392505050565b6000806040838503121561050557600080fd5b61050e8361042f565b946020939093013593505050565b634e487b7160e01b600052601160045260246000fd5b60008261054f57634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561038f5761038f61051c565b6000600182016105795761057961051c565b506001019056fea2646970667358221220642bb94e1d4dd60f0c8a41a3a000c90390997995461f65183db6e55f56e5032864736f6c63430008170033a264697066735822122056fc82af8dbf74e096ba755e657baedd2a8684ccc11e63a53a44d8ceb691249e64736f6c63430008170033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80632f74f86214610046578063ca8f271c14610075578063d4af3bc814610088575b600080fd5b6100596100543660046102bb565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b6100596100833660046102bb565b610123565b61005961009636600461030c565b6101a2565b600080828686866040516100ae90610262565b6100ba93929190610358565b8190604051809103906000f59050801580156100da573d6000803e3d6000fd5b506040516001600160a01b03821681529091507f446698b70271bce331e53210572bd37ac8c590b6cdca2e6763e6448243cba8029060200160405180910390a195945050505050565b6000610199826040518060200161013990610262565b601f1982820381018352601f90910116604081905261016090899089908990602001610358565b60408051601f198184030181529082905261017e92916020016103e4565b60405160208183030381529060405280519060200120610224565b95945050505050565b6000808484846040516101b490610262565b6101c093929190610358565b604051809103906000f0801580156101dc573d6000803e3d6000fd5b506040516001600160a01b03821681529091507f446698b70271bce331e53210572bd37ac8c590b6cdca2e6763e6448243cba8029060200160405180910390a1949350505050565b6000610231838330610238565b9392505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b6108598061040283390190565b60008083601f84011261028157600080fd5b50813567ffffffffffffffff81111561029957600080fd5b6020830191508360208260051b85010111156102b457600080fd5b9250929050565b600080600080606085870312156102d157600080fd5b843567ffffffffffffffff8111156102e857600080fd5b6102f48782880161026f565b90989097506020870135966040013595509350505050565b60008060006040848603121561032157600080fd5b833567ffffffffffffffff81111561033857600080fd5b6103448682870161026f565b909790965060209590950135949350505050565b604080825281018390526000846060830182805b878110156103a05783356001600160a01b03811680821461038b578384fd5b8452506020938401939092019160010161036c565b505060209390930193909352509392505050565b6000815160005b818110156103d557602081850181015186830152016103bb565b50600093019283525090919050565b60006103f96103f383866103b4565b846103b4565b94935050505056fe60c060405234801561001057600080fd5b5060405161085938038061085983398101604081905261002f9161016e565b80600081116100845760405162461bcd60e51b815260206004820152601d60248201527f65706f6368206c656e677468206d757374206e6f74206265207a65726f000000604482015260640160405180910390fd5b6080526000805b83518110156101305760008482815181106100a8576100a861023a565b6020026020010151905060016000826001600160a01b03166001600160a01b03168152602001908152602001600020546000036101275760006100ea84610250565b6001600160a01b03831660008181526001602090815260408083208590558483526002909152902080546001600160a01b03191690911790559350505b5060010161008b565b5060a052506102779050565b634e487b7160e01b600052604160045260246000fd5b80516001600160a01b038116811461016957600080fd5b919050565b6000806040838503121561018157600080fd5b82516001600160401b038082111561019857600080fd5b818501915085601f8301126101ac57600080fd5b81516020828211156101c0576101c061013c565b8160051b604051601f19603f830116810181811086821117156101e5576101e561013c565b60405292835281830193508481018201928984111561020357600080fd5b948201945b838610156102285761021986610152565b85529482019493820193610208565b97909101519698969750505050505050565b634e487b7160e01b600052603260045260246000fd5b60006001820161027057634e487b7160e01b600052601160045260246000fd5b5060010190565b60805160a0516105b66102a36000396000818161010c01526102f70152600061019001526105b66000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c80636470af001161005b5780636470af00146101535780637051bfd5146101685780639618f35b1461017b578063cfe8a73b1461018e57600080fd5b80630a6f1fe81461008d5780631c45396a146100c95780631e526e451461010a5780634b84231c14610130575b600080fd5b6100b661009b36600461044b565b6001600160a01b031660009081526001602052604090205490565b6040519081526020015b60405180910390f35b6100f26100d736600461046d565b6000908152600260205260409020546001600160a01b031690565b6040516001600160a01b0390911681526020016100c0565b7f00000000000000000000000000000000000000000000000000000000000000006100b6565b61014361013e366004610486565b6101b4565b60405190151581526020016100c0565b6101666101613660046104bf565b6101f1565b005b6100b66101763660046104bf565b610353565b6101436101893660046104f2565b610369565b7f00000000000000000000000000000000000000000000000000000000000000006100b6565b60006101e8826101c5878787610395565b600882901c60009081526001918201602052604090205460ff9092161b16151590565b95945050505050565b33600090815260016020526040902054806102525760405162461bcd60e51b815260206004820152601f60248201527f51756f72756d3a2063616c6c6572206973206e6f742076616c696461746f7200604482015260640160405180910390fd5b60408051848152602081018490526001600160a01b0386169133917ff5a28e07a1b89d1ca3f9a2a7ef16bd650503a4791baf2e70dc401c21ee505f0a910160405180910390a360006102a5858585610395565b600883901c6000908152600180830160205260409091205491925060ff84161b1661034c57600882901c600090815260018281016020526040909120805460ff85169290921b909117905561031b60027f0000000000000000000000000000000000000000000000000000000000000000610532565b610326906001610554565b816000016000815461033790610567565b91829055500361034c5761034c8585856103c7565b5050505050565b6000610360848484610395565b54949350505050565b6001600160a01b03821660009081526020818152604080832084845290915290205460ff165b92915050565b6001600160a01b0383166000908152600360209081526040808320858452825280832084845290915290209392505050565b6001600160a01b038316600081815260208181526040808320858452825291829020805460ff1916600117905581518581529081018490527fd3e4892959c6ddb27e02bcaaebc0c1898d0f677b7360bf80339f10a8717957d3910160405180910390a2505050565b80356001600160a01b038116811461044657600080fd5b919050565b60006020828403121561045d57600080fd5b6104668261042f565b9392505050565b60006020828403121561047f57600080fd5b5035919050565b6000806000806080858703121561049c57600080fd5b6104a58561042f565b966020860135965060408601359560600135945092505050565b6000806000606084860312156104d457600080fd5b6104dd8461042f565b95602085013595506040909401359392505050565b6000806040838503121561050557600080fd5b61050e8361042f565b946020939093013593505050565b634e487b7160e01b600052601160045260246000fd5b60008261054f57634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561038f5761038f61051c565b6000600182016105795761057961051c565b506001019056fea2646970667358221220642bb94e1d4dd60f0c8a41a3a000c90390997995461f65183db6e55f56e5032864736f6c63430008170033a264697066735822122056fc82af8dbf74e096ba755e657baedd2a8684ccc11e63a53a44d8ceb691249e64736f6c63430008170033", "devdoc": { "events": { "QuorumCreated(address)": { @@ -115,9 +130,10 @@ }, "kind": "dev", "methods": { - "calculateQuorumAddress(address[],bytes32)": { + "calculateQuorumAddress(address[],uint256,bytes32)": { "details": "Beware that only the `newQuorum` function with the `salt` parameter is able to deterministically deploy a quorum.", "params": { + "epochLength": "The epoch length", "salt": "The salt used to deterministically generate the quorum address", "validators": "the list of validators" }, @@ -125,18 +141,20 @@ "_0": "The deterministic quorum address" } }, - "newQuorum(address[])": { - "details": "On success, MUST emit a `QuorumCreated` event.", + "newQuorum(address[],uint256)": { + "details": "On success, MUST emit a `QuorumCreated` event.Duplicates in the `validators` array are ignored.Reverts if the epoch length is zero.", "params": { + "epochLength": "The epoch length", "validators": "the list of validators" }, "returns": { "_0": "The quorum" } }, - "newQuorum(address[],bytes32)": { - "details": "On success, MUST emit a `QuorumCreated` event.", + "newQuorum(address[],uint256,bytes32)": { + "details": "On success, MUST emit a `QuorumCreated` event.Duplicates in the `validators` array are ignored.Reverts if the epoch length is zero.", "params": { + "epochLength": "The epoch length", "salt": "The salt used to deterministically generate the quorum address", "validators": "the list of validators" }, @@ -156,17 +174,17 @@ }, "kind": "user", "methods": { - "calculateQuorumAddress(address[],bytes32)": { + "calculateQuorumAddress(address[],uint256,bytes32)": { "notice": "Calculate the address of a quorum to be deployed deterministically." }, - "newQuorum(address[])": { + "newQuorum(address[],uint256)": { "notice": "Deploy a new quorum." }, - "newQuorum(address[],bytes32)": { + "newQuorum(address[],uint256,bytes32)": { "notice": "Deploy a new quorum deterministically." } }, - "notice": "Allows anyone to reliably deploy a new `Quorum` contract.", + "notice": "Allows anyone to reliably deploy a new `IQuorum` contract.", "version": 1 }, "storageLayout": { diff --git a/deployments/sepolia/SelfHostedApplicationFactory.json b/deployments/sepolia/SelfHostedApplicationFactory.json index fe1c134b..9eb7cbdb 100644 --- a/deployments/sepolia/SelfHostedApplicationFactory.json +++ b/deployments/sepolia/SelfHostedApplicationFactory.json @@ -1,5 +1,5 @@ { - "address": "0x1fD0E73b5739eDBdf978e3ad2063F86cF78056aF", + "address": "0x4C11C7F82D6D56a726f9B53dd99af031AFd86BB6", "abi": [ { "inputs": [ @@ -25,14 +25,9 @@ "type": "address" }, { - "internalType": "contract IInputBox", - "name": "inputBox", - "type": "address" - }, - { - "internalType": "contract IPortal[]", - "name": "portals", - "type": "address[]" + "internalType": "uint256", + "name": "epochLength", + "type": "uint256" }, { "internalType": "address", @@ -74,14 +69,9 @@ "type": "address" }, { - "internalType": "contract IInputBox", - "name": "inputBox", - "type": "address" - }, - { - "internalType": "contract IPortal[]", - "name": "portals", - "type": "address[]" + "internalType": "uint256", + "name": "epochLength", + "type": "uint256" }, { "internalType": "address", @@ -102,12 +92,12 @@ "name": "deployContracts", "outputs": [ { - "internalType": "contract Application", + "internalType": "contract IApplication", "name": "application", "type": "address" }, { - "internalType": "contract Authority", + "internalType": "contract IAuthority", "name": "authority", "type": "address" } @@ -142,40 +132,39 @@ "type": "function" } ], - "transactionHash": "0x806741d143e9db10024f2287c61a71184faf1bb5dfd181c6b7e4343bdceed7cb", + "transactionHash": "0xbc436779033c32f27cd3ab4023ede74412d3b58c08fdd41d0bfe64318132d3e5", "receipt": { "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0xB25D9D56f5877Ca869A0362c324aCC2F1465AF1B", + "from": "0xeA4037a524309056545fbAd9A688f449E7e05ffB", "contractAddress": null, - "transactionIndex": 62, - "gasUsed": "358661", + "transactionIndex": 28, + "gasUsed": "287274", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x2cab91b65b490686b44379485d18ec8470ea1f7a66b089faec6f71832b7fcaf9", - "transactionHash": "0x806741d143e9db10024f2287c61a71184faf1bb5dfd181c6b7e4343bdceed7cb", + "blockHash": "0x8582ae68ab2c3b8964cee7ff57e62141bc790382ebd984186733a1a630d33df9", + "transactionHash": "0xbc436779033c32f27cd3ab4023ede74412d3b58c08fdd41d0bfe64318132d3e5", "logs": [], - "blockNumber": 6099865, - "cumulativeGasUsed": "5111897", + "blockNumber": 6850945, + "cumulativeGasUsed": "5431630", "status": 1, "byzantium": true }, "args": [ - "0xFc6c1Fc6546898eb2f9cb7De360B3eA52E601D46", - "0x159876e08d642c2Fe9a52804756189E1DbF497F0" + "0xB897F7Fe78f220aE34B7FA9493092701a873Ed45", + "0x1d4CfBD2622d802A07CeB4C3401Bbb455c9dbdC3" ], - "numDeployments": 1, - "solcInputHash": "d5e580c56a1973c1da5089d8c687e7bd", - "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IAuthorityFactory\",\"name\":\"authorityFactory\",\"type\":\"address\"},{\"internalType\":\"contract IApplicationFactory\",\"name\":\"applicationFactory\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"authorityOwner\",\"type\":\"address\"},{\"internalType\":\"contract IInputBox\",\"name\":\"inputBox\",\"type\":\"address\"},{\"internalType\":\"contract IPortal[]\",\"name\":\"portals\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"appOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"templateHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"}],\"name\":\"calculateAddresses\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"application\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"authority\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"authorityOwner\",\"type\":\"address\"},{\"internalType\":\"contract IInputBox\",\"name\":\"inputBox\",\"type\":\"address\"},{\"internalType\":\"contract IPortal[]\",\"name\":\"portals\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"appOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"templateHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"}],\"name\":\"deployContracts\",\"outputs\":[{\"internalType\":\"contract Application\",\"name\":\"application\",\"type\":\"address\"},{\"internalType\":\"contract Authority\",\"name\":\"authority\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getApplicationFactory\",\"outputs\":[{\"internalType\":\"contract IApplicationFactory\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAuthorityFactory\",\"outputs\":[{\"internalType\":\"contract IAuthorityFactory\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"calculateAddresses(address,address,address[],address,bytes32,bytes32)\":{\"params\":{\"appOwner\":\"The initial Application owner\",\"authorityOwner\":\"The initial authority owner\",\"inputBox\":\"The input box contract\",\"portals\":\"The portals supported by the application\",\"salt\":\"The salt used to deterministically generate the addresses\",\"templateHash\":\"The initial machine state hash\"},\"returns\":{\"application\":\"The application address\",\"authority\":\"The authority address\"}},\"constructor\":{\"params\":{\"applicationFactory\":\"The application factory\",\"authorityFactory\":\"The authority factory\"}},\"deployContracts(address,address,address[],address,bytes32,bytes32)\":{\"params\":{\"appOwner\":\"The initial Application owner\",\"authorityOwner\":\"The initial authority owner\",\"inputBox\":\"The input box contract\",\"portals\":\"The portals supported by the application\",\"salt\":\"The salt used to deterministically generate the addresses\",\"templateHash\":\"The initial machine state hash\"},\"returns\":{\"application\":\"The application contract\",\"authority\":\"The authority contract\"}},\"getApplicationFactory()\":{\"returns\":{\"_0\":\"The application factory\"}},\"getAuthorityFactory()\":{\"returns\":{\"_0\":\"The authority factory\"}}},\"title\":\"Self-hosted Application Factory\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"calculateAddresses(address,address,address[],address,bytes32,bytes32)\":{\"notice\":\"Calculate the addresses of the application and authority contracts to be deployed deterministically.\"},\"deployContracts(address,address,address[],address,bytes32,bytes32)\":{\"notice\":\"Deploy new application and authority contracts deterministically.\"},\"getApplicationFactory()\":{\"notice\":\"Get the factory used to deploy `Application` contracts\"},\"getAuthorityFactory()\":{\"notice\":\"Get the factory used to deploy `Authority` contracts\"}},\"notice\":\"Allows anyone to reliably deploy a new Authority contract, along with an Application contract already linked to it.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dapp/SelfHostedApplicationFactory.sol\":\"SelfHostedApplicationFactory\"},\"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 v5.0.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {Context} from \\\"../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 * The initial owner is set to the address provided by the deployer. This can\\n * 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 /**\\n * @dev The caller account is not authorized to perform an operation.\\n */\\n error OwnableUnauthorizedAccount(address account);\\n\\n /**\\n * @dev The owner is not a valid owner account. (eg. `address(0)`)\\n */\\n error OwnableInvalidOwner(address owner);\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\\n */\\n constructor(address initialOwner) {\\n if (initialOwner == address(0)) {\\n revert OwnableInvalidOwner(address(0));\\n }\\n _transferOwnership(initialOwner);\\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 if (owner() != _msgSender()) {\\n revert OwnableUnauthorizedAccount(_msgSender());\\n }\\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 if (newOwner == address(0)) {\\n revert OwnableInvalidOwner(address(0));\\n }\\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\":\"0xff6d0bb2e285473e5311d9d3caacb525ae3538a80758c10649a4d61029b017bb\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155Receiver.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Interface that must be implemented by smart contracts in order to receive\\n * ERC-1155 token transfers.\\n */\\ninterface IERC1155Receiver is IERC165 {\\n /**\\n * @dev Handles the receipt of a single ERC1155 token type. This function is\\n * called at the end of a `safeTransferFrom` after the balance has been updated.\\n *\\n * NOTE: To accept the transfer, this must return\\n * `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))`\\n * (i.e. 0xf23a6e61, or its own function selector).\\n *\\n * @param operator The address which initiated the transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param id The ID of the token being transferred\\n * @param value The amount of tokens being transferred\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155Received(\\n address operator,\\n address from,\\n uint256 id,\\n uint256 value,\\n bytes calldata data\\n ) external returns (bytes4);\\n\\n /**\\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\\n * is called at the end of a `safeBatchTransferFrom` after the balances have\\n * been updated.\\n *\\n * NOTE: To accept the transfer(s), this must return\\n * `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))`\\n * (i.e. 0xbc197c81, or its own function selector).\\n *\\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155BatchReceived(\\n address operator,\\n address from,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xb69597a63b202e28401128bed6a6d259e8730191274471af7303eafb247881a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/utils/ERC1155Holder.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165, ERC165} from \\\"../../../utils/introspection/ERC165.sol\\\";\\nimport {IERC1155Receiver} from \\\"../IERC1155Receiver.sol\\\";\\n\\n/**\\n * @dev Simple implementation of `IERC1155Receiver` that will allow a contract to hold ERC1155 tokens.\\n *\\n * IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be\\n * stuck.\\n */\\nabstract contract ERC1155Holder is ERC165, IERC1155Receiver {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\\n return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n function onERC1155Received(\\n address,\\n address,\\n uint256,\\n uint256,\\n bytes memory\\n ) public virtual override returns (bytes4) {\\n return this.onERC1155Received.selector;\\n }\\n\\n function onERC1155BatchReceived(\\n address,\\n address,\\n uint256[] memory,\\n uint256[] memory,\\n bytes memory\\n ) public virtual override returns (bytes4) {\\n return this.onERC1155BatchReceived.selector;\\n }\\n}\\n\",\"keccak256\":\"0xc26cd2e2bcf59b87c986fc653545b35010db9c585a3f3312fe61d7b1b3805735\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be\\n * reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0x7f7a26306c79a65fb8b3b6c757cd74660c532cd8a02e165488e30027dd34ca49\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/utils/ERC721Holder.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC721Receiver} from \\\"../IERC721Receiver.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC721Receiver} interface.\\n *\\n * Accepts all token transfers.\\n * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or\\n * {IERC721-setApprovalForAll}.\\n */\\nabstract contract ERC721Holder is IERC721Receiver {\\n /**\\n * @dev See {IERC721Receiver-onERC721Received}.\\n *\\n * Always returns `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(address, address, uint256, bytes memory) public virtual returns (bytes4) {\\n return this.onERC721Received.selector;\\n }\\n}\\n\",\"keccak256\":\"0xaad20f8713b5cd98114278482d5d91b9758f9727048527d582e8e88fd4901fd8\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\\n\\npragma solidity ^0.8.20;\\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 function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant NOT_ENTERED = 1;\\n uint256 private constant ENTERED = 2;\\n\\n uint256 private _status;\\n\\n /**\\n * @dev Unauthorized reentrant call.\\n */\\n error ReentrancyGuardReentrantCall();\\n\\n constructor() {\\n _status = NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and making it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n _nonReentrantBefore();\\n _;\\n _nonReentrantAfter();\\n }\\n\\n function _nonReentrantBefore() private {\\n // On the first call to nonReentrant, _status will be NOT_ENTERED\\n if (_status == ENTERED) {\\n revert ReentrancyGuardReentrantCall();\\n }\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = ENTERED;\\n }\\n\\n function _nonReentrantAfter() private {\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Returns true if the reentrancy guard is currently set to \\\"entered\\\", which indicates there is a\\n * `nonReentrant` function in the call stack.\\n */\\n function _reentrancyGuardEntered() internal view returns (bool) {\\n return _status == ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0xf980daa263b661ab8ddee7d4fd833c7da7e7995e2c359ff1f17e67e4112f2236\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0x9e8778b14317ba9e256c30a76fd6c32b960af621987f56069e1e819c77c6a133\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x4296879f55019b23e135000eb36896057e7101fb7fb859c5ef690cf14643757b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/structs/BitMaps.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/BitMaps.sol)\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Library for managing uint256 to bool mapping in a compact and efficient way, provided the keys are sequential.\\n * Largely inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor].\\n *\\n * BitMaps pack 256 booleans across each bit of a single 256-bit slot of `uint256` type.\\n * Hence booleans corresponding to 256 _sequential_ indices would only consume a single slot,\\n * unlike the regular `bool` which would consume an entire slot for a single value.\\n *\\n * This results in gas savings in two ways:\\n *\\n * - Setting a zero value to non-zero only once every 256 times\\n * - Accessing the same warm slot for every 256 _sequential_ indices\\n */\\nlibrary BitMaps {\\n struct BitMap {\\n mapping(uint256 bucket => uint256) _data;\\n }\\n\\n /**\\n * @dev Returns whether the bit at `index` is set.\\n */\\n function get(BitMap storage bitmap, uint256 index) internal view returns (bool) {\\n uint256 bucket = index >> 8;\\n uint256 mask = 1 << (index & 0xff);\\n return bitmap._data[bucket] & mask != 0;\\n }\\n\\n /**\\n * @dev Sets the bit at `index` to the boolean `value`.\\n */\\n function setTo(BitMap storage bitmap, uint256 index, bool value) internal {\\n if (value) {\\n set(bitmap, index);\\n } else {\\n unset(bitmap, index);\\n }\\n }\\n\\n /**\\n * @dev Sets the bit at `index`.\\n */\\n function set(BitMap storage bitmap, uint256 index) internal {\\n uint256 bucket = index >> 8;\\n uint256 mask = 1 << (index & 0xff);\\n bitmap._data[bucket] |= mask;\\n }\\n\\n /**\\n * @dev Unsets the bit at `index`.\\n */\\n function unset(BitMap storage bitmap, uint256 index) internal {\\n uint256 bucket = index >> 8;\\n uint256 mask = 1 << (index & 0xff);\\n bitmap._data[bucket] &= ~mask;\\n }\\n}\\n\",\"keccak256\":\"0x3616f1b0d0a9ee1ca8f0953ecaceb9230e36f691c7974d30f964212acff52d2b\",\"license\":\"MIT\"},\"contracts/common/CanonicalMachine.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 Canonical Machine Constants Library\\n///\\n/// @notice Defines several constants related to the reference implementation\\n/// of the RISC-V machine that runs Linux, also known as the \\\"Cartesi Machine\\\".\\nlibrary CanonicalMachine {\\n /// @notice Maximum input size (2 megabytes).\\n uint256 constant INPUT_MAX_SIZE = 1 << 21;\\n\\n /// @notice Log of maximum number of inputs per epoch.\\n uint256 constant LOG2_MAX_INPUTS_PER_EPOCH = 32;\\n\\n /// @notice Log of maximum number of outputs per input.\\n uint256 constant LOG2_MAX_OUTPUTS_PER_INPUT = 16;\\n}\\n\",\"keccak256\":\"0xad91c1e0080fd40f53def31cb87106dedef26fc506aa569f43a77b8fcdc53a77\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/common/InputRange.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/// @notice A range of input indices.\\n/// @param firstIndex The index of the first input\\n/// @param lastIndex The index of the last input\\nstruct InputRange {\\n uint64 firstIndex;\\n uint64 lastIndex;\\n}\\n\",\"keccak256\":\"0x4825516380f1fb39d5b15e99c1b08e07c636dc062ad3036093e78ba8e624cd33\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/common/OutputValidityProof.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 {InputRange} from \\\"./InputRange.sol\\\";\\n\\n/// @param inputRange The range of inputs accepted during the epoch\\n/// @param inputIndexWithinEpoch Which input, inside the epoch, the output belongs to\\n/// @param outputIndexWithinInput Index of output emitted by the input\\n/// @param outputHashesRootHash Merkle root of hashes of outputs emitted by the input\\n/// @param outputsEpochRootHash Merkle root of all epoch's outputs metadata hashes\\n/// @param machineStateHash Hash of the machine state claimed this epoch\\n/// @param outputHashInOutputHashesSiblings Proof that this output metadata is in metadata memory range\\n/// @param outputHashesInEpochSiblings Proof that this output metadata is in epoch's output memory range\\nstruct OutputValidityProof {\\n InputRange inputRange;\\n uint64 inputIndexWithinEpoch;\\n uint64 outputIndexWithinInput;\\n bytes32 outputHashesRootHash;\\n bytes32 outputsEpochRootHash;\\n bytes32 machineStateHash;\\n bytes32[] outputHashInOutputHashesSiblings;\\n bytes32[] outputHashesInEpochSiblings;\\n}\\n\",\"keccak256\":\"0xf60efcea5b54d6b5c659460fc205ae04b16d89c72dee86e7b2c1e1edb6a52d65\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/common/Outputs.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 Outputs\\n/// @notice Defines the signatures of outputs that can be generated by the\\n/// off-chain machine and verified by the on-chain contracts.\\ninterface Outputs {\\n /// @notice A piece of verifiable information.\\n /// @param payload An arbitrary payload.\\n function Notice(bytes calldata payload) external;\\n\\n /// @notice A single-use permission to execute a specific message call\\n /// from the context of the application contract.\\n /// @param destination The address that will be called\\n /// @param value The amount of Wei to be transferred through the call\\n /// @param payload The payload, which\\u2014in the case of Solidity\\n /// contracts\\u2014encodes a function call\\n function Voucher(\\n address destination,\\n uint256 value,\\n bytes calldata payload\\n ) external;\\n\\n /// @notice A single-use permission to execute a specific delegate call\\n /// from the context of the application contract.\\n /// @param destination The address that will be called\\n /// @param payload The payload, which\\u2014in the case of Solidity\\n /// libraries\\u2014encodes a function call\\n function DelegateCallVoucher(\\n address destination,\\n bytes calldata payload\\n ) external;\\n}\\n\",\"keccak256\":\"0xaee9d71104bfe2fab21d4e26f3ed802439d6c2e1bc5aeb9bfc5090f4083bd542\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"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\\\";\\nimport {InputRange} from \\\"../common/InputRange.sol\\\";\\n\\n/// @notice Stores epoch hashes for several applications and input ranges.\\n/// @dev This contract was designed to be inherited by implementations of the `IConsensus` interface\\n/// that only need a simple mechanism of storage and retrieval of epoch hashes.\\nabstract contract AbstractConsensus is IConsensus {\\n /// @notice Indexes epoch hashes by application contract address, first input index and last input index.\\n mapping(address => mapping(uint256 => mapping(uint256 => bytes32)))\\n private _epochHashes;\\n\\n /// @notice Get the epoch hash for a certain application and input range.\\n /// @param appContract The application contract address\\n /// @param r The input range\\n /// @return epochHash The epoch hash\\n /// @dev For claimed epochs, returns the epoch hash of the last accepted claim.\\n /// @dev For unclaimed epochs, returns `bytes32(0)`.\\n function getEpochHash(\\n address appContract,\\n InputRange calldata r\\n ) public view override returns (bytes32 epochHash) {\\n epochHash = _epochHashes[appContract][r.firstIndex][r.lastIndex];\\n }\\n\\n /// @notice Accept a claim.\\n /// @param appContract The application contract address\\n /// @param r The input range\\n /// @param epochHash The epoch hash\\n /// @dev On successs, emits a `ClaimAcceptance` event.\\n function _acceptClaim(\\n address appContract,\\n InputRange calldata r,\\n bytes32 epochHash\\n ) internal {\\n _epochHashes[appContract][r.firstIndex][r.lastIndex] = epochHash;\\n emit ClaimAcceptance(appContract, r, epochHash);\\n }\\n}\\n\",\"keccak256\":\"0x2e41db152b70de9fe9917780efeba10ea3c0e1a1a2c96b158d81b1129a877eb5\",\"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\\nimport {InputRange} from \\\"../common/InputRange.sol\\\";\\n\\n/// @notice Provides data availability of epoch hashes for applications.\\n/// @notice An epoch hash is produced after the machine processes a range of inputs and the epoch is finalized.\\n/// This hash can be later used to prove that any given output was produced by the machine during the epoch.\\n/// @notice After an epoch is finalized, a validator may submit a claim containing the application contract address,\\n/// the range of inputs accepted during the epoch, and the epoch hash.\\n/// @notice Validators may synchronize epoch finalization, but such mechanism is not specified by this interface.\\n/// @notice A validator should be able to save transaction fees by not submitting a claim if it was...\\n/// - already submitted by the validator (see the `ClaimSubmission` event) or;\\n/// - already accepted by the consensus (see the `ClaimAcceptance` event).\\n/// @notice The acceptance criteria for claims may depend on the type of consensus, and is not specified by this interface.\\n/// For example, a claim may be accepted if it was...\\n/// - submitted by an authority or;\\n/// - submitted by the majority of a quorum or;\\n/// - submitted and not proven wrong after some period of time.\\ninterface IConsensus {\\n /// @notice MUST trigger when a claim is submitted.\\n /// @param submitter The submitter address\\n /// @param appContract The application contract address\\n /// @param inputRange The input range\\n /// @param epochHash The epoch hash\\n /// @dev Overwrites any previous submissions regarding `submitter`, `appContract` and `inputRange`.\\n event ClaimSubmission(\\n address indexed submitter,\\n address indexed appContract,\\n InputRange inputRange,\\n bytes32 epochHash\\n );\\n\\n /// @notice MUST trigger when a claim is accepted.\\n /// @param appContract The application contract address\\n /// @param inputRange The input range\\n /// @param epochHash The epoch hash\\n /// @dev MUST be triggered after some `ClaimSubmission` event regarding `appContract`, `inputRange` and `epochHash`.\\n /// @dev Overwrites any previous acceptances regarding `appContract` and `inputRange`.\\n event ClaimAcceptance(\\n address indexed appContract,\\n InputRange inputRange,\\n bytes32 epochHash\\n );\\n\\n /// @notice Submit a claim to the consensus.\\n /// @param appContract The application contract address\\n /// @param inputRange The input range\\n /// @param epochHash The epoch hash\\n /// @dev MUST fire a `ClaimSubmission` event.\\n /// @dev MAY fire a `ClaimAcceptance` event, if the acceptance criteria is met.\\n function submitClaim(\\n address appContract,\\n InputRange calldata inputRange,\\n bytes32 epochHash\\n ) external;\\n\\n /// @notice Get the epoch hash for a certain application and input range.\\n /// @param appContract The application contract address\\n /// @param inputRange The input range\\n /// @return epochHash The epoch hash\\n /// @dev For claimed epochs, must return the epoch hash of the last accepted claim.\\n /// @dev For unclaimed epochs, MUST either revert or return `bytes32(0)`.\\n function getEpochHash(\\n address appContract,\\n InputRange calldata inputRange\\n ) external view returns (bytes32 epochHash);\\n}\\n\",\"keccak256\":\"0xd2ea451e450f6b3b01bd77b95dbb00465d263cae9285a03c8ffd0d96c4d75dc1\",\"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\\\";\\n\\nimport {IConsensus} from \\\"../IConsensus.sol\\\";\\nimport {AbstractConsensus} from \\\"../AbstractConsensus.sol\\\";\\nimport {InputRange} from \\\"../../common/InputRange.sol\\\";\\n\\n/// @notice A consensus contract controlled by a single address, the owner.\\n/// @dev This contract inherits from OpenZeppelin's `Ownable` contract.\\n/// For more information on `Ownable`, please consult OpenZeppelin's official documentation.\\ncontract Authority is AbstractConsensus, Ownable {\\n /// @param initialOwner The initial contract owner\\n constructor(address initialOwner) Ownable(initialOwner) {}\\n\\n /// @notice Submit a claim.\\n /// @param appContract The application contract address\\n /// @param inputRange The input range\\n /// @param epochHash The epoch hash\\n /// @dev Fires a `ClaimSubmission` event and a `ClaimAcceptance` event.\\n /// @dev Can only be called by the owner.\\n function submitClaim(\\n address appContract,\\n InputRange calldata inputRange,\\n bytes32 epochHash\\n ) external override onlyOwner {\\n emit ClaimSubmission(msg.sender, appContract, inputRange, epochHash);\\n _acceptClaim(appContract, inputRange, epochHash);\\n }\\n}\\n\",\"keccak256\":\"0xe74884532170247ebc0abfd564a8415cac18fafe4e2a1c9a851a369dd7ee4539\",\"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\":\"0xb25511358cbebf34bbd3c6e518d55d0235bff4d25de414d96ce3468c7bf7d05a\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/Application.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 {IApplication} from \\\"./IApplication.sol\\\";\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {IPortal} from \\\"../portals/IPortal.sol\\\";\\nimport {LibOutputValidityProof} from \\\"../library/LibOutputValidityProof.sol\\\";\\nimport {OutputValidityProof} from \\\"../common/OutputValidityProof.sol\\\";\\nimport {Outputs} from \\\"../common/Outputs.sol\\\";\\nimport {InputRange} from \\\"../common/InputRange.sol\\\";\\nimport {LibInputRange} from \\\"../library/LibInputRange.sol\\\";\\nimport {LibAddress} from \\\"../library/LibAddress.sol\\\";\\n\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {ERC721Holder} from \\\"@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol\\\";\\nimport {ERC1155Holder} from \\\"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol\\\";\\nimport {ReentrancyGuard} from \\\"@openzeppelin/contracts/utils/ReentrancyGuard.sol\\\";\\nimport {IERC721Receiver} from \\\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\\\";\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport {BitMaps} from \\\"@openzeppelin/contracts/utils/structs/BitMaps.sol\\\";\\n\\ncontract Application is\\n IApplication,\\n Ownable,\\n ERC721Holder,\\n ERC1155Holder,\\n ReentrancyGuard\\n{\\n using BitMaps for BitMaps.BitMap;\\n using LibAddress for address;\\n using LibOutputValidityProof for OutputValidityProof;\\n using LibInputRange for InputRange;\\n\\n /// @notice The initial machine state hash.\\n /// @dev See the `getTemplateHash` function.\\n bytes32 internal immutable _templateHash;\\n\\n /// @notice Keeps track of which outputs have been executed.\\n /// @dev See the `wasOutputExecuted` function.\\n mapping(uint256 => BitMaps.BitMap) internal _executed;\\n\\n /// @notice The current consensus contract.\\n /// @dev See the `getConsensus` and `migrateToConsensus` functions.\\n IConsensus internal _consensus;\\n\\n /// @notice The input box contract.\\n /// @dev See the `getInputBox` function.\\n IInputBox internal immutable _inputBox;\\n\\n /// @notice The portals supported by the application.\\n /// @dev See the `getPortals` function.\\n IPortal[] internal _portals;\\n\\n /// @notice Creates an `Application` contract.\\n /// @param consensus The initial consensus contract\\n /// @param inputBox The input box contract\\n /// @param portals The portals supported by the application\\n /// @param initialOwner The initial application owner\\n /// @param templateHash The initial machine state hash\\n constructor(\\n IConsensus consensus,\\n IInputBox inputBox,\\n IPortal[] memory portals,\\n address initialOwner,\\n bytes32 templateHash\\n ) Ownable(initialOwner) {\\n _templateHash = templateHash;\\n _consensus = consensus;\\n _inputBox = inputBox;\\n for (uint256 i; i < portals.length; ++i) {\\n _portals.push(portals[i]);\\n }\\n }\\n\\n /// @notice Accept Ether transfers.\\n /// @dev If you wish to transfer Ether to an application while informing\\n /// the backend of it, then please do so through the Ether portal contract.\\n receive() external payable {}\\n\\n function executeOutput(\\n bytes calldata output,\\n OutputValidityProof calldata proof\\n ) external override nonReentrant {\\n validateOutput(output, proof);\\n\\n uint256 inputIndex = proof.calculateInputIndex();\\n uint64 outputIndexWithinInput = proof.outputIndexWithinInput;\\n\\n BitMaps.BitMap storage bitmap = _executed[outputIndexWithinInput];\\n\\n if (output.length < 4) {\\n revert OutputNotExecutable(output);\\n }\\n\\n bytes4 selector = bytes4(output[:4]);\\n bytes calldata arguments = output[4:];\\n\\n if (selector == Outputs.Voucher.selector) {\\n if (bitmap.get(inputIndex)) {\\n revert OutputNotReexecutable(output);\\n }\\n _executeVoucher(arguments);\\n } else if (selector == Outputs.DelegateCallVoucher.selector) {\\n if (bitmap.get(inputIndex)) {\\n revert OutputNotReexecutable(output);\\n }\\n _executeDelegateCallVoucher(arguments);\\n } else {\\n revert OutputNotExecutable(output);\\n }\\n\\n bitmap.set(inputIndex);\\n emit OutputExecuted(uint64(inputIndex), outputIndexWithinInput, output);\\n }\\n\\n function migrateToConsensus(\\n IConsensus newConsensus\\n ) external override onlyOwner {\\n _consensus = newConsensus;\\n emit NewConsensus(newConsensus);\\n }\\n\\n function wasOutputExecuted(\\n uint256 inputIndex,\\n uint256 outputIndexWithinInput\\n ) external view override returns (bool) {\\n return _executed[outputIndexWithinInput].get(inputIndex);\\n }\\n\\n function validateOutput(\\n bytes calldata output,\\n OutputValidityProof calldata proof\\n ) public view override {\\n uint256 inputIndex = proof.calculateInputIndex();\\n\\n if (!proof.inputRange.contains(inputIndex)) {\\n revert InputIndexOutOfRange(inputIndex, proof.inputRange);\\n }\\n\\n bytes32 outputHash = keccak256(output);\\n\\n if (!proof.isOutputHashesRootHashValid(outputHash)) {\\n revert IncorrectOutputHashesRootHash();\\n }\\n\\n if (!proof.isOutputsEpochRootHashValid()) {\\n revert IncorrectOutputsEpochRootHash();\\n }\\n\\n bytes32 epochHash = _getEpochHash(proof.inputRange);\\n\\n if (!proof.isEpochHashValid(epochHash)) {\\n revert IncorrectEpochHash();\\n }\\n }\\n\\n function getTemplateHash() external view override returns (bytes32) {\\n return _templateHash;\\n }\\n\\n function getConsensus() external view override returns (IConsensus) {\\n return _consensus;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return _inputBox;\\n }\\n\\n function getPortals() external view override returns (IPortal[] memory) {\\n return _portals;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view virtual override(ERC1155Holder, IERC165) returns (bool) {\\n return\\n interfaceId == type(IApplication).interfaceId ||\\n interfaceId == type(IERC721Receiver).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /// @notice Get the epoch hash regarding an input range from the current consensus.\\n /// @param inputRange The input range\\n /// @return The epoch hash\\n function _getEpochHash(\\n InputRange calldata inputRange\\n ) internal view returns (bytes32) {\\n return _consensus.getEpochHash(address(this), inputRange);\\n }\\n\\n /// @notice Executes a voucher\\n /// @param arguments ABI-encoded arguments\\n function _executeVoucher(bytes calldata arguments) internal {\\n address destination;\\n uint256 value;\\n bytes memory payload;\\n\\n (destination, value, payload) = abi.decode(\\n arguments,\\n (address, uint256, bytes)\\n );\\n\\n destination.safeCall(value, payload);\\n }\\n\\n /// @notice Executes a delegatecall voucher\\n /// @param arguments ABI-encoded arguments\\n function _executeDelegateCallVoucher(bytes calldata arguments) internal {\\n address destination;\\n bytes memory payload;\\n\\n (destination, payload) = abi.decode(arguments, (address, bytes));\\n\\n destination.safeDelegateCall(payload);\\n }\\n}\\n\",\"keccak256\":\"0x5119ba0344182acea4f1a5ce91c7386be17a48e4b2c9881f5a708a29357cc660\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/IApplication.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 {IERC1155Receiver} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\\\";\\nimport {IERC721Receiver} from \\\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\\\";\\n\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {IPortal} from \\\"../portals/IPortal.sol\\\";\\nimport {OutputValidityProof} from \\\"../common/OutputValidityProof.sol\\\";\\nimport {InputRange} from \\\"../common/InputRange.sol\\\";\\n\\n/// @notice The base layer incarnation of an application running on the execution layer.\\n/// @notice The state of the application advances through inputs sent to an `IInputBox` contract (see the `getInputBox` function).\\n/// @notice These inputs can be sent either directly, or indirectly through portals (see the `getPortals` function).\\n/// @notice Reader nodes can retrieve inputs sent to the `IInputBox` contract through events, and feed them into the machine.\\n/// @notice Validator nodes can also submit claims to the `IConsensus` contract (see the `getConsensus` function).\\n/// @notice Once accepted, claims can be used to validate outputs generated by the machine.\\n/// @notice Some outputs are executable, which means they can have on-chain side effects.\\n/// @notice Every application is subscribed to some consensus, and may be governed by some owner.\\n/// The consensus has the power to accept claims, which, in turn, are used to validate outputs.\\n/// Meanwhile, the owner can replace the consensus at any time.\\n/// Therefore, the users of an application must trust both the consensus and the application owner.\\n/// @notice There are several ownership models to choose from:\\n/// - no owner (address zero)\\n/// - individual signer (externally-owned account)\\n/// - multiple signers (multi-sig)\\n/// - DAO (decentralized autonomous organization)\\n/// - self-owned application (off-chain governance logic)\\n/// @notice See `IConsensus` for examples of consensus models.\\ninterface IApplication is IERC721Receiver, IERC1155Receiver {\\n // Events\\n\\n /// @notice MUST trigger when a new consensus is chosen.\\n /// @param newConsensus The new consensus\\n event NewConsensus(IConsensus newConsensus);\\n\\n /// @notice MUST trigger when an output is executed.\\n /// @param inputIndex The index of the input that emitted the output\\n /// @param outputIndexWithinInput The index of the output amongst all outputs emitted by the input\\n /// @param output The output\\n event OutputExecuted(\\n uint64 inputIndex,\\n uint64 outputIndexWithinInput,\\n bytes output\\n );\\n\\n // Errors\\n\\n /// @notice Could not validate an output because the input\\n /// that generated it is outside the input range of the epoch.\\n /// @param inputIndex The input index\\n /// @param inputRange The input range\\n error InputIndexOutOfRange(uint256 inputIndex, InputRange inputRange);\\n\\n /// @notice Could not execute an output, because the application contract doesn't know how to.\\n /// @param output The output\\n error OutputNotExecutable(bytes output);\\n\\n /// @notice Could not execute an output, because it was already executed.\\n /// @param output The output\\n error OutputNotReexecutable(bytes output);\\n\\n /// @notice Raised when some `OutputValidityProof` variables does not match\\n /// the presented finalized epoch.\\n error IncorrectEpochHash();\\n\\n /// @notice Raised when `OutputValidityProof` metadata memory range is NOT\\n /// contained in epoch's output memory range.\\n error IncorrectOutputsEpochRootHash();\\n\\n /// @notice Raised when Merkle root of output hash is NOT contained\\n /// in the output metadata array memory range.\\n error IncorrectOutputHashesRootHash();\\n\\n // Permissioned functions\\n\\n /// @notice Migrate the application to a new consensus.\\n /// @param newConsensus The new consensus\\n /// @dev Can only be called by the application owner.\\n function migrateToConsensus(IConsensus newConsensus) external;\\n\\n // Permissionless functions\\n\\n /// @notice Execute an output.\\n /// @param output The output\\n /// @param proof The proof used to validate the output against\\n /// a claim submitted by the current consensus contract\\n /// @dev On a successful execution, emits a `OutputExecuted` event.\\n /// @dev May raise any of the errors raised by `validateOutput`,\\n /// as well as `OutputNotExecutable` and `OutputNotReexecutable`.\\n function executeOutput(\\n bytes calldata output,\\n OutputValidityProof calldata proof\\n ) external;\\n\\n /// @notice Check whether an output has been executed.\\n /// @param inputIndex The index of the input in the input box\\n /// @param outputIndexWithinInput The index of output emitted by the input\\n /// @return Whether the output has been executed before\\n function wasOutputExecuted(\\n uint256 inputIndex,\\n uint256 outputIndexWithinInput\\n ) external view returns (bool);\\n\\n /// @notice Validate an output.\\n /// @param output The output\\n /// @param proof The proof used to validate the output against\\n /// a claim submitted by the current consensus contract\\n /// @dev May raise `InputIndexOutOfRange`, `IncorrectEpochHash`,\\n /// `IncorrectOutputsEpochRootHash`, or `IncorrectOutputHashesRootHash`.\\n function validateOutput(\\n bytes calldata output,\\n OutputValidityProof calldata proof\\n ) external view;\\n\\n /// @notice Get the application's template hash.\\n /// @return The application's template hash\\n function getTemplateHash() external view returns (bytes32);\\n\\n /// @notice Get the current consensus.\\n /// @return The current consensus\\n function getConsensus() external view returns (IConsensus);\\n\\n /// @notice Get the input box that the application is listening to.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n\\n /// @notice Get the portals that the application expects inputs from.\\n /// @return The portals.\\n function getPortals() external view returns (IPortal[] memory);\\n}\\n\",\"keccak256\":\"0xb7f77e632c14935998e986276cbea53e9a52bc576aae51cbc8c51cedcbafc6bc\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/IApplicationFactory.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 {Application} from \\\"./Application.sol\\\";\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {IPortal} from \\\"../portals/IPortal.sol\\\";\\n\\n/// @title Application Factory interface\\ninterface IApplicationFactory {\\n // Events\\n\\n /// @notice A new application was deployed.\\n /// @param consensus The initial consensus contract\\n /// @param inputBox The input box contract\\n /// @param portals The portals supported by the application\\n /// @param appOwner The initial application owner\\n /// @param templateHash The initial machine state hash\\n /// @param appContract The application contract\\n /// @dev MUST be triggered on a successful call to `newApplication`.\\n event ApplicationCreated(\\n IConsensus indexed consensus,\\n IInputBox inputBox,\\n IPortal[] portals,\\n address appOwner,\\n bytes32 templateHash,\\n Application appContract\\n );\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new application.\\n /// @param consensus The initial consensus contract\\n /// @param inputBox The input box contract\\n /// @param portals The portals supported by the application\\n /// @param appOwner The initial application owner\\n /// @param templateHash The initial machine state hash\\n /// @return The application\\n /// @dev On success, MUST emit an `ApplicationCreated` event.\\n function newApplication(\\n IConsensus consensus,\\n IInputBox inputBox,\\n IPortal[] calldata portals,\\n address appOwner,\\n bytes32 templateHash\\n ) external returns (Application);\\n\\n /// @notice Deploy a new application deterministically.\\n /// @param consensus The initial consensus contract\\n /// @param inputBox The input box contract\\n /// @param portals The portals supported by the application\\n /// @param appOwner The initial application owner\\n /// @param templateHash The initial machine state hash\\n /// @param salt The salt used to deterministically generate the application contract address\\n /// @return The application\\n /// @dev On success, MUST emit an `ApplicationCreated` event.\\n function newApplication(\\n IConsensus consensus,\\n IInputBox inputBox,\\n IPortal[] calldata portals,\\n address appOwner,\\n bytes32 templateHash,\\n bytes32 salt\\n ) external returns (Application);\\n\\n /// @notice Calculate the address of an application contract to be deployed deterministically.\\n /// @param consensus The initial consensus contract\\n /// @param inputBox The input box contract\\n /// @param portals The portals supported by the application\\n /// @param appOwner The initial application owner\\n /// @param templateHash The initial machine state hash\\n /// @param salt The salt used to deterministically generate the application contract address\\n /// @return The deterministic application contract address\\n /// @dev Beware that only the `newApplication` function with the `salt` parameter\\n /// is able to deterministically deploy an application.\\n function calculateApplicationAddress(\\n IConsensus consensus,\\n IInputBox inputBox,\\n IPortal[] calldata portals,\\n address appOwner,\\n bytes32 templateHash,\\n bytes32 salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0xc8124036aad5321f0c30692196984061f55c82599a8da5c83f10bcfa64403817\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/ISelfHostedApplicationFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0\\n\\npragma solidity ^0.8.8;\\n\\nimport {Authority} from \\\"../consensus/authority/Authority.sol\\\";\\nimport {IAuthorityFactory} from \\\"../consensus/authority/IAuthorityFactory.sol\\\";\\nimport {Application} from \\\"./Application.sol\\\";\\nimport {IApplicationFactory} from \\\"./IApplicationFactory.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {IPortal} from \\\"../portals/IPortal.sol\\\";\\n\\n/// @title Self-hosted Application Factory interface\\ninterface ISelfHostedApplicationFactory {\\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 `Application` contracts\\n /// @return The application factory\\n function getApplicationFactory()\\n external\\n view\\n returns (IApplicationFactory);\\n\\n /// @notice Deploy new application and authority contracts deterministically.\\n /// @param authorityOwner The initial authority owner\\n /// @param inputBox The input box contract\\n /// @param portals The portals supported by the application\\n /// @param appOwner The initial Application owner\\n /// @param templateHash The initial machine state hash\\n /// @param salt The salt used to deterministically generate the addresses\\n /// @return The application contract\\n /// @return The authority contract\\n function deployContracts(\\n address authorityOwner,\\n IInputBox inputBox,\\n IPortal[] calldata portals,\\n address appOwner,\\n bytes32 templateHash,\\n bytes32 salt\\n ) external returns (Application, Authority);\\n\\n /// @notice Calculate the addresses of the application and authority contracts\\n /// to be deployed deterministically.\\n /// @param authorityOwner The initial authority owner\\n /// @param inputBox The input box contract\\n /// @param portals The portals supported by the application\\n /// @param appOwner The initial Application owner\\n /// @param templateHash The initial machine state hash\\n /// @param salt The salt used to deterministically generate the addresses\\n /// @return The application address\\n /// @return The authority address\\n function calculateAddresses(\\n address authorityOwner,\\n IInputBox inputBox,\\n IPortal[] calldata portals,\\n address appOwner,\\n bytes32 templateHash,\\n bytes32 salt\\n ) external view returns (address, address);\\n}\\n\",\"keccak256\":\"0x3b75e98ec240be8969c0b1330f6a04ccd7d65dfac299a24155180bf28fc06336\",\"license\":\"Apache-2.0\"},\"contracts/dapp/SelfHostedApplicationFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0\\n\\npragma solidity ^0.8.8;\\n\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\nimport {Authority} from \\\"../consensus/authority/Authority.sol\\\";\\nimport {IAuthorityFactory} from \\\"../consensus/authority/IAuthorityFactory.sol\\\";\\nimport {Application} from \\\"./Application.sol\\\";\\nimport {IApplicationFactory} from \\\"./IApplicationFactory.sol\\\";\\nimport {ISelfHostedApplicationFactory} from \\\"./ISelfHostedApplicationFactory.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {IPortal} from \\\"../portals/IPortal.sol\\\";\\n\\n/// @title Self-hosted Application Factory\\n/// @notice Allows anyone to reliably deploy a new Authority contract,\\n/// along with an Application contract already linked to it.\\ncontract SelfHostedApplicationFactory is ISelfHostedApplicationFactory {\\n IAuthorityFactory immutable _authorityFactory;\\n IApplicationFactory immutable _applicationFactory;\\n\\n /// @param authorityFactory The authority factory\\n /// @param applicationFactory The application factory\\n constructor(\\n IAuthorityFactory authorityFactory,\\n IApplicationFactory applicationFactory\\n ) {\\n _authorityFactory = authorityFactory;\\n _applicationFactory = applicationFactory;\\n }\\n\\n function getAuthorityFactory()\\n external\\n view\\n override\\n returns (IAuthorityFactory)\\n {\\n return _authorityFactory;\\n }\\n\\n function getApplicationFactory()\\n external\\n view\\n override\\n returns (IApplicationFactory)\\n {\\n return _applicationFactory;\\n }\\n\\n function deployContracts(\\n address authorityOwner,\\n IInputBox inputBox,\\n IPortal[] memory portals,\\n address appOwner,\\n bytes32 templateHash,\\n bytes32 salt\\n ) external returns (Application application, Authority authority) {\\n authority = _authorityFactory.newAuthority(authorityOwner, salt);\\n\\n application = _applicationFactory.newApplication(\\n authority,\\n inputBox,\\n portals,\\n appOwner,\\n templateHash,\\n salt\\n );\\n }\\n\\n function calculateAddresses(\\n address authorityOwner,\\n IInputBox inputBox,\\n IPortal[] memory portals,\\n address appOwner,\\n bytes32 templateHash,\\n bytes32 salt\\n ) external view returns (address application, address authority) {\\n authority = _authorityFactory.calculateAuthorityAddress(\\n authorityOwner,\\n salt\\n );\\n\\n application = _applicationFactory.calculateApplicationAddress(\\n IConsensus(authority),\\n inputBox,\\n portals,\\n appOwner,\\n templateHash,\\n salt\\n );\\n }\\n}\\n\",\"keccak256\":\"0xf52c824ffab63f5cacf299c133b2c38298814ace781ce13e04598bca2bb8036d\",\"license\":\"Apache-2.0\"},\"contracts/inputs/IInputBox.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/// @notice Provides data availability of inputs for applications.\\n/// @notice Each application has its own append-only list of inputs.\\n/// @notice Off-chain, inputs can be retrieved via events.\\n/// @notice On-chain, only the input hashes are stored.\\n/// @notice See `LibInput` for more details on how such hashes are computed.\\ninterface IInputBox {\\n /// @notice MUST trigger when an input is added.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @param input The input blob\\n event InputAdded(\\n address indexed appContract,\\n uint256 indexed index,\\n bytes input\\n );\\n\\n /// @notice Input is too large.\\n /// @param appContract The application contract address\\n /// @param inputLength The input length\\n /// @param maxInputLength The maximum input length\\n error InputTooLarge(\\n address appContract,\\n uint256 inputLength,\\n uint256 maxInputLength\\n );\\n\\n /// @notice Send an input to an application.\\n /// @param appContract The application contract address\\n /// @param payload The input payload\\n /// @return The hash of the input blob\\n /// @dev MUST fire an `InputAdded` event.\\n function addInput(\\n address appContract,\\n bytes calldata payload\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs sent to an application.\\n /// @param appContract The application contract address\\n function getNumberOfInputs(\\n address appContract\\n ) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in an application's input box.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @dev The provided index must be valid.\\n function getInputHash(\\n address appContract,\\n uint256 index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xae7730cd7ab2b31a86d7c4933215853ea6c0b1b4dc60d4ec24e5cfc2ec005fe3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/library/LibAddress.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 {LibError} from \\\"../library/LibError.sol\\\";\\n\\nlibrary LibAddress {\\n using LibError for bytes;\\n\\n /// @notice Perform a low level call and raise error if failed\\n /// @param destination The address that will be called\\n /// @param value The amount of Wei to be transferred through the call\\n /// @param payload The payload, which\\u2014in the case of Solidity\\n /// contracts\\u2014encodes a function call\\n function safeCall(\\n address destination,\\n uint256 value,\\n bytes memory payload\\n ) internal {\\n bool success;\\n bytes memory returndata;\\n\\n (success, returndata) = destination.call{value: value}(payload);\\n\\n if (!success) {\\n returndata.raise();\\n }\\n }\\n\\n /// @notice Perform a delegate call and raise error if failed\\n /// @param destination The address that will be called\\n /// @param payload The payload, which\\u2014in the case of Solidity\\n /// libraries\\u2014encodes a function call\\n function safeDelegateCall(\\n address destination,\\n bytes memory payload\\n ) internal {\\n bool success;\\n bytes memory returndata;\\n\\n (success, returndata) = destination.delegatecall(payload);\\n\\n if (!success) {\\n returndata.raise();\\n }\\n }\\n}\\n\",\"keccak256\":\"0xcae26d227ecb61fe953e6a5937037529b02fd929f6857151661121d6d233c0ac\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/library/LibError.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\\nlibrary LibError {\\n /// @notice Raise error data\\n /// @param errordata Data returned by failed low-level call\\n function raise(bytes memory errordata) internal pure {\\n if (errordata.length == 0) {\\n revert();\\n } else {\\n assembly {\\n revert(add(32, errordata), mload(errordata))\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3d5f9497f40e172fe1a0b9e2635cd4b14c4c3d16bcfd851db034273573aae37d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/library/LibInputRange.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 {InputRange} from \\\"../common/InputRange.sol\\\";\\n\\nlibrary LibInputRange {\\n /// @notice Check if an input range contains an input.\\n /// @param r The input range\\n /// @param inputIndex The input index\\n /// @return Whether the input range contains the input.\\n function contains(\\n InputRange calldata r,\\n uint256 inputIndex\\n ) internal pure returns (bool) {\\n return r.firstIndex <= inputIndex && inputIndex <= r.lastIndex;\\n }\\n}\\n\",\"keccak256\":\"0x30e95c1eb8b8f45bf4bc02c26e2b69a949025fa1bb34cb804137d7e2d229aa78\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/library/LibMerkle32.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.22;\\n\\n/// @title Merkle library for trees of 32-byte leaves\\n/// @notice This library is meant for creating and verifying Merkle proofs.\\n/// @notice Each Merkle tree is assumed to have `2^height` leaves.\\n/// @notice Nodes are concatenated pairwise and hashed with `keccak256`.\\n/// @notice Siblings are in bottom-up order, from leaf to root.\\nlibrary LibMerkle32 {\\n using LibMerkle32 for bytes32[];\\n\\n /// @notice Compute the root of a Merkle tree from its leaves.\\n /// @param leaves The left-most leaves of the Merkle tree\\n /// @param height The height of the Merkle tree\\n /// @return The root hash of the Merkle tree\\n /// @dev Raises an error if more than `2^height` leaves are provided.\\n function merkleRoot(\\n bytes32[] memory leaves,\\n uint256 height\\n ) internal pure returns (bytes32) {\\n bytes32 defaultNode;\\n for (uint256 i; i < height; ++i) {\\n leaves = leaves.parentLevel(defaultNode);\\n defaultNode = parent(defaultNode, defaultNode);\\n }\\n require(leaves.length <= 1, \\\"LibMerkle32: too many leaves\\\");\\n return leaves.at(0, defaultNode);\\n }\\n\\n /// @notice Compute the siblings of the ancestors of a leaf in a Merkle tree.\\n /// @param leaves The left-most leaves of the Merkle tree\\n /// @param index The index of the leaf\\n /// @param height The height of the Merkle tree\\n /// @return The siblings of the ancestors of the leaf in bottom-up order\\n /// @dev Raises an error if the provided index is out of bounds.\\n /// @dev Raises an error if more than `2^height` leaves are provided.\\n function siblings(\\n bytes32[] memory leaves,\\n uint256 index,\\n uint256 height\\n ) internal pure returns (bytes32[] memory) {\\n bytes32[] memory sibs = new bytes32[](height);\\n bytes32 defaultNode;\\n for (uint256 i; i < height; ++i) {\\n sibs[i] = leaves.at(index ^ 1, defaultNode);\\n leaves = leaves.parentLevel(defaultNode);\\n defaultNode = parent(defaultNode, defaultNode);\\n index >>= 1;\\n }\\n require(index == 0, \\\"LibMerkle32: index out of bounds\\\");\\n require(leaves.length <= 1, \\\"LibMerkle32: too many leaves\\\");\\n return sibs;\\n }\\n\\n /// @notice Compute the root of a Merkle tree after replacing one of its leaves.\\n /// @param sibs The siblings of the ancestors of the leaf in bottom-up order\\n /// @param index The index of the leaf\\n /// @param leaf The new leaf\\n /// @return The root hash of the new Merkle tree\\n /// @dev Raises an error if the provided index is out of bounds.\\n function merkleRootAfterReplacement(\\n bytes32[] calldata sibs,\\n uint256 index,\\n bytes32 leaf\\n ) internal pure returns (bytes32) {\\n uint256 height = sibs.length;\\n for (uint256 i; i < height; ++i) {\\n bytes32 sibling = sibs[i];\\n if (index & 1 == 0) {\\n leaf = parent(leaf, sibling);\\n } else {\\n leaf = parent(sibling, leaf);\\n }\\n index >>= 1;\\n }\\n require(index == 0, \\\"LibMerkle32: index out of bounds\\\");\\n return leaf;\\n }\\n\\n /// @notice Compute the parent of two nodes.\\n /// @param leftNode The left node\\n /// @param rightNode The right node\\n /// @return parentNode The parent node\\n /// @dev Uses assembly for extra performance\\n function parent(\\n bytes32 leftNode,\\n bytes32 rightNode\\n ) internal pure returns (bytes32 parentNode) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(0x00, leftNode)\\n mstore(0x20, rightNode)\\n parentNode := keccak256(0x00, 0x40)\\n }\\n }\\n\\n /// @notice Compute the parent level of an array of nodes.\\n /// @param nodes The array of left-most nodes\\n /// @param defaultNode The default node after the array\\n /// @return The left-most nodes of the parent level\\n /// @dev The default node of a parent level is\\n /// the parent node of two default nodes.\\n function parentLevel(\\n bytes32[] memory nodes,\\n bytes32 defaultNode\\n ) internal pure returns (bytes32[] memory) {\\n uint256 n = (nodes.length + 1) / 2; // ceil(#nodes / 2)\\n bytes32[] memory level = new bytes32[](n);\\n for (uint256 i; i < n; ++i) {\\n bytes32 leftLeaf = nodes[2 * i];\\n bytes32 rightLeaf = nodes.at(2 * i + 1, defaultNode);\\n level[i] = parent(leftLeaf, rightLeaf);\\n }\\n return level;\\n }\\n\\n /// @notice Get the node at some index\\n /// @param nodes The array of left-most nodes\\n /// @param index The index of the node\\n /// @param defaultNode The default node after the array\\n function at(\\n bytes32[] memory nodes,\\n uint256 index,\\n bytes32 defaultNode\\n ) internal pure returns (bytes32) {\\n if (index < nodes.length) {\\n return nodes[index];\\n } else {\\n return defaultNode;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x47ec1967c131735784544d1e1610a4eca01d54198411184f5e16c8662c5b63e7\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/library/LibOutputValidityProof.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 {CanonicalMachine} from \\\"../common/CanonicalMachine.sol\\\";\\nimport {Outputs} from \\\"../common/Outputs.sol\\\";\\nimport {OutputValidityProof} from \\\"../common/OutputValidityProof.sol\\\";\\n\\nimport {LibMerkle32} from \\\"./LibMerkle32.sol\\\";\\n\\nlibrary LibOutputValidityProof {\\n using LibMerkle32 for bytes32[];\\n\\n /// @notice Check if epoch hash is valid\\n /// @param v The output validity proof\\n /// @param epochHash The epoch hash\\n function isEpochHashValid(\\n OutputValidityProof calldata v,\\n bytes32 epochHash\\n ) internal pure returns (bool) {\\n return\\n epochHash ==\\n keccak256(abi.encode(v.outputsEpochRootHash, v.machineStateHash));\\n }\\n\\n /// @notice Check if the outputs epoch root hash is valid\\n /// @param v The output validity proof\\n function isOutputsEpochRootHashValid(\\n OutputValidityProof calldata v\\n ) internal pure returns (bool) {\\n bytes32[] calldata siblings = v.outputHashesInEpochSiblings;\\n return\\n (siblings.length == CanonicalMachine.LOG2_MAX_INPUTS_PER_EPOCH) &&\\n (v.outputsEpochRootHash ==\\n siblings.merkleRootAfterReplacement(\\n v.inputIndexWithinEpoch,\\n v.outputHashesRootHash\\n ));\\n }\\n\\n /// @notice Check if the output hashes root hash is valid\\n /// @param v The output validity proof\\n /// @param outputHash The output hash\\n function isOutputHashesRootHashValid(\\n OutputValidityProof calldata v,\\n bytes32 outputHash\\n ) internal pure returns (bool) {\\n bytes32[] calldata siblings = v.outputHashInOutputHashesSiblings;\\n return\\n (siblings.length == CanonicalMachine.LOG2_MAX_OUTPUTS_PER_INPUT) &&\\n (v.outputHashesRootHash ==\\n siblings.merkleRootAfterReplacement(\\n v.outputIndexWithinInput,\\n outputHash\\n ));\\n }\\n\\n /// @notice Calculate the input index\\n /// @param v The output validity proof\\n /// @return The input index\\n function calculateInputIndex(\\n OutputValidityProof calldata v\\n ) internal pure returns (uint256) {\\n return uint256(v.inputRange.firstIndex) + v.inputIndexWithinEpoch;\\n }\\n}\\n\",\"keccak256\":\"0x2719d93756e4477a7827c455a55f08066da64257a9570a867df3fbf2022217b8\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IPortal.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 {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\n/// @title Portal interface\\ninterface IPortal is IERC165 {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this portal.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0xbc364030939ea4a214e2f3673eaca1c500fcfd4929239a3b5d804ffc5687ed37\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60c060405234801561001057600080fd5b5060405161065138038061065183398101604081905261002f9161005e565b6001600160a01b039182166080521660a052610098565b6001600160a01b038116811461005b57600080fd5b50565b6000806040838503121561007157600080fd5b825161007c81610046565b602084015190925061008d81610046565b809150509250929050565b60805160a05161057a6100d76000396000818160c5015281816101ae01526102eb0152600081816053015281816101270152610267015261057a6000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806375689f8314610051578063c03db64f14610090578063e63d50ff146100c3578063ea60bcb9146100e9575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b0390911681526020015b60405180910390f35b6100a361009e366004610385565b6100fc565b604080516001600160a01b03938416815292909116602083015201610087565b7f0000000000000000000000000000000000000000000000000000000000000000610073565b6100a36100f7366004610385565b61023d565b604051635a3f27d360e01b81526001600160a01b0387811660048301526024820183905260009182917f00000000000000000000000000000000000000000000000000000000000000001690635a3f27d3906044016020604051808303816000875af1158015610170573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101949190610494565b6040516303557d6760e01b81529091506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906303557d67906101ed9084908b908b908b908b908b906004016104fd565b6020604051808303816000875af115801561020c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102309190610494565b9150965096945050505050565b604051622715e160e21b81526001600160a01b0387811660048301526024820183905260009182917f00000000000000000000000000000000000000000000000000000000000000001690629c578490604401602060405180830381865afa1580156102ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d19190610494565b60405163f63adead60e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063f63adead9061032a9084908b908b908b908b908b906004016104fd565b602060405180830381865afa15801561020c573d6000803e3d6000fd5b6001600160a01b038116811461035c57600080fd5b50565b803561036a81610347565b919050565b634e487b7160e01b600052604160045260246000fd5b60008060008060008060c0878903121561039e57600080fd5b86356103a981610347565b95506020878101356103ba81610347565b9550604088013567ffffffffffffffff808211156103d757600080fd5b818a0191508a601f8301126103eb57600080fd5b8135818111156103fd576103fd61036f565b8060051b604051601f19603f830116810181811085821117156104225761042261036f565b60405291825284820192508381018501918d83111561044057600080fd5b938501935b82851015610465576104568561035f565b84529385019392850192610445565b80995050505050505061047a6060880161035f565b92506080870135915060a087013590509295509295509295565b6000602082840312156104a657600080fd5b81516104b181610347565b9392505050565b60008151808452602080850194506020840160005b838110156104f25781516001600160a01b0316875295820195908201906001016104cd565b509495945050505050565b600060018060a01b038089168352808816602084015260c0604084015261052760c08401886104b8565b9516606083015250608081019290925260a090910152939250505056fea2646970667358221220e42a7dc01ef56a32cca5105f756721819ca0448d27d0e1cf6b071de6f3bfa42e64736f6c63430008170033", - "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806375689f8314610051578063c03db64f14610090578063e63d50ff146100c3578063ea60bcb9146100e9575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b0390911681526020015b60405180910390f35b6100a361009e366004610385565b6100fc565b604080516001600160a01b03938416815292909116602083015201610087565b7f0000000000000000000000000000000000000000000000000000000000000000610073565b6100a36100f7366004610385565b61023d565b604051635a3f27d360e01b81526001600160a01b0387811660048301526024820183905260009182917f00000000000000000000000000000000000000000000000000000000000000001690635a3f27d3906044016020604051808303816000875af1158015610170573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101949190610494565b6040516303557d6760e01b81529091506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906303557d67906101ed9084908b908b908b908b908b906004016104fd565b6020604051808303816000875af115801561020c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102309190610494565b9150965096945050505050565b604051622715e160e21b81526001600160a01b0387811660048301526024820183905260009182917f00000000000000000000000000000000000000000000000000000000000000001690629c578490604401602060405180830381865afa1580156102ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d19190610494565b60405163f63adead60e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063f63adead9061032a9084908b908b908b908b908b906004016104fd565b602060405180830381865afa15801561020c573d6000803e3d6000fd5b6001600160a01b038116811461035c57600080fd5b50565b803561036a81610347565b919050565b634e487b7160e01b600052604160045260246000fd5b60008060008060008060c0878903121561039e57600080fd5b86356103a981610347565b95506020878101356103ba81610347565b9550604088013567ffffffffffffffff808211156103d757600080fd5b818a0191508a601f8301126103eb57600080fd5b8135818111156103fd576103fd61036f565b8060051b604051601f19603f830116810181811085821117156104225761042261036f565b60405291825284820192508381018501918d83111561044057600080fd5b938501935b82851015610465576104568561035f565b84529385019392850192610445565b80995050505050505061047a6060880161035f565b92506080870135915060a087013590509295509295509295565b6000602082840312156104a657600080fd5b81516104b181610347565b9392505050565b60008151808452602080850194506020840160005b838110156104f25781516001600160a01b0316875295820195908201906001016104cd565b509495945050505050565b600060018060a01b038089168352808816602084015260c0604084015261052760c08401886104b8565b9516606083015250608081019290925260a090910152939250505056fea2646970667358221220e42a7dc01ef56a32cca5105f756721819ca0448d27d0e1cf6b071de6f3bfa42e64736f6c63430008170033", + "numDeployments": 2, + "solcInputHash": "84178fc6607cf74ce859566da2e849ce", + "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IAuthorityFactory\",\"name\":\"authorityFactory\",\"type\":\"address\"},{\"internalType\":\"contract IApplicationFactory\",\"name\":\"applicationFactory\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"authorityOwner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"epochLength\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"appOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"templateHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"}],\"name\":\"calculateAddresses\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"application\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"authority\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"authorityOwner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"epochLength\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"appOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"templateHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"}],\"name\":\"deployContracts\",\"outputs\":[{\"internalType\":\"contract IApplication\",\"name\":\"application\",\"type\":\"address\"},{\"internalType\":\"contract IAuthority\",\"name\":\"authority\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getApplicationFactory\",\"outputs\":[{\"internalType\":\"contract IApplicationFactory\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAuthorityFactory\",\"outputs\":[{\"internalType\":\"contract IAuthorityFactory\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"calculateAddresses(address,uint256,address,bytes32,bytes32)\":{\"params\":{\"appOwner\":\"The initial application owner\",\"authorityOwner\":\"The initial authority owner\",\"epochLength\":\"The epoch length\",\"salt\":\"The salt used to deterministically generate the addresses\",\"templateHash\":\"The initial machine state hash\"},\"returns\":{\"application\":\"The application address\",\"authority\":\"The authority address\"}},\"constructor\":{\"params\":{\"applicationFactory\":\"The application factory\",\"authorityFactory\":\"The authority factory\"}},\"deployContracts(address,uint256,address,bytes32,bytes32)\":{\"details\":\"Reverts if the authority owner address is zero.Reverts if the application owner address is zero.Reverts if the epoch length is zero.\",\"params\":{\"appOwner\":\"The initial application owner\",\"authorityOwner\":\"The initial authority owner\",\"epochLength\":\"The epoch length\",\"salt\":\"The salt used to deterministically generate the addresses\",\"templateHash\":\"The initial machine state hash\"},\"returns\":{\"application\":\"The application contract\",\"authority\":\"The authority contract\"}},\"getApplicationFactory()\":{\"returns\":{\"_0\":\"The application factory\"}},\"getAuthorityFactory()\":{\"returns\":{\"_0\":\"The authority factory\"}}},\"title\":\"Self-hosted Application Factory\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"calculateAddresses(address,uint256,address,bytes32,bytes32)\":{\"notice\":\"Calculate the addresses of the application and authority contracts to be deployed deterministically.\"},\"deployContracts(address,uint256,address,bytes32,bytes32)\":{\"notice\":\"Deploy new application and authority contracts deterministically.\"},\"getApplicationFactory()\":{\"notice\":\"Get the factory used to deploy `IApplication` contracts\"},\"getAuthorityFactory()\":{\"notice\":\"Get the factory used to deploy `IAuthority` contracts\"}},\"notice\":\"Allows anyone to reliably deploy a new IAuthority contract, along with an IApplication contract already linked to it.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dapp/SelfHostedApplicationFactory.sol\":\"SelfHostedApplicationFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/access/IOwnable.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/// @notice The interface of OpenZeppelin's `Ownable` contract.\\ninterface IOwnable {\\n function owner() external view returns (address);\\n function renounceOwnership() external;\\n function transferOwnership(address newOwner) external;\\n}\\n\",\"keccak256\":\"0x826f366603fe6fd715bd912d40e9b4e851c110aea5895522523d800015532f6d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/common/OutputValidityProof.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/// @notice Proof of inclusion of an output in the output Merkle tree.\\n/// @param outputIndex Index of output in the Merkle tree\\n/// @param outputHashesSiblings Siblings of the output in the Merkle tree\\n/// @dev From the index and siblings, one can calculate the root of the Merkle tree.\\n/// @dev The siblings array should have size equal to the log2 of the maximum number of outputs.\\n/// @dev See the `CanonicalMachine` library for constants.\\nstruct OutputValidityProof {\\n uint64 outputIndex;\\n bytes32[] outputHashesSiblings;\\n}\\n\",\"keccak256\":\"0x3bd009e3b744e160f92a84624f8c325b5a6abc8f4e8e02e4a1b8a6de73779c1c\",\"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/// @notice Each application has its own stream of inputs.\\n/// See the `IInputBox` interface for calldata-based on-chain data availability.\\n/// @notice When an input is fed to the application, it may yield several outputs.\\n/// @notice Since genesis, a Merkle tree of all outputs ever produced is maintained\\n/// both inside and outside the Cartesi Machine.\\n/// @notice The claim that validators may submit to the consensus contract\\n/// is the root of this Merkle tree after processing all base layer blocks until some height.\\n/// @notice A validator should be able to save transaction fees by not submitting a claim if it was...\\n/// - already submitted by the validator (see the `ClaimSubmission` event) or;\\n/// - already accepted by the consensus (see the `ClaimAcceptance` event).\\n/// @notice The acceptance criteria for claims may depend on the type of consensus, and is not specified by this interface.\\n/// For example, a claim may be accepted if it was...\\n/// - submitted by an authority or;\\n/// - submitted by the majority of a quorum or;\\n/// - submitted and not proven wrong after some period of time or;\\n/// - submitted and proven correct through an on-chain tournament.\\ninterface IConsensus {\\n /// @notice MUST trigger when a claim is submitted.\\n /// @param submitter The submitter address\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The root of the Merkle tree of outputs\\n event ClaimSubmission(\\n address indexed submitter,\\n address indexed appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n );\\n\\n /// @notice MUST trigger when a claim is accepted.\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The root of the Merkle tree of outputs\\n event ClaimAcceptance(\\n address indexed appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n );\\n\\n /// @notice Submit a claim to the consensus.\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The root of the Merkle tree of outputs\\n /// @dev MUST fire a `ClaimSubmission` event.\\n /// @dev MAY fire a `ClaimAcceptance` event, if the acceptance criteria is met.\\n function submitClaim(\\n address appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n ) external;\\n\\n /// @notice Check if an output Merkle root hash was ever accepted by the consensus\\n /// for a particular application.\\n /// @param appContract The application contract address\\n /// @param claim The root of the Merkle tree of outputs\\n function wasClaimAccepted(\\n address appContract,\\n bytes32 claim\\n ) external view returns (bool);\\n\\n /// @notice Get the epoch length, in number of base layer blocks.\\n /// @dev The epoch number of a block is defined as\\n /// the integer division of the block number by the epoch length.\\n function getEpochLength() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x33ef3c4e213b2a3489b37d5ef553dc1165c598c56beb0ed8290723a5c74d821c\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/IAuthority.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 {IOwnable} from \\\"../../access/IOwnable.sol\\\";\\nimport {IConsensus} from \\\"../IConsensus.sol\\\";\\n\\n/// @notice A consensus contract controlled by a single address, the owner.\\ninterface IAuthority is IConsensus, IOwnable {}\\n\",\"keccak256\":\"0x6b63b7eb9c7deac1184052e58a2fba6e45bc630f1a38225d35cafbd0d5b98b04\",\"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 {IAuthority} from \\\"./IAuthority.sol\\\";\\n\\n/// @title Authority Factory interface\\ninterface IAuthorityFactory {\\n // Events\\n\\n /// @notice A new authority was deployed.\\n /// @param authority The authority\\n /// @dev MUST be triggered on a successful call to `newAuthority`.\\n event AuthorityCreated(IAuthority authority);\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new authority.\\n /// @param authorityOwner The initial authority owner\\n /// @param epochLength The epoch length\\n /// @return The authority\\n /// @dev On success, MUST emit an `AuthorityCreated` event.\\n /// @dev Reverts if the authority owner address is zero.\\n /// @dev Reverts if the epoch length is zero.\\n function newAuthority(\\n address authorityOwner,\\n uint256 epochLength\\n ) external returns (IAuthority);\\n\\n /// @notice Deploy a new authority deterministically.\\n /// @param authorityOwner The initial authority owner\\n /// @param epochLength The epoch length\\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 /// @dev Reverts if the authority owner address is zero.\\n /// @dev Reverts if the epoch length is zero.\\n function newAuthority(\\n address authorityOwner,\\n uint256 epochLength,\\n bytes32 salt\\n ) external returns (IAuthority);\\n\\n /// @notice Calculate the address of an authority to be deployed deterministically.\\n /// @param authorityOwner The initial authority owner\\n /// @param epochLength The epoch length\\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 uint256 epochLength,\\n bytes32 salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x05bde19d7cbd2bed92a9d81baa60b7e24b00b99f3656b67515b0903e5a920d46\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/IApplication.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 {IOwnable} from \\\"../access/IOwnable.sol\\\";\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\nimport {OutputValidityProof} from \\\"../common/OutputValidityProof.sol\\\";\\n\\n/// @notice The base layer incarnation of an application running on the execution layer.\\n/// @notice The state of the application advances through inputs sent to an `IInputBox` contract.\\n/// @notice These inputs can be sent either directly, or indirectly through portals.\\n/// @notice Reader nodes can retrieve inputs sent to the `IInputBox` contract through events, and feed them into the machine.\\n/// @notice Validator nodes can also submit claims to the `IConsensus` contract (see the `getConsensus` function).\\n/// @notice Once accepted, claims can be used to validate outputs generated by the machine.\\n/// @notice Some outputs are executable, which means they can have on-chain side effects.\\n/// @notice Every application is subscribed to some consensus, and may be governed by some owner.\\n/// The consensus has the power to accept claims, which, in turn, are used to validate outputs.\\n/// Meanwhile, the owner can replace the consensus at any time.\\n/// Therefore, the users of an application must trust both the consensus and the application owner.\\n/// @notice There are several ownership models to choose from:\\n/// - no owner (address zero)\\n/// - individual signer (externally-owned account)\\n/// - multiple signers (multi-sig)\\n/// - DAO (decentralized autonomous organization)\\n/// - self-owned application (off-chain governance logic)\\n/// @notice See `IConsensus` for examples of consensus models.\\ninterface IApplication is IOwnable {\\n // Events\\n\\n /// @notice MUST trigger when a new consensus is chosen.\\n /// @param newConsensus The new consensus\\n event NewConsensus(IConsensus newConsensus);\\n\\n /// @notice MUST trigger when an output is executed.\\n /// @param outputIndex The index of the output\\n /// @param output The output\\n event OutputExecuted(uint64 outputIndex, bytes output);\\n\\n // Errors\\n\\n /// @notice Could not execute an output, because the application contract doesn't know how to.\\n /// @param output The output\\n error OutputNotExecutable(bytes output);\\n\\n /// @notice Could not execute an output, because it was already executed.\\n /// @param output The output\\n error OutputNotReexecutable(bytes output);\\n\\n /// @notice Raised when the output hashes siblings array has an invalid size.\\n /// @dev Please consult `CanonicalMachine` for the maximum number of outputs.\\n error InvalidOutputHashesSiblingsArrayLength();\\n\\n /// @notice Raised when the required claim was not accepted by the current consensus.\\n error ClaimNotAccepted(bytes32 claim);\\n\\n // Permissioned functions\\n\\n /// @notice Migrate the application to a new consensus.\\n /// @param newConsensus The new consensus\\n /// @dev Can only be called by the application owner.\\n function migrateToConsensus(IConsensus newConsensus) external;\\n\\n // Permissionless functions\\n\\n /// @notice Execute an output.\\n /// @param output The output\\n /// @param proof The proof used to validate the output against\\n /// a claim submitted to the current consensus contract\\n /// @dev On a successful execution, emits a `OutputExecuted` event.\\n /// @dev May raise any of the errors raised by `validateOutput`,\\n /// as well as `OutputNotExecutable` and `OutputNotReexecutable`.\\n function executeOutput(\\n bytes calldata output,\\n OutputValidityProof calldata proof\\n ) external;\\n\\n /// @notice Check whether an output has been executed.\\n /// @param outputIndex The index of output\\n /// @return Whether the output has been executed before\\n function wasOutputExecuted(\\n uint256 outputIndex\\n ) external view returns (bool);\\n\\n /// @notice Validate an output.\\n /// @param output The output\\n /// @param proof The proof used to validate the output against\\n /// a claim submitted to the current consensus contract\\n /// @dev May raise any of the errors raised by `validateOutputHash`.\\n function validateOutput(\\n bytes calldata output,\\n OutputValidityProof calldata proof\\n ) external view;\\n\\n /// @notice Validate an output hash.\\n /// @param outputHash The output hash\\n /// @param proof The proof used to validate the output against\\n /// a claim submitted to the current consensus contract\\n /// @dev May raise `InvalidOutputHashesSiblingsArrayLength`\\n /// or `ClaimNotAccepted`.\\n function validateOutputHash(\\n bytes32 outputHash,\\n OutputValidityProof calldata proof\\n ) external view;\\n\\n /// @notice Get the application's template hash.\\n /// @return The application's template hash\\n function getTemplateHash() external view returns (bytes32);\\n\\n /// @notice Get the current consensus.\\n /// @return The current consensus\\n function getConsensus() external view returns (IConsensus);\\n}\\n\",\"keccak256\":\"0x64ca7d1d00fe6eebb633ba07011bd73036360166bd8b75755f55e8f0f51c45ab\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/IApplicationFactory.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 {IApplication} from \\\"./IApplication.sol\\\";\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\n\\n/// @title Application Factory interface\\ninterface IApplicationFactory {\\n // Events\\n\\n /// @notice A new application was deployed.\\n /// @param consensus The initial consensus contract\\n /// @param appOwner The initial application owner\\n /// @param templateHash The initial machine state hash\\n /// @param appContract The application contract\\n /// @dev MUST be triggered on a successful call to `newApplication`.\\n event ApplicationCreated(\\n IConsensus indexed consensus,\\n address appOwner,\\n bytes32 templateHash,\\n IApplication appContract\\n );\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new application.\\n /// @param consensus The initial consensus contract\\n /// @param appOwner The initial application owner\\n /// @param templateHash The initial machine state hash\\n /// @return The application\\n /// @dev On success, MUST emit an `ApplicationCreated` event.\\n /// @dev Reverts if the application owner address is zero.\\n function newApplication(\\n IConsensus consensus,\\n address appOwner,\\n bytes32 templateHash\\n ) external returns (IApplication);\\n\\n /// @notice Deploy a new application deterministically.\\n /// @param consensus The initial consensus contract\\n /// @param appOwner The initial application owner\\n /// @param templateHash The initial machine state hash\\n /// @param salt The salt used to deterministically generate the application contract address\\n /// @return The application\\n /// @dev On success, MUST emit an `ApplicationCreated` event.\\n /// @dev Reverts if the application owner address is zero.\\n function newApplication(\\n IConsensus consensus,\\n address appOwner,\\n bytes32 templateHash,\\n bytes32 salt\\n ) external returns (IApplication);\\n\\n /// @notice Calculate the address of an application contract to be deployed deterministically.\\n /// @param consensus The initial consensus contract\\n /// @param appOwner The initial application owner\\n /// @param templateHash The initial machine state hash\\n /// @param salt The salt used to deterministically generate the application contract address\\n /// @return The deterministic application contract address\\n /// @dev Beware that only the `newApplication` function with the `salt` parameter\\n /// is able to deterministically deploy an application.\\n function calculateApplicationAddress(\\n IConsensus consensus,\\n address appOwner,\\n bytes32 templateHash,\\n bytes32 salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x8b3aab57aebe723265d1b1cad7c5d4c8ad944850b8b7c92f3c9cfade75f27197\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/ISelfHostedApplicationFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0\\n\\npragma solidity ^0.8.8;\\n\\nimport {IAuthority} from \\\"../consensus/authority/IAuthority.sol\\\";\\nimport {IAuthorityFactory} from \\\"../consensus/authority/IAuthorityFactory.sol\\\";\\nimport {IApplication} from \\\"./IApplication.sol\\\";\\nimport {IApplicationFactory} from \\\"./IApplicationFactory.sol\\\";\\n\\n/// @title Self-hosted Application Factory interface\\ninterface ISelfHostedApplicationFactory {\\n /// @notice Get the factory used to deploy `IAuthority` contracts\\n /// @return The authority factory\\n function getAuthorityFactory() external view returns (IAuthorityFactory);\\n\\n /// @notice Get the factory used to deploy `IApplication` contracts\\n /// @return The application factory\\n function getApplicationFactory()\\n external\\n view\\n returns (IApplicationFactory);\\n\\n /// @notice Deploy new application and authority contracts deterministically.\\n /// @param authorityOwner The initial authority owner\\n /// @param epochLength The epoch length\\n /// @param appOwner The initial application owner\\n /// @param templateHash The initial machine state hash\\n /// @param salt The salt used to deterministically generate the addresses\\n /// @return The application contract\\n /// @return The authority contract\\n /// @dev Reverts if the authority owner address is zero.\\n /// @dev Reverts if the application owner address is zero.\\n /// @dev Reverts if the epoch length is zero.\\n function deployContracts(\\n address authorityOwner,\\n uint256 epochLength,\\n address appOwner,\\n bytes32 templateHash,\\n bytes32 salt\\n ) external returns (IApplication, IAuthority);\\n\\n /// @notice Calculate the addresses of the application and authority contracts\\n /// to be deployed deterministically.\\n /// @param authorityOwner The initial authority owner\\n /// @param epochLength The epoch length\\n /// @param appOwner The initial application owner\\n /// @param templateHash The initial machine state hash\\n /// @param salt The salt used to deterministically generate the addresses\\n /// @return The application address\\n /// @return The authority address\\n function calculateAddresses(\\n address authorityOwner,\\n uint256 epochLength,\\n address appOwner,\\n bytes32 templateHash,\\n bytes32 salt\\n ) external view returns (address, address);\\n}\\n\",\"keccak256\":\"0xed3aa3524c211283565f8c33018a1483e6c49782312aa57ff4399f360855daca\",\"license\":\"Apache-2.0\"},\"contracts/dapp/SelfHostedApplicationFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0\\n\\npragma solidity ^0.8.8;\\n\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\nimport {IAuthority} from \\\"../consensus/authority/IAuthority.sol\\\";\\nimport {IAuthorityFactory} from \\\"../consensus/authority/IAuthorityFactory.sol\\\";\\nimport {IApplication} from \\\"./IApplication.sol\\\";\\nimport {IApplicationFactory} from \\\"./IApplicationFactory.sol\\\";\\nimport {ISelfHostedApplicationFactory} from \\\"./ISelfHostedApplicationFactory.sol\\\";\\n\\n/// @title Self-hosted Application Factory\\n/// @notice Allows anyone to reliably deploy a new IAuthority contract,\\n/// along with an IApplication contract already linked to it.\\ncontract SelfHostedApplicationFactory is ISelfHostedApplicationFactory {\\n IAuthorityFactory immutable _authorityFactory;\\n IApplicationFactory immutable _applicationFactory;\\n\\n /// @param authorityFactory The authority factory\\n /// @param applicationFactory The application factory\\n constructor(\\n IAuthorityFactory authorityFactory,\\n IApplicationFactory applicationFactory\\n ) {\\n _authorityFactory = authorityFactory;\\n _applicationFactory = applicationFactory;\\n }\\n\\n function getAuthorityFactory()\\n external\\n view\\n override\\n returns (IAuthorityFactory)\\n {\\n return _authorityFactory;\\n }\\n\\n function getApplicationFactory()\\n external\\n view\\n override\\n returns (IApplicationFactory)\\n {\\n return _applicationFactory;\\n }\\n\\n function deployContracts(\\n address authorityOwner,\\n uint256 epochLength,\\n address appOwner,\\n bytes32 templateHash,\\n bytes32 salt\\n ) external returns (IApplication application, IAuthority authority) {\\n authority = _authorityFactory.newAuthority(\\n authorityOwner,\\n epochLength,\\n salt\\n );\\n\\n application = _applicationFactory.newApplication(\\n authority,\\n appOwner,\\n templateHash,\\n salt\\n );\\n }\\n\\n function calculateAddresses(\\n address authorityOwner,\\n uint256 epochLength,\\n address appOwner,\\n bytes32 templateHash,\\n bytes32 salt\\n ) external view returns (address application, address authority) {\\n authority = _authorityFactory.calculateAuthorityAddress(\\n authorityOwner,\\n epochLength,\\n salt\\n );\\n\\n application = _applicationFactory.calculateApplicationAddress(\\n IConsensus(authority),\\n appOwner,\\n templateHash,\\n salt\\n );\\n }\\n}\\n\",\"keccak256\":\"0x8db5a5c88c8141afebf0c8204410bede774d6f7616c4a18796bd365985ab00d9\",\"license\":\"Apache-2.0\"}},\"version\":1}", + "bytecode": "0x60c060405234801561001057600080fd5b5060405161050738038061050783398101604081905261002f9161005e565b6001600160a01b039182166080521660a052610098565b6001600160a01b038116811461005b57600080fd5b50565b6000806040838503121561007157600080fd5b825161007c81610046565b602084015190925061008d81610046565b809150509250929050565b60805160a0516104306100d76000396000818160c5015281816101d1015261032101526000818160530152818161012e015261027c01526104306000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806375689f8314610051578063de4d53fd14610090578063e63d50ff146100c3578063ffc643ca146100e9575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b0390911681526020015b60405180910390f35b6100a361009e366004610384565b6100fc565b604080516001600160a01b03938416815292909116602083015201610087565b7f0000000000000000000000000000000000000000000000000000000000000000610073565b6100a36100f7366004610384565b61024a565b604051631442f7bb60e01b81526001600160a01b038681166004830152602482018690526044820183905260009182917f00000000000000000000000000000000000000000000000000000000000000001690631442f7bb90606401602060405180830381865afa158015610175573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019991906103d6565b60405163bd4f121960e01b81526001600160a01b038083166004830152878116602483015260448201879052606482018690529192507f00000000000000000000000000000000000000000000000000000000000000009091169063bd4f121990608401602060405180830381865afa15801561021a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061023e91906103d6565b91509550959350505050565b604051631d9324cd60e31b81526001600160a01b038681166004830152602482018690526044820183905260009182917f0000000000000000000000000000000000000000000000000000000000000000169063ec992668906064016020604051808303816000875af11580156102c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102e991906103d6565b604051630e1a07f560e01b81526001600160a01b038083166004830152878116602483015260448201879052606482018690529192507f000000000000000000000000000000000000000000000000000000000000000090911690630e1a07f5906084016020604051808303816000875af115801561021a573d6000803e3d6000fd5b6001600160a01b038116811461038157600080fd5b50565b600080600080600060a0868803121561039c57600080fd5b85356103a78161036c565b94506020860135935060408601356103be8161036c565b94979396509394606081013594506080013592915050565b6000602082840312156103e857600080fd5b81516103f38161036c565b939250505056fea264697066735822122020a143bc4274577e61018885b1497d3d548317895553ccc9ead215bc303b532364736f6c63430008170033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806375689f8314610051578063de4d53fd14610090578063e63d50ff146100c3578063ffc643ca146100e9575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b0390911681526020015b60405180910390f35b6100a361009e366004610384565b6100fc565b604080516001600160a01b03938416815292909116602083015201610087565b7f0000000000000000000000000000000000000000000000000000000000000000610073565b6100a36100f7366004610384565b61024a565b604051631442f7bb60e01b81526001600160a01b038681166004830152602482018690526044820183905260009182917f00000000000000000000000000000000000000000000000000000000000000001690631442f7bb90606401602060405180830381865afa158015610175573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019991906103d6565b60405163bd4f121960e01b81526001600160a01b038083166004830152878116602483015260448201879052606482018690529192507f00000000000000000000000000000000000000000000000000000000000000009091169063bd4f121990608401602060405180830381865afa15801561021a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061023e91906103d6565b91509550959350505050565b604051631d9324cd60e31b81526001600160a01b038681166004830152602482018690526044820183905260009182917f0000000000000000000000000000000000000000000000000000000000000000169063ec992668906064016020604051808303816000875af11580156102c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102e991906103d6565b604051630e1a07f560e01b81526001600160a01b038083166004830152878116602483015260448201879052606482018690529192507f000000000000000000000000000000000000000000000000000000000000000090911690630e1a07f5906084016020604051808303816000875af115801561021a573d6000803e3d6000fd5b6001600160a01b038116811461038157600080fd5b50565b600080600080600060a0868803121561039c57600080fd5b85356103a78161036c565b94506020860135935060408601356103be8161036c565b94979396509394606081013594506080013592915050565b6000602082840312156103e857600080fd5b81516103f38161036c565b939250505056fea264697066735822122020a143bc4274577e61018885b1497d3d548317895553ccc9ead215bc303b532364736f6c63430008170033", "devdoc": { "kind": "dev", "methods": { - "calculateAddresses(address,address,address[],address,bytes32,bytes32)": { + "calculateAddresses(address,uint256,address,bytes32,bytes32)": { "params": { - "appOwner": "The initial Application owner", + "appOwner": "The initial application owner", "authorityOwner": "The initial authority owner", - "inputBox": "The input box contract", - "portals": "The portals supported by the application", + "epochLength": "The epoch length", "salt": "The salt used to deterministically generate the addresses", "templateHash": "The initial machine state hash" }, @@ -190,12 +179,12 @@ "authorityFactory": "The authority factory" } }, - "deployContracts(address,address,address[],address,bytes32,bytes32)": { + "deployContracts(address,uint256,address,bytes32,bytes32)": { + "details": "Reverts if the authority owner address is zero.Reverts if the application owner address is zero.Reverts if the epoch length is zero.", "params": { - "appOwner": "The initial Application owner", + "appOwner": "The initial application owner", "authorityOwner": "The initial authority owner", - "inputBox": "The input box contract", - "portals": "The portals supported by the application", + "epochLength": "The epoch length", "salt": "The salt used to deterministically generate the addresses", "templateHash": "The initial machine state hash" }, @@ -221,20 +210,20 @@ "userdoc": { "kind": "user", "methods": { - "calculateAddresses(address,address,address[],address,bytes32,bytes32)": { + "calculateAddresses(address,uint256,address,bytes32,bytes32)": { "notice": "Calculate the addresses of the application and authority contracts to be deployed deterministically." }, - "deployContracts(address,address,address[],address,bytes32,bytes32)": { + "deployContracts(address,uint256,address,bytes32,bytes32)": { "notice": "Deploy new application and authority contracts deterministically." }, "getApplicationFactory()": { - "notice": "Get the factory used to deploy `Application` contracts" + "notice": "Get the factory used to deploy `IApplication` contracts" }, "getAuthorityFactory()": { - "notice": "Get the factory used to deploy `Authority` contracts" + "notice": "Get the factory used to deploy `IAuthority` contracts" } }, - "notice": "Allows anyone to reliably deploy a new Authority contract, along with an Application contract already linked to it.", + "notice": "Allows anyone to reliably deploy a new IAuthority contract, along with an IApplication contract already linked to it.", "version": 1 }, "storageLayout": { diff --git a/export/abi/sepolia.json b/export/abi/sepolia.json index 7bfc1bed..f0ed62e9 100644 --- a/export/abi/sepolia.json +++ b/export/abi/sepolia.json @@ -2,21 +2,148 @@ "name": "sepolia", "chainId": "11155111", "contracts": { - "AuthorityFactory": { - "address": "0xFc6c1Fc6546898eb2f9cb7De360B3eA52E601D46", + "ApplicationFactory": { + "address": "0x1d4CfBD2622d802A07CeB4C3401Bbb455c9dbdC3", "abi": [ { "anonymous": false, "inputs": [ + { + "indexed": true, + "internalType": "contract IConsensus", + "name": "consensus", + "type": "address" + }, { "indexed": false, "internalType": "address", - "name": "authorityOwner", + "name": "appOwner", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "templateHash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "contract IApplication", + "name": "appContract", + "type": "address" + } + ], + "name": "ApplicationCreated", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "contract IConsensus", + "name": "consensus", + "type": "address" + }, + { + "internalType": "address", + "name": "appOwner", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "templateHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + } + ], + "name": "calculateApplicationAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IConsensus", + "name": "consensus", + "type": "address" + }, + { + "internalType": "address", + "name": "appOwner", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "templateHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + } + ], + "name": "newApplication", + "outputs": [ + { + "internalType": "contract IApplication", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IConsensus", + "name": "consensus", + "type": "address" + }, + { + "internalType": "address", + "name": "appOwner", "type": "address" }, + { + "internalType": "bytes32", + "name": "templateHash", + "type": "bytes32" + } + ], + "name": "newApplication", + "outputs": [ + { + "internalType": "contract IApplication", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ] + }, + "AuthorityFactory": { + "address": "0xB897F7Fe78f220aE34B7FA9493092701a873Ed45", + "abi": [ + { + "anonymous": false, + "inputs": [ { "indexed": false, - "internalType": "contract Authority", + "internalType": "contract IAuthority", "name": "authority", "type": "address" } @@ -31,6 +158,11 @@ "name": "authorityOwner", "type": "address" }, + { + "internalType": "uint256", + "name": "epochLength", + "type": "uint256" + }, { "internalType": "bytes32", "name": "salt", @@ -56,15 +188,15 @@ "type": "address" }, { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" + "internalType": "uint256", + "name": "epochLength", + "type": "uint256" } ], "name": "newAuthority", "outputs": [ { - "internalType": "contract Authority", + "internalType": "contract IAuthority", "name": "", "type": "address" } @@ -78,12 +210,22 @@ "internalType": "address", "name": "authorityOwner", "type": "address" + }, + { + "internalType": "uint256", + "name": "epochLength", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" } ], "name": "newAuthority", "outputs": [ { - "internalType": "contract Authority", + "internalType": "contract IAuthority", "name": "", "type": "address" } @@ -94,7 +236,7 @@ ] }, "ERC1155BatchPortal": { - "address": "0x8A55f9AD8E78A8FBaf6c4c09D43e8ea0694b46E1", + "address": "0x4a218D331C0933d7E3EB496ac901669f28D94981", "abi": [ { "inputs": [ @@ -157,30 +299,11 @@ ], "stateMutability": "view", "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" } ] }, "ERC1155SinglePortal": { - "address": "0x7a87676A40aEd3A780Cd8D58c22129D5673eaBc8", + "address": "0x2f0D587DD6EcF67d25C558f2e9c3839c579e5e38", "abi": [ { "inputs": [ @@ -243,30 +366,11 @@ ], "stateMutability": "view", "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" } ] }, "ERC20Portal": { - "address": "0x406f11E905D58E3DE4f7ff0DBe8e69d38BF496F2", + "address": "0xB0e28881FF7ee9CD5B1229d570540d74bce23D39", "abi": [ { "inputs": [ @@ -324,30 +428,11 @@ ], "stateMutability": "view", "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" } ] }, "ERC721Portal": { - "address": "0x922a84c4a6dED3598Dd5E2b9c7575CF652049E3A", + "address": "0x874b3245ead7474Cb9f3b83cD1446dC522f6bd36", "abi": [ { "inputs": [ @@ -405,30 +490,11 @@ ], "stateMutability": "view", "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" } ] }, "EtherPortal": { - "address": "0xa1D048Bf4231b532b866de31AD42443D38A7Dc5B", + "address": "0xfa2292f6D85ea4e629B156A4f99219e30D12EE17", "abi": [ { "inputs": [ @@ -476,30 +542,11 @@ ], "stateMutability": "view", "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" } ] }, "InputBox": { - "address": "0x58Df21fE097d4bE5dCf61e01d9ea3f6B81c2E1dB", + "address": "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6", "abi": [ { "inputs": [ @@ -617,14 +664,14 @@ ] }, "QuorumFactory": { - "address": "0xB41851d69891748b27779e382cc8de6e8C128e1C", + "address": "0x22AFD9162079c7Ac0aF874054298Bf46F29157F1", "abi": [ { "anonymous": false, "inputs": [ { "indexed": false, - "internalType": "contract Quorum", + "internalType": "contract IQuorum", "name": "quorum", "type": "address" } @@ -639,6 +686,11 @@ "name": "validators", "type": "address[]" }, + { + "internalType": "uint256", + "name": "epochLength", + "type": "uint256" + }, { "internalType": "bytes32", "name": "salt", @@ -662,12 +714,22 @@ "internalType": "address[]", "name": "validators", "type": "address[]" + }, + { + "internalType": "uint256", + "name": "epochLength", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" } ], "name": "newQuorum", "outputs": [ { - "internalType": "contract Quorum", + "internalType": "contract IQuorum", "name": "", "type": "address" } @@ -683,15 +745,15 @@ "type": "address[]" }, { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" + "internalType": "uint256", + "name": "epochLength", + "type": "uint256" } ], "name": "newQuorum", "outputs": [ { - "internalType": "contract Quorum", + "internalType": "contract IQuorum", "name": "", "type": "address" } @@ -701,460 +763,74 @@ } ] }, - "Bitmask": { - "address": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", - "abi": [] - }, - "CartesiMathV2": { - "address": "0xB634F716BEd5Dd5A2b9a91C92474C499e50Cb27D", + "SafeERC20Transfer": { + "address": "0x817b126F242B5F184Fa685b4f2F91DC99D8115F9", "abi": [ { "inputs": [ { - "internalType": "uint256", - "name": "_num", - "type": "uint256" + "internalType": "address", + "name": "target", + "type": "address" } ], - "name": "clz", - "outputs": [ + "name": "AddressEmptyCode", + "type": "error" + }, + { + "inputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" + "internalType": "address", + "name": "account", + "type": "address" } ], - "stateMutability": "pure", - "type": "function" + "name": "AddressInsufficientBalance", + "type": "error" + }, + { + "inputs": [], + "name": "FailedInnerCall", + "type": "error" }, { "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "ctz", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "getLog2Floor", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "getLog2TableTimes1M", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "isPowerOf2", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "log2ApproxTimes1M", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - } - ] - }, - "MerkleV2": { - "address": "0x33436035441927Df1a73FE3AAC5906854632e53d", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes32[]", - "name": "hashes", - "type": "bytes32[]" - } - ], - "name": "calculateRootFromPowerOfTwo", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "getEmptyTreeHashAtIndex", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "_data", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "_wordIndex", - "type": "uint256" - } - ], - "name": "getHashOfWordAtIndex", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "_data", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "_log2Size", - "type": "uint256" - } - ], - "name": "getMerkleRootFromBytes", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_position", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_logSizeOfReplacement", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_logSizeOfFullDrive", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "_replacement", - "type": "bytes32" - }, - { - "internalType": "bytes32[]", - "name": "siblings", - "type": "bytes32[]" - } - ], - "name": "getRootAfterReplacementInDrive", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - } - ] - }, - "UnrolledCordic": { - "address": "0x3F8FdcD1B0F421D817BF58C96b7C91B98100B450", - "abi": [ - { - "inputs": [ - { - "internalType": "uint256", - "name": "val", - "type": "uint256" - } - ], - "name": "log2Times1e18", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - } - ] - }, - "ApplicationFactory": { - "address": "0x159876e08d642c2Fe9a52804756189E1DbF497F0", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "contract IConsensus", - "name": "consensus", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract IInputBox", - "name": "inputBox", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract IPortal[]", - "name": "portals", - "type": "address[]" - }, - { - "indexed": false, - "internalType": "address", - "name": "appOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "templateHash", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "contract Application", - "name": "appContract", - "type": "address" - } - ], - "name": "ApplicationCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "contract IConsensus", - "name": "consensus", - "type": "address" - }, - { - "internalType": "contract IInputBox", - "name": "inputBox", - "type": "address" - }, - { - "internalType": "contract IPortal[]", - "name": "portals", - "type": "address[]" - }, - { - "internalType": "address", - "name": "appOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "templateHash", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - } - ], - "name": "calculateApplicationAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IConsensus", - "name": "consensus", - "type": "address" - }, - { - "internalType": "contract IInputBox", - "name": "inputBox", - "type": "address" - }, - { - "internalType": "contract IPortal[]", - "name": "portals", - "type": "address[]" - }, { "internalType": "address", - "name": "appOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "templateHash", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - } - ], - "name": "newApplication", - "outputs": [ - { - "internalType": "contract Application", - "name": "", + "name": "token", "type": "address" } ], - "stateMutability": "nonpayable", - "type": "function" + "name": "SafeERC20FailedOperation", + "type": "error" }, { "inputs": [ { - "internalType": "contract IConsensus", - "name": "consensus", - "type": "address" - }, - { - "internalType": "contract IInputBox", - "name": "inputBox", + "internalType": "contract IERC20", + "name": "token", "type": "address" }, - { - "internalType": "contract IPortal[]", - "name": "portals", - "type": "address[]" - }, { "internalType": "address", - "name": "appOwner", + "name": "to", "type": "address" }, { - "internalType": "bytes32", - "name": "templateHash", - "type": "bytes32" - } - ], - "name": "newApplication", - "outputs": [ - { - "internalType": "contract Application", - "name": "", - "type": "address" + "internalType": "uint256", + "name": "value", + "type": "uint256" } ], + "name": "safeTransfer", + "outputs": [], "stateMutability": "nonpayable", "type": "function" } ] }, "SelfHostedApplicationFactory": { - "address": "0x1fD0E73b5739eDBdf978e3ad2063F86cF78056aF", + "address": "0x4C11C7F82D6D56a726f9B53dd99af031AFd86BB6", "abi": [ { "inputs": [ @@ -1180,14 +856,9 @@ "type": "address" }, { - "internalType": "contract IInputBox", - "name": "inputBox", - "type": "address" - }, - { - "internalType": "contract IPortal[]", - "name": "portals", - "type": "address[]" + "internalType": "uint256", + "name": "epochLength", + "type": "uint256" }, { "internalType": "address", @@ -1229,14 +900,9 @@ "type": "address" }, { - "internalType": "contract IInputBox", - "name": "inputBox", - "type": "address" - }, - { - "internalType": "contract IPortal[]", - "name": "portals", - "type": "address[]" + "internalType": "uint256", + "name": "epochLength", + "type": "uint256" }, { "internalType": "address", @@ -1257,12 +923,12 @@ "name": "deployContracts", "outputs": [ { - "internalType": "contract Application", + "internalType": "contract IApplication", "name": "application", "type": "address" }, { - "internalType": "contract Authority", + "internalType": "contract IAuthority", "name": "authority", "type": "address" } @@ -1297,72 +963,6 @@ "type": "function" } ] - }, - "SafeERC20Transfer": { - "address": "0x817b126F242B5F184Fa685b4f2F91DC99D8115F9", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "target", - "type": "address" - } - ], - "name": "AddressEmptyCode", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "AddressInsufficientBalance", - "type": "error" - }, - { - "inputs": [], - "name": "FailedInnerCall", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "SafeERC20FailedOperation", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "contract IERC20", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "safeTransfer", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ] } } -} +} \ No newline at end of file