From e72796badb46d87024a4c5b7a09f8d388cc658a9 Mon Sep 17 00:00:00 2001 From: Danilo Tuler Date: Thu, 24 Oct 2024 22:13:12 -0400 Subject: [PATCH] feat: deploy to all testnets --- deployments/arbitrum_sepolia/.chainId | 1 + .../arbitrum_sepolia/ApplicationFactory.json | 233 +++++ .../arbitrum_sepolia/AuthorityFactory.json | 194 ++++ .../arbitrum_sepolia/ERC1155BatchPortal.json | 139 +++ .../arbitrum_sepolia/ERC1155SinglePortal.json | 138 +++ deployments/arbitrum_sepolia/ERC20Portal.json | 138 +++ .../arbitrum_sepolia/ERC721Portal.json | 132 +++ deployments/arbitrum_sepolia/EtherPortal.json | 127 +++ deployments/arbitrum_sepolia/InputBox.json | 252 +++++ .../arbitrum_sepolia/QuorumFactory.json | 194 ++++ .../arbitrum_sepolia/SafeERC20Transfer.json | 124 +++ .../SelfHostedApplicationFactory.json | 233 +++++ deployments/base_sepolia/.chainId | 1 + .../base_sepolia/ApplicationFactory.json | 233 +++++ .../base_sepolia/AuthorityFactory.json | 194 ++++ .../base_sepolia/ERC1155BatchPortal.json | 139 +++ .../base_sepolia/ERC1155SinglePortal.json | 138 +++ deployments/base_sepolia/ERC20Portal.json | 138 +++ deployments/base_sepolia/ERC721Portal.json | 132 +++ deployments/base_sepolia/EtherPortal.json | 127 +++ deployments/base_sepolia/InputBox.json | 252 +++++ deployments/base_sepolia/QuorumFactory.json | 194 ++++ .../base_sepolia/SafeERC20Transfer.json | 124 +++ .../SelfHostedApplicationFactory.json | 233 +++++ deployments/optimism_sepolia/.chainId | 1 + .../optimism_sepolia/ApplicationFactory.json | 233 +++++ .../optimism_sepolia/AuthorityFactory.json | 194 ++++ .../optimism_sepolia/ERC1155BatchPortal.json | 123 +++ .../optimism_sepolia/ERC1155SinglePortal.json | 122 +++ deployments/optimism_sepolia/ERC20Portal.json | 122 +++ .../optimism_sepolia/ERC721Portal.json | 116 +++ deployments/optimism_sepolia/EtherPortal.json | 111 ++ deployments/optimism_sepolia/InputBox.json | 236 +++++ .../optimism_sepolia/QuorumFactory.json | 194 ++++ .../optimism_sepolia/SafeERC20Transfer.json | 108 ++ .../SelfHostedApplicationFactory.json | 233 +++++ export/abi/arbitrum_sepolia.json | 968 ++++++++++++++++++ export/abi/base_sepolia.json | 968 ++++++++++++++++++ export/abi/optimism_sepolia.json | 968 ++++++++++++++++++ 39 files changed, 8507 insertions(+) create mode 100644 deployments/arbitrum_sepolia/.chainId create mode 100644 deployments/arbitrum_sepolia/ApplicationFactory.json create mode 100644 deployments/arbitrum_sepolia/AuthorityFactory.json create mode 100644 deployments/arbitrum_sepolia/ERC1155BatchPortal.json create mode 100644 deployments/arbitrum_sepolia/ERC1155SinglePortal.json create mode 100644 deployments/arbitrum_sepolia/ERC20Portal.json create mode 100644 deployments/arbitrum_sepolia/ERC721Portal.json create mode 100644 deployments/arbitrum_sepolia/EtherPortal.json create mode 100644 deployments/arbitrum_sepolia/InputBox.json create mode 100644 deployments/arbitrum_sepolia/QuorumFactory.json create mode 100644 deployments/arbitrum_sepolia/SafeERC20Transfer.json create mode 100644 deployments/arbitrum_sepolia/SelfHostedApplicationFactory.json create mode 100644 deployments/base_sepolia/.chainId create mode 100644 deployments/base_sepolia/ApplicationFactory.json create mode 100644 deployments/base_sepolia/AuthorityFactory.json create mode 100644 deployments/base_sepolia/ERC1155BatchPortal.json create mode 100644 deployments/base_sepolia/ERC1155SinglePortal.json create mode 100644 deployments/base_sepolia/ERC20Portal.json create mode 100644 deployments/base_sepolia/ERC721Portal.json create mode 100644 deployments/base_sepolia/EtherPortal.json create mode 100644 deployments/base_sepolia/InputBox.json create mode 100644 deployments/base_sepolia/QuorumFactory.json create mode 100644 deployments/base_sepolia/SafeERC20Transfer.json create mode 100644 deployments/base_sepolia/SelfHostedApplicationFactory.json create mode 100644 deployments/optimism_sepolia/.chainId create mode 100644 deployments/optimism_sepolia/ApplicationFactory.json create mode 100644 deployments/optimism_sepolia/AuthorityFactory.json create mode 100644 deployments/optimism_sepolia/ERC1155BatchPortal.json create mode 100644 deployments/optimism_sepolia/ERC1155SinglePortal.json create mode 100644 deployments/optimism_sepolia/ERC20Portal.json create mode 100644 deployments/optimism_sepolia/ERC721Portal.json create mode 100644 deployments/optimism_sepolia/EtherPortal.json create mode 100644 deployments/optimism_sepolia/InputBox.json create mode 100644 deployments/optimism_sepolia/QuorumFactory.json create mode 100644 deployments/optimism_sepolia/SafeERC20Transfer.json create mode 100644 deployments/optimism_sepolia/SelfHostedApplicationFactory.json create mode 100644 export/abi/arbitrum_sepolia.json create mode 100644 export/abi/base_sepolia.json create mode 100644 export/abi/optimism_sepolia.json diff --git a/deployments/arbitrum_sepolia/.chainId b/deployments/arbitrum_sepolia/.chainId new file mode 100644 index 000000000..71ba4d632 --- /dev/null +++ b/deployments/arbitrum_sepolia/.chainId @@ -0,0 +1 @@ +421614 \ No newline at end of file diff --git a/deployments/arbitrum_sepolia/ApplicationFactory.json b/deployments/arbitrum_sepolia/ApplicationFactory.json new file mode 100644 index 000000000..4cd5fcdb2 --- /dev/null +++ b/deployments/arbitrum_sepolia/ApplicationFactory.json @@ -0,0 +1,233 @@ +{ + "address": "0x1d4CfBD2622d802A07CeB4C3401Bbb455c9dbdC3", + "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" + } + ], + "transactionHash": "0x85629292d94eb501dc7974c3c392bad0f04d97d1f844eac7528d225fb5090d00", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", + "contractAddress": null, + "transactionIndex": 1, + "gasUsed": "1277426", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x89021feea67afee642a239c3424ae38d9d0f2306559159e7cfae69bf6444d271", + "transactionHash": "0x85629292d94eb501dc7974c3c392bad0f04d97d1f844eac7528d225fb5090d00", + "logs": [], + "blockNumber": 91454072, + "cumulativeGasUsed": "1277426", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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,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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/arbitrum_sepolia/AuthorityFactory.json b/deployments/arbitrum_sepolia/AuthorityFactory.json new file mode 100644 index 000000000..f81c08705 --- /dev/null +++ b/deployments/arbitrum_sepolia/AuthorityFactory.json @@ -0,0 +1,194 @@ +{ + "address": "0xB897F7Fe78f220aE34B7FA9493092701a873Ed45", + "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" + } + ], + "transactionHash": "0xd8ce10e1a29ab60cadee8c3be9a79b75f8d637484d831ad0632612bff0066d72", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", + "contractAddress": null, + "transactionIndex": 1, + "gasUsed": "534166", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xec0cd6bb6714510d31e7b1a844484e4dec7fafb98e3495ea02adc20a5bc8bafe", + "transactionHash": "0xd8ce10e1a29ab60cadee8c3be9a79b75f8d637484d831ad0632612bff0066d72", + "logs": [], + "blockNumber": 91454039, + "cumulativeGasUsed": "534166", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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)": { + "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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/arbitrum_sepolia/ERC1155BatchPortal.json b/deployments/arbitrum_sepolia/ERC1155BatchPortal.json new file mode 100644 index 000000000..988da4c1f --- /dev/null +++ b/deployments/arbitrum_sepolia/ERC1155BatchPortal.json @@ -0,0 +1,139 @@ +{ + "address": "0x4a218D331C0933d7E3EB496ac901669f28D94981", + "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" + } + ], + "transactionHash": "0xf4ee7bd8beb16e6944c40b589f6a50aa1c6d06f9852b9fcbb5dbbcf9e1ab2759", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", + "contractAddress": null, + "transactionIndex": 1, + "gasUsed": "372427", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x4d39889054487af56973946e655e1647de6f064fde7f453ba69e09ecd11f2aa1", + "transactionHash": "0xf4ee7bd8beb16e6944c40b589f6a50aa1c6d06f9852b9fcbb5dbbcf9e1ab2759", + "logs": [], + "blockNumber": 91454028, + "cumulativeGasUsed": "372427", + "status": 1, + "byzantium": true + }, + "args": [ + "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6" + ], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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": { + "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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/arbitrum_sepolia/ERC1155SinglePortal.json b/deployments/arbitrum_sepolia/ERC1155SinglePortal.json new file mode 100644 index 000000000..179708e6f --- /dev/null +++ b/deployments/arbitrum_sepolia/ERC1155SinglePortal.json @@ -0,0 +1,138 @@ +{ + "address": "0x2f0D587DD6EcF67d25C558f2e9c3839c579e5e38", + "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" + } + ], + "transactionHash": "0xf0238a229bedb2ba135dc0e865d57f705bfe0fc23de017d64d750d1a03116244", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", + "contractAddress": null, + "transactionIndex": 1, + "gasUsed": "318905", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x58900f46a68d320b862575e47d1b931879ce01d4406d30cb356acb79795ff14e", + "transactionHash": "0xf0238a229bedb2ba135dc0e865d57f705bfe0fc23de017d64d750d1a03116244", + "logs": [], + "blockNumber": 91454014, + "cumulativeGasUsed": "318905", + "status": 1, + "byzantium": true + }, + "args": [ + "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6" + ], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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": { + "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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/arbitrum_sepolia/ERC20Portal.json b/deployments/arbitrum_sepolia/ERC20Portal.json new file mode 100644 index 000000000..e5a7f1987 --- /dev/null +++ b/deployments/arbitrum_sepolia/ERC20Portal.json @@ -0,0 +1,138 @@ +{ + "address": "0xB0e28881FF7ee9CD5B1229d570540d74bce23D39", + "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" + } + ], + "transactionHash": "0x772becd51844ca89ac7c5accabe16102eb0f0efab6382ac0d7db4686bd275acb", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", + "contractAddress": null, + "transactionIndex": 1, + "gasUsed": "270282", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xcb35bfe49453688482de648e158fa9082b88b239b8b706396a3c41e70dbbe883", + "transactionHash": "0x772becd51844ca89ac7c5accabe16102eb0f0efab6382ac0d7db4686bd275acb", + "logs": [], + "blockNumber": 91453978, + "cumulativeGasUsed": "270282", + "status": 1, + "byzantium": true + }, + "args": [ + "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6" + ], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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": { + "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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/arbitrum_sepolia/ERC721Portal.json b/deployments/arbitrum_sepolia/ERC721Portal.json new file mode 100644 index 000000000..0efe65550 --- /dev/null +++ b/deployments/arbitrum_sepolia/ERC721Portal.json @@ -0,0 +1,132 @@ +{ + "address": "0x874b3245ead7474Cb9f3b83cD1446dC522f6bd36", + "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" + } + ], + "transactionHash": "0x3f7966f4c3c1df937f092e6a29f058ec2d070fdb9da72ffcadd0300b1a823de1", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", + "contractAddress": null, + "transactionIndex": 1, + "gasUsed": "309792", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xa4253a04080ca53b9a76791bf926d7a7e3e917e5059904e14f08840c2212b522", + "transactionHash": "0x3f7966f4c3c1df937f092e6a29f058ec2d070fdb9da72ffcadd0300b1a823de1", + "logs": [], + "blockNumber": 91453999, + "cumulativeGasUsed": "309792", + "status": 1, + "byzantium": true + }, + "args": [ + "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6" + ], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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": { + "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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/arbitrum_sepolia/EtherPortal.json b/deployments/arbitrum_sepolia/EtherPortal.json new file mode 100644 index 000000000..18d92b77f --- /dev/null +++ b/deployments/arbitrum_sepolia/EtherPortal.json @@ -0,0 +1,127 @@ +{ + "address": "0xfa2292f6D85ea4e629B156A4f99219e30D12EE17", + "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" + } + ], + "transactionHash": "0xcb87742857eb75c1d2fb787c3a6958e809af15143ad796a85089eb56787f79aa", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", + "contractAddress": null, + "transactionIndex": 1, + "gasUsed": "239259", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xd1db6111ee7d5d5257648f6de50afaa5437759dd1790bb8625c3cc810897ef17", + "transactionHash": "0xcb87742857eb75c1d2fb787c3a6958e809af15143ad796a85089eb56787f79aa", + "logs": [], + "blockNumber": 91453965, + "cumulativeGasUsed": "239259", + "status": 1, + "byzantium": true + }, + "args": [ + "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6" + ], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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": { + "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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/arbitrum_sepolia/InputBox.json b/deployments/arbitrum_sepolia/InputBox.json new file mode 100644 index 000000000..ac4e98a1f --- /dev/null +++ b/deployments/arbitrum_sepolia/InputBox.json @@ -0,0 +1,252 @@ +{ + "address": "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6", + "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" + } + ], + "transactionHash": "0x43befcad41d41eb023b5f2a1155a879b2bf9a3231e5429479f6aa7f73d541d42", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", + "contractAddress": null, + "transactionIndex": 1, + "gasUsed": "277052", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x451b1e5751e0789e1a8bd91c6fc1764e7149f045d6032c9d668ace42d8c54d97", + "transactionHash": "0x43befcad41d41eb023b5f2a1155a879b2bf9a3231e5429479f6aa7f73d541d42", + "logs": [], + "blockNumber": 91453951, + "cumulativeGasUsed": "277052", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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)": [ + { + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 3773, + "contract": "contracts/inputs/InputBox.sol:InputBox", + "label": "_inputBoxes", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_address,t_array(t_bytes32)dyn_storage)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_bytes32)dyn_storage": { + "base": "t_bytes32", + "encoding": "dynamic_array", + "label": "bytes32[]", + "numberOfBytes": "32" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_array(t_bytes32)dyn_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bytes32[])", + "numberOfBytes": "32", + "value": "t_array(t_bytes32)dyn_storage" + } + } + } +} \ No newline at end of file diff --git a/deployments/arbitrum_sepolia/QuorumFactory.json b/deployments/arbitrum_sepolia/QuorumFactory.json new file mode 100644 index 000000000..e1be89279 --- /dev/null +++ b/deployments/arbitrum_sepolia/QuorumFactory.json @@ -0,0 +1,194 @@ +{ + "address": "0x22AFD9162079c7Ac0aF874054298Bf46F29157F1", + "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" + } + ], + "transactionHash": "0x95eae2f1e36c101b613ee6c9245520cad5ef4f2e48c50bf99b2dd9241595a0b2", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", + "contractAddress": null, + "transactionIndex": 1, + "gasUsed": "750251", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xe4f929c5cd65b297991f1e69f9f660c46053d4e025b2bb7f02db620f68b7ce8a", + "transactionHash": "0x95eae2f1e36c101b613ee6c9245520cad5ef4f2e48c50bf99b2dd9241595a0b2", + "logs": [], + "blockNumber": 91454056, + "cumulativeGasUsed": "750251", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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)": { + "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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/arbitrum_sepolia/SafeERC20Transfer.json b/deployments/arbitrum_sepolia/SafeERC20Transfer.json new file mode 100644 index 000000000..d16edeab8 --- /dev/null +++ b/deployments/arbitrum_sepolia/SafeERC20Transfer.json @@ -0,0 +1,124 @@ +{ + "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" + } + ], + "transactionHash": "0x1bb73f6f9cafc88f9701f77d31a78bc5d4ea21db0a1f75c69541d38cbacd54c1", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", + "contractAddress": null, + "transactionIndex": 2, + "gasUsed": "228918", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x9e38c7d71a2e442fab8c04b66ce300b9702b71a2d212894e21a65d2a312834a3", + "transactionHash": "0x1bb73f6f9cafc88f9701f77d31a78bc5d4ea21db0a1f75c69541d38cbacd54c1", + "logs": [], + "blockNumber": 91454111, + "cumulativeGasUsed": "1195052", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"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\"}],\"devdoc\":{\"errors\":{\"AddressEmptyCode(address)\":[{\"details\":\"There's no code at `target` (it is not a contract).\"}],\"AddressInsufficientBalance(address)\":[{\"details\":\"The ETH balance of the account is not enough to perform the operation.\"}],\"FailedInnerCall()\":[{\"details\":\"A call to an address target failed. The target may have reverted.\"}],\"SafeERC20FailedOperation(address)\":[{\"details\":\"An operation with an ERC20 token failed.\"}]},\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/delegatecall/SafeERC20Transfer.sol\":\"SafeERC20Transfer\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@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/ERC20/extensions/IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n *\\n * ==== Security Considerations\\n *\\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\\n * generally recommended is:\\n *\\n * ```solidity\\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\\n * doThing(..., value);\\n * }\\n *\\n * function doThing(..., uint256 value) public {\\n * token.safeTransferFrom(msg.sender, address(this), value);\\n * ...\\n * }\\n * ```\\n *\\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\\n * {SafeERC20-safeTransferFrom}).\\n *\\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\\n * contracts should have entry points that don't rely on permit.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n *\\n * CAUTION: See Security Considerations above.\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x6008dabfe393240d73d7dd7688033f72740d570aa422254d29a7dce8568f3aff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC20} from \\\"../IERC20.sol\\\";\\nimport {IERC20Permit} from \\\"../extensions/IERC20Permit.sol\\\";\\nimport {Address} from \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n /**\\n * @dev An operation with an ERC20 token failed.\\n */\\n error SafeERC20FailedOperation(address token);\\n\\n /**\\n * @dev Indicates a failed `decreaseAllowance` request.\\n */\\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\\n\\n /**\\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\\n }\\n\\n /**\\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\\n */\\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\\n }\\n\\n /**\\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n forceApprove(token, spender, oldAllowance + value);\\n }\\n\\n /**\\n * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no\\n * value, non-reverting calls are assumed to be successful.\\n */\\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\\n unchecked {\\n uint256 currentAllowance = token.allowance(address(this), spender);\\n if (currentAllowance < requestedDecrease) {\\n revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);\\n }\\n forceApprove(token, spender, currentAllowance - requestedDecrease);\\n }\\n }\\n\\n /**\\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\\n * to be set to zero before setting it to a non-zero value, such as USDT.\\n */\\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\\n\\n if (!_callOptionalReturnBool(token, approvalCall)) {\\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\\n _callOptionalReturn(token, approvalCall);\\n }\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data);\\n if (returndata.length != 0 && !abi.decode(returndata, (bool))) {\\n revert SafeERC20FailedOperation(address(token));\\n }\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n *\\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\\n */\\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\\n // and not revert is the subcall reverts.\\n\\n (bool success, bytes memory returndata) = address(token).call(data);\\n return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;\\n }\\n}\\n\",\"keccak256\":\"0x37bb49513c49c87c4642a891b13b63571bc87013dde806617aa1efb54605f386\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev The ETH balance of the account is not enough to perform the operation.\\n */\\n error AddressInsufficientBalance(address account);\\n\\n /**\\n * @dev There's no code at `target` (it is not a contract).\\n */\\n error AddressEmptyCode(address target);\\n\\n /**\\n * @dev A call to an address target failed. The target may have reverted.\\n */\\n error FailedInnerCall();\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n if (address(this).balance < amount) {\\n revert AddressInsufficientBalance(address(this));\\n }\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n if (!success) {\\n revert FailedInnerCall();\\n }\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason or custom error, it is bubbled\\n * up by this function (like regular Solidity function calls). However, if\\n * the call reverted with no returned reason, this function reverts with a\\n * {FailedInnerCall} error.\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n if (address(this).balance < value) {\\n revert AddressInsufficientBalance(address(this));\\n }\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\\n * unsuccessful call.\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata\\n ) internal view returns (bytes memory) {\\n if (!success) {\\n _revert(returndata);\\n } else {\\n // only check if target is a contract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n if (returndata.length == 0 && target.code.length == 0) {\\n revert AddressEmptyCode(target);\\n }\\n return returndata;\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\\n * revert reason or with a default {FailedInnerCall} error.\\n */\\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\\n if (!success) {\\n _revert(returndata);\\n } else {\\n return returndata;\\n }\\n }\\n\\n /**\\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\\n */\\n function _revert(bytes memory returndata) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert FailedInnerCall();\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaf28a975a78550e45f65e559a3ad6a5ad43b9b8a37366999abd1b7084eb70721\",\"license\":\"MIT\"},\"contracts/delegatecall/SafeERC20Transfer.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.20;\\n\\nimport {SafeERC20} from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\ncontract SafeERC20Transfer {\\n using SafeERC20 for IERC20;\\n\\n function safeTransfer(IERC20 token, address to, uint256 value) external {\\n token.safeTransfer(to, value);\\n }\\n}\\n\",\"keccak256\":\"0xc14fee1ebcfe5b770373118c76d4c3e53c157487e01bb69d3831bed3302edb65\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610326806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063d1660f9914610030575b600080fd5b61004361003e36600461025e565b610045565b005b6100596001600160a01b038416838361005e565b505050565b604080516001600160a01b03848116602483015260448083018590528351808403909101815260649092019092526020810180516001600160e01b031663a9059cbb60e01b179052610059918591906000906100bc9084168361010f565b905080516000141580156100e15750808060200190518101906100df919061029f565b155b1561005957604051635274afe760e01b81526001600160a01b03841660048201526024015b60405180910390fd5b606061011d83836000610124565b9392505050565b6060814710156101495760405163cd78605960e01b8152306004820152602401610106565b600080856001600160a01b0316848660405161016591906102c1565b60006040518083038185875af1925050503d80600081146101a2576040519150601f19603f3d011682016040523d82523d6000602084013e6101a7565b606091505b50915091506101b78683836101c1565b9695505050505050565b6060826101d6576101d18261021d565b61011d565b81511580156101ed57506001600160a01b0384163b155b1561021657604051639996b31560e01b81526001600160a01b0385166004820152602401610106565b508061011d565b80511561022d5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b50565b6001600160a01b038116811461024657600080fd5b60008060006060848603121561027357600080fd5b833561027e81610249565b9250602084013561028e81610249565b929592945050506040919091013590565b6000602082840312156102b157600080fd5b8151801515811461011d57600080fd5b6000825160005b818110156102e257602081860181015185830152016102c8565b50600092019182525091905056fea2646970667358221220770726e7ad5dd1738ebf2b83baa38187dd37ed24d03d1b61c4ef95f8cde1b84c64736f6c63430008170033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063d1660f9914610030575b600080fd5b61004361003e36600461025e565b610045565b005b6100596001600160a01b038416838361005e565b505050565b604080516001600160a01b03848116602483015260448083018590528351808403909101815260649092019092526020810180516001600160e01b031663a9059cbb60e01b179052610059918591906000906100bc9084168361010f565b905080516000141580156100e15750808060200190518101906100df919061029f565b155b1561005957604051635274afe760e01b81526001600160a01b03841660048201526024015b60405180910390fd5b606061011d83836000610124565b9392505050565b6060814710156101495760405163cd78605960e01b8152306004820152602401610106565b600080856001600160a01b0316848660405161016591906102c1565b60006040518083038185875af1925050503d80600081146101a2576040519150601f19603f3d011682016040523d82523d6000602084013e6101a7565b606091505b50915091506101b78683836101c1565b9695505050505050565b6060826101d6576101d18261021d565b61011d565b81511580156101ed57506001600160a01b0384163b155b1561021657604051639996b31560e01b81526001600160a01b0385166004820152602401610106565b508061011d565b80511561022d5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b50565b6001600160a01b038116811461024657600080fd5b60008060006060848603121561027357600080fd5b833561027e81610249565b9250602084013561028e81610249565b929592945050506040919091013590565b6000602082840312156102b157600080fd5b8151801515811461011d57600080fd5b6000825160005b818110156102e257602081860181015185830152016102c8565b50600092019182525091905056fea2646970667358221220770726e7ad5dd1738ebf2b83baa38187dd37ed24d03d1b61c4ef95f8cde1b84c64736f6c63430008170033", + "devdoc": { + "errors": { + "AddressEmptyCode(address)": [ + { + "details": "There's no code at `target` (it is not a contract)." + } + ], + "AddressInsufficientBalance(address)": [ + { + "details": "The ETH balance of the account is not enough to perform the operation." + } + ], + "FailedInnerCall()": [ + { + "details": "A call to an address target failed. The target may have reverted." + } + ], + "SafeERC20FailedOperation(address)": [ + { + "details": "An operation with an ERC20 token failed." + } + ] + }, + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/arbitrum_sepolia/SelfHostedApplicationFactory.json b/deployments/arbitrum_sepolia/SelfHostedApplicationFactory.json new file mode 100644 index 000000000..1af6c18a3 --- /dev/null +++ b/deployments/arbitrum_sepolia/SelfHostedApplicationFactory.json @@ -0,0 +1,233 @@ +{ + "address": "0x4C11C7F82D6D56a726f9B53dd99af031AFd86BB6", + "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" + } + ], + "transactionHash": "0x9a46afdf7549cb248fed75d2f94d657e6cc3b3daaf1948327d07600c999c53ef", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", + "contractAddress": null, + "transactionIndex": 1, + "gasUsed": "288428", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xb93137f2a5296c68d5d951293d983bf28fc611c1474ec97f2b985d4ac675ee57", + "transactionHash": "0x9a46afdf7549cb248fed75d2f94d657e6cc3b3daaf1948327d07600c999c53ef", + "logs": [], + "blockNumber": 91454091, + "cumulativeGasUsed": "288428", + "status": 1, + "byzantium": true + }, + "args": [ + "0xB897F7Fe78f220aE34B7FA9493092701a873Ed45", + "0x1d4CfBD2622d802A07CeB4C3401Bbb455c9dbdC3" + ], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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,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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/base_sepolia/.chainId b/deployments/base_sepolia/.chainId new file mode 100644 index 000000000..667f99daf --- /dev/null +++ b/deployments/base_sepolia/.chainId @@ -0,0 +1 @@ +84532 \ No newline at end of file diff --git a/deployments/base_sepolia/ApplicationFactory.json b/deployments/base_sepolia/ApplicationFactory.json new file mode 100644 index 000000000..41125c6ce --- /dev/null +++ b/deployments/base_sepolia/ApplicationFactory.json @@ -0,0 +1,233 @@ +{ + "address": "0x1d4CfBD2622d802A07CeB4C3401Bbb455c9dbdC3", + "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" + } + ], + "transactionHash": "0x6d931724a9051a350b832dc1272786b646fd96c1317a0e534fa801b06b13340e", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", + "contractAddress": null, + "transactionIndex": 30, + "gasUsed": "1273228", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x348df71d08461959d26c5e2603fc643ca7dc1e0f129968bcc7c236558339a9f1", + "transactionHash": "0x6d931724a9051a350b832dc1272786b646fd96c1317a0e534fa801b06b13340e", + "logs": [], + "blockNumber": 17027022, + "cumulativeGasUsed": "8573886", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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,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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/base_sepolia/AuthorityFactory.json b/deployments/base_sepolia/AuthorityFactory.json new file mode 100644 index 000000000..15fc6358c --- /dev/null +++ b/deployments/base_sepolia/AuthorityFactory.json @@ -0,0 +1,194 @@ +{ + "address": "0xB897F7Fe78f220aE34B7FA9493092701a873Ed45", + "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" + } + ], + "transactionHash": "0x7137ddccd81dc8c884399fb53b831fb0d3e4f799ee4f1f32c61bc31d1b8813ef", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", + "contractAddress": null, + "transactionIndex": 24, + "gasUsed": "532228", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x00b95f68b8b27bbc4fb44b6fb19fae422695b143b6f33b569039e35ae1be4d49", + "transactionHash": "0x7137ddccd81dc8c884399fb53b831fb0d3e4f799ee4f1f32c61bc31d1b8813ef", + "logs": [], + "blockNumber": 17027017, + "cumulativeGasUsed": "3479020", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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)": { + "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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/base_sepolia/ERC1155BatchPortal.json b/deployments/base_sepolia/ERC1155BatchPortal.json new file mode 100644 index 000000000..271e2110e --- /dev/null +++ b/deployments/base_sepolia/ERC1155BatchPortal.json @@ -0,0 +1,139 @@ +{ + "address": "0x4a218D331C0933d7E3EB496ac901669f28D94981", + "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" + } + ], + "transactionHash": "0xffb39c33a95d9b57337a51df795311f890a4a3f2fc7c43b18567f4ae94c98f03", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", + "contractAddress": null, + "transactionIndex": 15, + "gasUsed": "370950", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xbc93fd5f0b494088b93021a5f6f662e9b195f752ecdbc2d68fface0b3bc26594", + "transactionHash": "0xffb39c33a95d9b57337a51df795311f890a4a3f2fc7c43b18567f4ae94c98f03", + "logs": [], + "blockNumber": 17027015, + "cumulativeGasUsed": "3289905", + "status": 1, + "byzantium": true + }, + "args": [ + "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6" + ], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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": { + "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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/base_sepolia/ERC1155SinglePortal.json b/deployments/base_sepolia/ERC1155SinglePortal.json new file mode 100644 index 000000000..db4e43b1f --- /dev/null +++ b/deployments/base_sepolia/ERC1155SinglePortal.json @@ -0,0 +1,138 @@ +{ + "address": "0x2f0D587DD6EcF67d25C558f2e9c3839c579e5e38", + "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" + } + ], + "transactionHash": "0xea0c58af33b75feaa8958d30b2ff9f4ff9b4ec34c08877fc4c8923b6f61a0cee", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", + "contractAddress": null, + "transactionIndex": 10, + "gasUsed": "317542", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x19cf2a069254107a618e397a1a5b05b2ea4c83d77f92b3add9305558f4783366", + "transactionHash": "0xea0c58af33b75feaa8958d30b2ff9f4ff9b4ec34c08877fc4c8923b6f61a0cee", + "logs": [], + "blockNumber": 17027013, + "cumulativeGasUsed": "1759977", + "status": 1, + "byzantium": true + }, + "args": [ + "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6" + ], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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": { + "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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/base_sepolia/ERC20Portal.json b/deployments/base_sepolia/ERC20Portal.json new file mode 100644 index 000000000..bb7398869 --- /dev/null +++ b/deployments/base_sepolia/ERC20Portal.json @@ -0,0 +1,138 @@ +{ + "address": "0xB0e28881FF7ee9CD5B1229d570540d74bce23D39", + "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" + } + ], + "transactionHash": "0xdd4778f6d41ee6bcdbf7a0c02b3a1f8c3357ac13e223c5d652b93ef87667386b", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", + "contractAddress": null, + "transactionIndex": 14, + "gasUsed": "269088", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xa428ee345b618006e060bcab8760c3d9d4fa0fdec57e6159e808fac84c81f1fe", + "transactionHash": "0xdd4778f6d41ee6bcdbf7a0c02b3a1f8c3357ac13e223c5d652b93ef87667386b", + "logs": [], + "blockNumber": 17027008, + "cumulativeGasUsed": "1930503", + "status": 1, + "byzantium": true + }, + "args": [ + "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6" + ], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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": { + "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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/base_sepolia/ERC721Portal.json b/deployments/base_sepolia/ERC721Portal.json new file mode 100644 index 000000000..d369346e9 --- /dev/null +++ b/deployments/base_sepolia/ERC721Portal.json @@ -0,0 +1,132 @@ +{ + "address": "0x874b3245ead7474Cb9f3b83cD1446dC522f6bd36", + "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" + } + ], + "transactionHash": "0x98881649ec844a935edf26846d4231c525baab82b600ad5ba90a698441274266", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", + "contractAddress": null, + "transactionIndex": 28, + "gasUsed": "308450", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xfc09876a9b5702adf273370ab3d012181bfce59230cba45b0d1a940ac60baeaf", + "transactionHash": "0x98881649ec844a935edf26846d4231c525baab82b600ad5ba90a698441274266", + "logs": [], + "blockNumber": 17027010, + "cumulativeGasUsed": "7720743", + "status": 1, + "byzantium": true + }, + "args": [ + "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6" + ], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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": { + "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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/base_sepolia/EtherPortal.json b/deployments/base_sepolia/EtherPortal.json new file mode 100644 index 000000000..e3c87a84f --- /dev/null +++ b/deployments/base_sepolia/EtherPortal.json @@ -0,0 +1,127 @@ +{ + "address": "0xfa2292f6D85ea4e629B156A4f99219e30D12EE17", + "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" + } + ], + "transactionHash": "0xbd1e3dd1de63ffa2dd035df4ba1fef535407e72648b0749d89929df5ad171cc2", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", + "contractAddress": null, + "transactionIndex": 27, + "gasUsed": "238142", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x2bd9085d64ecf97403aa2963404d65d761405bd394da31013567254b3e844956", + "transactionHash": "0xbd1e3dd1de63ffa2dd035df4ba1fef535407e72648b0749d89929df5ad171cc2", + "logs": [], + "blockNumber": 17027005, + "cumulativeGasUsed": "2246627", + "status": 1, + "byzantium": true + }, + "args": [ + "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6" + ], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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": { + "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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/base_sepolia/InputBox.json b/deployments/base_sepolia/InputBox.json new file mode 100644 index 000000000..461b5e907 --- /dev/null +++ b/deployments/base_sepolia/InputBox.json @@ -0,0 +1,252 @@ +{ + "address": "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6", + "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" + } + ], + "transactionHash": "0xab70c6dec889cedff4bd62ba5dd563e4b8ff5180d5cadd184de18c1a9d3ca559", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", + "contractAddress": null, + "transactionIndex": 21, + "gasUsed": "275862", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x0d92cea7b64de570a3024e30535439c642d7109fd52ea460a700bcdb34f79973", + "transactionHash": "0xab70c6dec889cedff4bd62ba5dd563e4b8ff5180d5cadd184de18c1a9d3ca559", + "logs": [], + "blockNumber": 17027003, + "cumulativeGasUsed": "3734567", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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)": [ + { + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 3773, + "contract": "contracts/inputs/InputBox.sol:InputBox", + "label": "_inputBoxes", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_address,t_array(t_bytes32)dyn_storage)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_bytes32)dyn_storage": { + "base": "t_bytes32", + "encoding": "dynamic_array", + "label": "bytes32[]", + "numberOfBytes": "32" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_array(t_bytes32)dyn_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bytes32[])", + "numberOfBytes": "32", + "value": "t_array(t_bytes32)dyn_storage" + } + } + } +} \ No newline at end of file diff --git a/deployments/base_sepolia/QuorumFactory.json b/deployments/base_sepolia/QuorumFactory.json new file mode 100644 index 000000000..5bcf6cf6d --- /dev/null +++ b/deployments/base_sepolia/QuorumFactory.json @@ -0,0 +1,194 @@ +{ + "address": "0x22AFD9162079c7Ac0aF874054298Bf46F29157F1", + "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" + } + ], + "transactionHash": "0x3eb67c06afb5dfa828446eb3ec614152df1b8c984848cfd75e87dad80bd51b47", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", + "contractAddress": null, + "transactionIndex": 10, + "gasUsed": "747585", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xfc5f748a3d0f9cd164ee96fac694bee0477f358a21e5118a5038273a812fb7c3", + "transactionHash": "0x3eb67c06afb5dfa828446eb3ec614152df1b8c984848cfd75e87dad80bd51b47", + "logs": [], + "blockNumber": 17027020, + "cumulativeGasUsed": "2636376", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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)": { + "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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/base_sepolia/SafeERC20Transfer.json b/deployments/base_sepolia/SafeERC20Transfer.json new file mode 100644 index 000000000..fdbd0090d --- /dev/null +++ b/deployments/base_sepolia/SafeERC20Transfer.json @@ -0,0 +1,124 @@ +{ + "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" + } + ], + "transactionHash": "0x8499bb6c4f8a6dc8e06ade2d572dda90327d1db9fc183ebdc170891a7c6f58d6", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", + "contractAddress": null, + "transactionIndex": 14, + "gasUsed": "227912", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x17b60d0fee9109803ae0c6b0b6712aa57228014084a89c6cd195125b8b3dd73f", + "transactionHash": "0x8499bb6c4f8a6dc8e06ade2d572dda90327d1db9fc183ebdc170891a7c6f58d6", + "logs": [], + "blockNumber": 17027027, + "cumulativeGasUsed": "3434175", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"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\"}],\"devdoc\":{\"errors\":{\"AddressEmptyCode(address)\":[{\"details\":\"There's no code at `target` (it is not a contract).\"}],\"AddressInsufficientBalance(address)\":[{\"details\":\"The ETH balance of the account is not enough to perform the operation.\"}],\"FailedInnerCall()\":[{\"details\":\"A call to an address target failed. The target may have reverted.\"}],\"SafeERC20FailedOperation(address)\":[{\"details\":\"An operation with an ERC20 token failed.\"}]},\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/delegatecall/SafeERC20Transfer.sol\":\"SafeERC20Transfer\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@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/ERC20/extensions/IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n *\\n * ==== Security Considerations\\n *\\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\\n * generally recommended is:\\n *\\n * ```solidity\\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\\n * doThing(..., value);\\n * }\\n *\\n * function doThing(..., uint256 value) public {\\n * token.safeTransferFrom(msg.sender, address(this), value);\\n * ...\\n * }\\n * ```\\n *\\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\\n * {SafeERC20-safeTransferFrom}).\\n *\\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\\n * contracts should have entry points that don't rely on permit.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n *\\n * CAUTION: See Security Considerations above.\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x6008dabfe393240d73d7dd7688033f72740d570aa422254d29a7dce8568f3aff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC20} from \\\"../IERC20.sol\\\";\\nimport {IERC20Permit} from \\\"../extensions/IERC20Permit.sol\\\";\\nimport {Address} from \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n /**\\n * @dev An operation with an ERC20 token failed.\\n */\\n error SafeERC20FailedOperation(address token);\\n\\n /**\\n * @dev Indicates a failed `decreaseAllowance` request.\\n */\\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\\n\\n /**\\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\\n }\\n\\n /**\\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\\n */\\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\\n }\\n\\n /**\\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n forceApprove(token, spender, oldAllowance + value);\\n }\\n\\n /**\\n * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no\\n * value, non-reverting calls are assumed to be successful.\\n */\\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\\n unchecked {\\n uint256 currentAllowance = token.allowance(address(this), spender);\\n if (currentAllowance < requestedDecrease) {\\n revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);\\n }\\n forceApprove(token, spender, currentAllowance - requestedDecrease);\\n }\\n }\\n\\n /**\\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\\n * to be set to zero before setting it to a non-zero value, such as USDT.\\n */\\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\\n\\n if (!_callOptionalReturnBool(token, approvalCall)) {\\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\\n _callOptionalReturn(token, approvalCall);\\n }\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data);\\n if (returndata.length != 0 && !abi.decode(returndata, (bool))) {\\n revert SafeERC20FailedOperation(address(token));\\n }\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n *\\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\\n */\\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\\n // and not revert is the subcall reverts.\\n\\n (bool success, bytes memory returndata) = address(token).call(data);\\n return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;\\n }\\n}\\n\",\"keccak256\":\"0x37bb49513c49c87c4642a891b13b63571bc87013dde806617aa1efb54605f386\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev The ETH balance of the account is not enough to perform the operation.\\n */\\n error AddressInsufficientBalance(address account);\\n\\n /**\\n * @dev There's no code at `target` (it is not a contract).\\n */\\n error AddressEmptyCode(address target);\\n\\n /**\\n * @dev A call to an address target failed. The target may have reverted.\\n */\\n error FailedInnerCall();\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n if (address(this).balance < amount) {\\n revert AddressInsufficientBalance(address(this));\\n }\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n if (!success) {\\n revert FailedInnerCall();\\n }\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason or custom error, it is bubbled\\n * up by this function (like regular Solidity function calls). However, if\\n * the call reverted with no returned reason, this function reverts with a\\n * {FailedInnerCall} error.\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n if (address(this).balance < value) {\\n revert AddressInsufficientBalance(address(this));\\n }\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\\n * unsuccessful call.\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata\\n ) internal view returns (bytes memory) {\\n if (!success) {\\n _revert(returndata);\\n } else {\\n // only check if target is a contract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n if (returndata.length == 0 && target.code.length == 0) {\\n revert AddressEmptyCode(target);\\n }\\n return returndata;\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\\n * revert reason or with a default {FailedInnerCall} error.\\n */\\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\\n if (!success) {\\n _revert(returndata);\\n } else {\\n return returndata;\\n }\\n }\\n\\n /**\\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\\n */\\n function _revert(bytes memory returndata) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert FailedInnerCall();\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaf28a975a78550e45f65e559a3ad6a5ad43b9b8a37366999abd1b7084eb70721\",\"license\":\"MIT\"},\"contracts/delegatecall/SafeERC20Transfer.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.20;\\n\\nimport {SafeERC20} from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\ncontract SafeERC20Transfer {\\n using SafeERC20 for IERC20;\\n\\n function safeTransfer(IERC20 token, address to, uint256 value) external {\\n token.safeTransfer(to, value);\\n }\\n}\\n\",\"keccak256\":\"0xc14fee1ebcfe5b770373118c76d4c3e53c157487e01bb69d3831bed3302edb65\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610326806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063d1660f9914610030575b600080fd5b61004361003e36600461025e565b610045565b005b6100596001600160a01b038416838361005e565b505050565b604080516001600160a01b03848116602483015260448083018590528351808403909101815260649092019092526020810180516001600160e01b031663a9059cbb60e01b179052610059918591906000906100bc9084168361010f565b905080516000141580156100e15750808060200190518101906100df919061029f565b155b1561005957604051635274afe760e01b81526001600160a01b03841660048201526024015b60405180910390fd5b606061011d83836000610124565b9392505050565b6060814710156101495760405163cd78605960e01b8152306004820152602401610106565b600080856001600160a01b0316848660405161016591906102c1565b60006040518083038185875af1925050503d80600081146101a2576040519150601f19603f3d011682016040523d82523d6000602084013e6101a7565b606091505b50915091506101b78683836101c1565b9695505050505050565b6060826101d6576101d18261021d565b61011d565b81511580156101ed57506001600160a01b0384163b155b1561021657604051639996b31560e01b81526001600160a01b0385166004820152602401610106565b508061011d565b80511561022d5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b50565b6001600160a01b038116811461024657600080fd5b60008060006060848603121561027357600080fd5b833561027e81610249565b9250602084013561028e81610249565b929592945050506040919091013590565b6000602082840312156102b157600080fd5b8151801515811461011d57600080fd5b6000825160005b818110156102e257602081860181015185830152016102c8565b50600092019182525091905056fea2646970667358221220770726e7ad5dd1738ebf2b83baa38187dd37ed24d03d1b61c4ef95f8cde1b84c64736f6c63430008170033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063d1660f9914610030575b600080fd5b61004361003e36600461025e565b610045565b005b6100596001600160a01b038416838361005e565b505050565b604080516001600160a01b03848116602483015260448083018590528351808403909101815260649092019092526020810180516001600160e01b031663a9059cbb60e01b179052610059918591906000906100bc9084168361010f565b905080516000141580156100e15750808060200190518101906100df919061029f565b155b1561005957604051635274afe760e01b81526001600160a01b03841660048201526024015b60405180910390fd5b606061011d83836000610124565b9392505050565b6060814710156101495760405163cd78605960e01b8152306004820152602401610106565b600080856001600160a01b0316848660405161016591906102c1565b60006040518083038185875af1925050503d80600081146101a2576040519150601f19603f3d011682016040523d82523d6000602084013e6101a7565b606091505b50915091506101b78683836101c1565b9695505050505050565b6060826101d6576101d18261021d565b61011d565b81511580156101ed57506001600160a01b0384163b155b1561021657604051639996b31560e01b81526001600160a01b0385166004820152602401610106565b508061011d565b80511561022d5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b50565b6001600160a01b038116811461024657600080fd5b60008060006060848603121561027357600080fd5b833561027e81610249565b9250602084013561028e81610249565b929592945050506040919091013590565b6000602082840312156102b157600080fd5b8151801515811461011d57600080fd5b6000825160005b818110156102e257602081860181015185830152016102c8565b50600092019182525091905056fea2646970667358221220770726e7ad5dd1738ebf2b83baa38187dd37ed24d03d1b61c4ef95f8cde1b84c64736f6c63430008170033", + "devdoc": { + "errors": { + "AddressEmptyCode(address)": [ + { + "details": "There's no code at `target` (it is not a contract)." + } + ], + "AddressInsufficientBalance(address)": [ + { + "details": "The ETH balance of the account is not enough to perform the operation." + } + ], + "FailedInnerCall()": [ + { + "details": "A call to an address target failed. The target may have reverted." + } + ], + "SafeERC20FailedOperation(address)": [ + { + "details": "An operation with an ERC20 token failed." + } + ] + }, + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/base_sepolia/SelfHostedApplicationFactory.json b/deployments/base_sepolia/SelfHostedApplicationFactory.json new file mode 100644 index 000000000..af8979910 --- /dev/null +++ b/deployments/base_sepolia/SelfHostedApplicationFactory.json @@ -0,0 +1,233 @@ +{ + "address": "0x4C11C7F82D6D56a726f9B53dd99af031AFd86BB6", + "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" + } + ], + "transactionHash": "0xf324c077aac313c507b13b5f5ff0b8a91b10591b2be84202803ec3b549324b34", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", + "contractAddress": null, + "transactionIndex": 11, + "gasUsed": "287274", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x84035bc02fa89f7cd51ef06b232c92e50724ec500ee119fea296bbbeff7a5492", + "transactionHash": "0xf324c077aac313c507b13b5f5ff0b8a91b10591b2be84202803ec3b549324b34", + "logs": [], + "blockNumber": 17027025, + "cumulativeGasUsed": "1962540", + "status": 1, + "byzantium": true + }, + "args": [ + "0xB897F7Fe78f220aE34B7FA9493092701a873Ed45", + "0x1d4CfBD2622d802A07CeB4C3401Bbb455c9dbdC3" + ], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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,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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/optimism_sepolia/.chainId b/deployments/optimism_sepolia/.chainId new file mode 100644 index 000000000..03f37de82 --- /dev/null +++ b/deployments/optimism_sepolia/.chainId @@ -0,0 +1 @@ +11155420 \ No newline at end of file diff --git a/deployments/optimism_sepolia/ApplicationFactory.json b/deployments/optimism_sepolia/ApplicationFactory.json new file mode 100644 index 000000000..35fe2dbaa --- /dev/null +++ b/deployments/optimism_sepolia/ApplicationFactory.json @@ -0,0 +1,233 @@ +{ + "address": "0x1d4CfBD2622d802A07CeB4C3401Bbb455c9dbdC3", + "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" + } + ], + "transactionHash": "0x4142ca4791f60fe874907d632355e55a4f28991e9a4209cdd0984f83196cbca1", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", + "contractAddress": null, + "transactionIndex": 6, + "gasUsed": "1273228", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x575a550219655665d1a70a0db62b7da6567a1506db26cd081652e0d7e5a0eb7d", + "transactionHash": "0x4142ca4791f60fe874907d632355e55a4f28991e9a4209cdd0984f83196cbca1", + "logs": [], + "blockNumber": 19009731, + "cumulativeGasUsed": "1507048", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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,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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/optimism_sepolia/AuthorityFactory.json b/deployments/optimism_sepolia/AuthorityFactory.json new file mode 100644 index 000000000..789b10651 --- /dev/null +++ b/deployments/optimism_sepolia/AuthorityFactory.json @@ -0,0 +1,194 @@ +{ + "address": "0xB897F7Fe78f220aE34B7FA9493092701a873Ed45", + "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" + } + ], + "transactionHash": "0xd08368675d42000f6e420b8a0f1b22ed4932d5712e85ef82cda62ec705bbe76d", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", + "contractAddress": null, + "transactionIndex": 2, + "gasUsed": "532228", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x24be95c1c20a4003da70af7c9b4075f9377c201c943b267caa90b02aa5f1bbcf", + "transactionHash": "0xd08368675d42000f6e420b8a0f1b22ed4932d5712e85ef82cda62ec705bbe76d", + "logs": [], + "blockNumber": 19009724, + "cumulativeGasUsed": "664325", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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)": { + "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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/optimism_sepolia/ERC1155BatchPortal.json b/deployments/optimism_sepolia/ERC1155BatchPortal.json new file mode 100644 index 000000000..4c37d5382 --- /dev/null +++ b/deployments/optimism_sepolia/ERC1155BatchPortal.json @@ -0,0 +1,123 @@ +{ + "address": "0x4a218D331C0933d7E3EB496ac901669f28D94981", + "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" + } + ], + "args": [ + "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6" + ], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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": { + "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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/optimism_sepolia/ERC1155SinglePortal.json b/deployments/optimism_sepolia/ERC1155SinglePortal.json new file mode 100644 index 000000000..7a595a210 --- /dev/null +++ b/deployments/optimism_sepolia/ERC1155SinglePortal.json @@ -0,0 +1,122 @@ +{ + "address": "0x2f0D587DD6EcF67d25C558f2e9c3839c579e5e38", + "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" + } + ], + "args": [ + "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6" + ], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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": { + "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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/optimism_sepolia/ERC20Portal.json b/deployments/optimism_sepolia/ERC20Portal.json new file mode 100644 index 000000000..a18b49d78 --- /dev/null +++ b/deployments/optimism_sepolia/ERC20Portal.json @@ -0,0 +1,122 @@ +{ + "address": "0xB0e28881FF7ee9CD5B1229d570540d74bce23D39", + "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" + } + ], + "args": [ + "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6" + ], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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": { + "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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/optimism_sepolia/ERC721Portal.json b/deployments/optimism_sepolia/ERC721Portal.json new file mode 100644 index 000000000..c808a22ec --- /dev/null +++ b/deployments/optimism_sepolia/ERC721Portal.json @@ -0,0 +1,116 @@ +{ + "address": "0x874b3245ead7474Cb9f3b83cD1446dC522f6bd36", + "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" + } + ], + "args": [ + "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6" + ], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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": { + "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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/optimism_sepolia/EtherPortal.json b/deployments/optimism_sepolia/EtherPortal.json new file mode 100644 index 000000000..030087ece --- /dev/null +++ b/deployments/optimism_sepolia/EtherPortal.json @@ -0,0 +1,111 @@ +{ + "address": "0xfa2292f6D85ea4e629B156A4f99219e30D12EE17", + "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" + } + ], + "args": [ + "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6" + ], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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": { + "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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/optimism_sepolia/InputBox.json b/deployments/optimism_sepolia/InputBox.json new file mode 100644 index 000000000..35139a7dd --- /dev/null +++ b/deployments/optimism_sepolia/InputBox.json @@ -0,0 +1,236 @@ +{ + "address": "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6", + "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" + } + ], + "args": [], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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)": [ + { + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 3773, + "contract": "contracts/inputs/InputBox.sol:InputBox", + "label": "_inputBoxes", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_address,t_array(t_bytes32)dyn_storage)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_bytes32)dyn_storage": { + "base": "t_bytes32", + "encoding": "dynamic_array", + "label": "bytes32[]", + "numberOfBytes": "32" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_array(t_bytes32)dyn_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bytes32[])", + "numberOfBytes": "32", + "value": "t_array(t_bytes32)dyn_storage" + } + } + } +} \ No newline at end of file diff --git a/deployments/optimism_sepolia/QuorumFactory.json b/deployments/optimism_sepolia/QuorumFactory.json new file mode 100644 index 000000000..40207630d --- /dev/null +++ b/deployments/optimism_sepolia/QuorumFactory.json @@ -0,0 +1,194 @@ +{ + "address": "0x22AFD9162079c7Ac0aF874054298Bf46F29157F1", + "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" + } + ], + "transactionHash": "0x96ab7766625212f8728e8b92bd2e81ff5200555fe1a060d32f5c5e2d3640ed84", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", + "contractAddress": null, + "transactionIndex": 2, + "gasUsed": "747585", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xc6d4a65f89197146c3cb688cfd8e711cf3a6883755a27cd582a92ba977d5780c", + "transactionHash": "0x96ab7766625212f8728e8b92bd2e81ff5200555fe1a060d32f5c5e2d3640ed84", + "logs": [], + "blockNumber": 19009727, + "cumulativeGasUsed": "1779408", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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)": { + "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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/optimism_sepolia/SafeERC20Transfer.json b/deployments/optimism_sepolia/SafeERC20Transfer.json new file mode 100644 index 000000000..fb9c50aad --- /dev/null +++ b/deployments/optimism_sepolia/SafeERC20Transfer.json @@ -0,0 +1,108 @@ +{ + "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" + } + ], + "args": [], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"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\"}],\"devdoc\":{\"errors\":{\"AddressEmptyCode(address)\":[{\"details\":\"There's no code at `target` (it is not a contract).\"}],\"AddressInsufficientBalance(address)\":[{\"details\":\"The ETH balance of the account is not enough to perform the operation.\"}],\"FailedInnerCall()\":[{\"details\":\"A call to an address target failed. The target may have reverted.\"}],\"SafeERC20FailedOperation(address)\":[{\"details\":\"An operation with an ERC20 token failed.\"}]},\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/delegatecall/SafeERC20Transfer.sol\":\"SafeERC20Transfer\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@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/ERC20/extensions/IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n *\\n * ==== Security Considerations\\n *\\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\\n * generally recommended is:\\n *\\n * ```solidity\\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\\n * doThing(..., value);\\n * }\\n *\\n * function doThing(..., uint256 value) public {\\n * token.safeTransferFrom(msg.sender, address(this), value);\\n * ...\\n * }\\n * ```\\n *\\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\\n * {SafeERC20-safeTransferFrom}).\\n *\\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\\n * contracts should have entry points that don't rely on permit.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n *\\n * CAUTION: See Security Considerations above.\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x6008dabfe393240d73d7dd7688033f72740d570aa422254d29a7dce8568f3aff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC20} from \\\"../IERC20.sol\\\";\\nimport {IERC20Permit} from \\\"../extensions/IERC20Permit.sol\\\";\\nimport {Address} from \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n /**\\n * @dev An operation with an ERC20 token failed.\\n */\\n error SafeERC20FailedOperation(address token);\\n\\n /**\\n * @dev Indicates a failed `decreaseAllowance` request.\\n */\\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\\n\\n /**\\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\\n }\\n\\n /**\\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\\n */\\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\\n }\\n\\n /**\\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n forceApprove(token, spender, oldAllowance + value);\\n }\\n\\n /**\\n * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no\\n * value, non-reverting calls are assumed to be successful.\\n */\\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\\n unchecked {\\n uint256 currentAllowance = token.allowance(address(this), spender);\\n if (currentAllowance < requestedDecrease) {\\n revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);\\n }\\n forceApprove(token, spender, currentAllowance - requestedDecrease);\\n }\\n }\\n\\n /**\\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\\n * to be set to zero before setting it to a non-zero value, such as USDT.\\n */\\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\\n\\n if (!_callOptionalReturnBool(token, approvalCall)) {\\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\\n _callOptionalReturn(token, approvalCall);\\n }\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data);\\n if (returndata.length != 0 && !abi.decode(returndata, (bool))) {\\n revert SafeERC20FailedOperation(address(token));\\n }\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n *\\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\\n */\\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\\n // and not revert is the subcall reverts.\\n\\n (bool success, bytes memory returndata) = address(token).call(data);\\n return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;\\n }\\n}\\n\",\"keccak256\":\"0x37bb49513c49c87c4642a891b13b63571bc87013dde806617aa1efb54605f386\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev The ETH balance of the account is not enough to perform the operation.\\n */\\n error AddressInsufficientBalance(address account);\\n\\n /**\\n * @dev There's no code at `target` (it is not a contract).\\n */\\n error AddressEmptyCode(address target);\\n\\n /**\\n * @dev A call to an address target failed. The target may have reverted.\\n */\\n error FailedInnerCall();\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n if (address(this).balance < amount) {\\n revert AddressInsufficientBalance(address(this));\\n }\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n if (!success) {\\n revert FailedInnerCall();\\n }\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason or custom error, it is bubbled\\n * up by this function (like regular Solidity function calls). However, if\\n * the call reverted with no returned reason, this function reverts with a\\n * {FailedInnerCall} error.\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n if (address(this).balance < value) {\\n revert AddressInsufficientBalance(address(this));\\n }\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\\n * unsuccessful call.\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata\\n ) internal view returns (bytes memory) {\\n if (!success) {\\n _revert(returndata);\\n } else {\\n // only check if target is a contract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n if (returndata.length == 0 && target.code.length == 0) {\\n revert AddressEmptyCode(target);\\n }\\n return returndata;\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\\n * revert reason or with a default {FailedInnerCall} error.\\n */\\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\\n if (!success) {\\n _revert(returndata);\\n } else {\\n return returndata;\\n }\\n }\\n\\n /**\\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\\n */\\n function _revert(bytes memory returndata) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert FailedInnerCall();\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaf28a975a78550e45f65e559a3ad6a5ad43b9b8a37366999abd1b7084eb70721\",\"license\":\"MIT\"},\"contracts/delegatecall/SafeERC20Transfer.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.20;\\n\\nimport {SafeERC20} from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\ncontract SafeERC20Transfer {\\n using SafeERC20 for IERC20;\\n\\n function safeTransfer(IERC20 token, address to, uint256 value) external {\\n token.safeTransfer(to, value);\\n }\\n}\\n\",\"keccak256\":\"0xc14fee1ebcfe5b770373118c76d4c3e53c157487e01bb69d3831bed3302edb65\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610326806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063d1660f9914610030575b600080fd5b61004361003e36600461025e565b610045565b005b6100596001600160a01b038416838361005e565b505050565b604080516001600160a01b03848116602483015260448083018590528351808403909101815260649092019092526020810180516001600160e01b031663a9059cbb60e01b179052610059918591906000906100bc9084168361010f565b905080516000141580156100e15750808060200190518101906100df919061029f565b155b1561005957604051635274afe760e01b81526001600160a01b03841660048201526024015b60405180910390fd5b606061011d83836000610124565b9392505050565b6060814710156101495760405163cd78605960e01b8152306004820152602401610106565b600080856001600160a01b0316848660405161016591906102c1565b60006040518083038185875af1925050503d80600081146101a2576040519150601f19603f3d011682016040523d82523d6000602084013e6101a7565b606091505b50915091506101b78683836101c1565b9695505050505050565b6060826101d6576101d18261021d565b61011d565b81511580156101ed57506001600160a01b0384163b155b1561021657604051639996b31560e01b81526001600160a01b0385166004820152602401610106565b508061011d565b80511561022d5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b50565b6001600160a01b038116811461024657600080fd5b60008060006060848603121561027357600080fd5b833561027e81610249565b9250602084013561028e81610249565b929592945050506040919091013590565b6000602082840312156102b157600080fd5b8151801515811461011d57600080fd5b6000825160005b818110156102e257602081860181015185830152016102c8565b50600092019182525091905056fea2646970667358221220770726e7ad5dd1738ebf2b83baa38187dd37ed24d03d1b61c4ef95f8cde1b84c64736f6c63430008170033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063d1660f9914610030575b600080fd5b61004361003e36600461025e565b610045565b005b6100596001600160a01b038416838361005e565b505050565b604080516001600160a01b03848116602483015260448083018590528351808403909101815260649092019092526020810180516001600160e01b031663a9059cbb60e01b179052610059918591906000906100bc9084168361010f565b905080516000141580156100e15750808060200190518101906100df919061029f565b155b1561005957604051635274afe760e01b81526001600160a01b03841660048201526024015b60405180910390fd5b606061011d83836000610124565b9392505050565b6060814710156101495760405163cd78605960e01b8152306004820152602401610106565b600080856001600160a01b0316848660405161016591906102c1565b60006040518083038185875af1925050503d80600081146101a2576040519150601f19603f3d011682016040523d82523d6000602084013e6101a7565b606091505b50915091506101b78683836101c1565b9695505050505050565b6060826101d6576101d18261021d565b61011d565b81511580156101ed57506001600160a01b0384163b155b1561021657604051639996b31560e01b81526001600160a01b0385166004820152602401610106565b508061011d565b80511561022d5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b50565b6001600160a01b038116811461024657600080fd5b60008060006060848603121561027357600080fd5b833561027e81610249565b9250602084013561028e81610249565b929592945050506040919091013590565b6000602082840312156102b157600080fd5b8151801515811461011d57600080fd5b6000825160005b818110156102e257602081860181015185830152016102c8565b50600092019182525091905056fea2646970667358221220770726e7ad5dd1738ebf2b83baa38187dd37ed24d03d1b61c4ef95f8cde1b84c64736f6c63430008170033", + "devdoc": { + "errors": { + "AddressEmptyCode(address)": [ + { + "details": "There's no code at `target` (it is not a contract)." + } + ], + "AddressInsufficientBalance(address)": [ + { + "details": "The ETH balance of the account is not enough to perform the operation." + } + ], + "FailedInnerCall()": [ + { + "details": "A call to an address target failed. The target may have reverted." + } + ], + "SafeERC20FailedOperation(address)": [ + { + "details": "An operation with an ERC20 token failed." + } + ] + }, + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/optimism_sepolia/SelfHostedApplicationFactory.json b/deployments/optimism_sepolia/SelfHostedApplicationFactory.json new file mode 100644 index 000000000..8e5f90b98 --- /dev/null +++ b/deployments/optimism_sepolia/SelfHostedApplicationFactory.json @@ -0,0 +1,233 @@ +{ + "address": "0x4C11C7F82D6D56a726f9B53dd99af031AFd86BB6", + "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" + } + ], + "transactionHash": "0x15d533b71338b01064f43884c1ab71d97c15445d3ba28a90bb0d6a17c19eb043", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", + "contractAddress": null, + "transactionIndex": 2, + "gasUsed": "287274", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xf7bfa00c8e3b76e6b140cd3d4d970433ddfbc7288a5206552696490dd4ef8a13", + "transactionHash": "0x15d533b71338b01064f43884c1ab71d97c15445d3ba28a90bb0d6a17c19eb043", + "logs": [], + "blockNumber": 19009734, + "cumulativeGasUsed": "1413730", + "status": 1, + "byzantium": true + }, + "args": [ + "0xB897F7Fe78f220aE34B7FA9493092701a873Ed45", + "0x1d4CfBD2622d802A07CeB4C3401Bbb455c9dbdC3" + ], + "numDeployments": 1, + "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "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,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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/export/abi/arbitrum_sepolia.json b/export/abi/arbitrum_sepolia.json new file mode 100644 index 000000000..d89c900db --- /dev/null +++ b/export/abi/arbitrum_sepolia.json @@ -0,0 +1,968 @@ +{ + "name": "arbitrum_sepolia", + "chainId": "421614", + "contracts": { + "InputBox": { + "address": "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6", + "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" + } + ] + }, + "EtherPortal": { + "address": "0xfa2292f6D85ea4e629B156A4f99219e30D12EE17", + "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" + } + ] + }, + "ERC20Portal": { + "address": "0xB0e28881FF7ee9CD5B1229d570540d74bce23D39", + "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" + } + ] + }, + "ERC721Portal": { + "address": "0x874b3245ead7474Cb9f3b83cD1446dC522f6bd36", + "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" + } + ] + }, + "ERC1155SinglePortal": { + "address": "0x2f0D587DD6EcF67d25C558f2e9c3839c579e5e38", + "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" + } + ] + }, + "ERC1155BatchPortal": { + "address": "0x4a218D331C0933d7E3EB496ac901669f28D94981", + "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" + } + ] + }, + "AuthorityFactory": { + "address": "0xB897F7Fe78f220aE34B7FA9493092701a873Ed45", + "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" + } + ] + }, + "QuorumFactory": { + "address": "0x22AFD9162079c7Ac0aF874054298Bf46F29157F1", + "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" + } + ] + }, + "ApplicationFactory": { + "address": "0x1d4CfBD2622d802A07CeB4C3401Bbb455c9dbdC3", + "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" + } + ] + }, + "SelfHostedApplicationFactory": { + "address": "0x4C11C7F82D6D56a726f9B53dd99af031AFd86BB6", + "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" + } + ] + }, + "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 diff --git a/export/abi/base_sepolia.json b/export/abi/base_sepolia.json new file mode 100644 index 000000000..8d4255eca --- /dev/null +++ b/export/abi/base_sepolia.json @@ -0,0 +1,968 @@ +{ + "name": "base_sepolia", + "chainId": "84532", + "contracts": { + "InputBox": { + "address": "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6", + "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" + } + ] + }, + "EtherPortal": { + "address": "0xfa2292f6D85ea4e629B156A4f99219e30D12EE17", + "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" + } + ] + }, + "ERC20Portal": { + "address": "0xB0e28881FF7ee9CD5B1229d570540d74bce23D39", + "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" + } + ] + }, + "ERC721Portal": { + "address": "0x874b3245ead7474Cb9f3b83cD1446dC522f6bd36", + "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" + } + ] + }, + "ERC1155SinglePortal": { + "address": "0x2f0D587DD6EcF67d25C558f2e9c3839c579e5e38", + "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" + } + ] + }, + "ERC1155BatchPortal": { + "address": "0x4a218D331C0933d7E3EB496ac901669f28D94981", + "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" + } + ] + }, + "AuthorityFactory": { + "address": "0xB897F7Fe78f220aE34B7FA9493092701a873Ed45", + "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" + } + ] + }, + "QuorumFactory": { + "address": "0x22AFD9162079c7Ac0aF874054298Bf46F29157F1", + "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" + } + ] + }, + "ApplicationFactory": { + "address": "0x1d4CfBD2622d802A07CeB4C3401Bbb455c9dbdC3", + "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" + } + ] + }, + "SelfHostedApplicationFactory": { + "address": "0x4C11C7F82D6D56a726f9B53dd99af031AFd86BB6", + "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" + } + ] + }, + "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 diff --git a/export/abi/optimism_sepolia.json b/export/abi/optimism_sepolia.json new file mode 100644 index 000000000..be3821153 --- /dev/null +++ b/export/abi/optimism_sepolia.json @@ -0,0 +1,968 @@ +{ + "name": "optimism_sepolia", + "chainId": "11155420", + "contracts": { + "InputBox": { + "address": "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6", + "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" + } + ] + }, + "EtherPortal": { + "address": "0xfa2292f6D85ea4e629B156A4f99219e30D12EE17", + "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" + } + ] + }, + "ERC20Portal": { + "address": "0xB0e28881FF7ee9CD5B1229d570540d74bce23D39", + "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" + } + ] + }, + "ERC721Portal": { + "address": "0x874b3245ead7474Cb9f3b83cD1446dC522f6bd36", + "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" + } + ] + }, + "ERC1155SinglePortal": { + "address": "0x2f0D587DD6EcF67d25C558f2e9c3839c579e5e38", + "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" + } + ] + }, + "ERC1155BatchPortal": { + "address": "0x4a218D331C0933d7E3EB496ac901669f28D94981", + "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" + } + ] + }, + "AuthorityFactory": { + "address": "0xB897F7Fe78f220aE34B7FA9493092701a873Ed45", + "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" + } + ] + }, + "QuorumFactory": { + "address": "0x22AFD9162079c7Ac0aF874054298Bf46F29157F1", + "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" + } + ] + }, + "ApplicationFactory": { + "address": "0x1d4CfBD2622d802A07CeB4C3401Bbb455c9dbdC3", + "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" + } + ] + }, + "SelfHostedApplicationFactory": { + "address": "0x4C11C7F82D6D56a726f9B53dd99af031AFd86BB6", + "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" + } + ] + }, + "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