From 31ba77723477882ddf3709ce09d0bc91ee361dae Mon Sep 17 00:00:00 2001 From: Guilherme Dantas Date: Wed, 2 Oct 2024 14:20:59 -0300 Subject: [PATCH] chore: remove v1 deployments --- deployments/arbitrum/.chainId | 1 - deployments/arbitrum/AuthorityFactory.json | 183 ---- deployments/arbitrum/CartesiDAppFactory.json | 237 ----- deployments/arbitrum/ERC1155BatchPortal.json | 139 --- deployments/arbitrum/ERC1155SinglePortal.json | 138 --- deployments/arbitrum/ERC20Portal.json | 126 --- deployments/arbitrum/ERC721Portal.json | 132 --- deployments/arbitrum/EtherPortal.json | 127 --- deployments/arbitrum/InputBox.json | 246 ----- deployments/arbitrum_sepolia/.chainId | 1 - .../arbitrum_sepolia/AuthorityFactory.json | 183 ---- .../arbitrum_sepolia/CartesiDAppFactory.json | 237 ----- .../arbitrum_sepolia/ERC1155BatchPortal.json | 139 --- .../arbitrum_sepolia/ERC1155SinglePortal.json | 122 --- deployments/arbitrum_sepolia/ERC20Portal.json | 126 --- .../arbitrum_sepolia/ERC721Portal.json | 132 --- deployments/arbitrum_sepolia/EtherPortal.json | 127 --- deployments/arbitrum_sepolia/InputBox.json | 246 ----- deployments/mainnet/.chainId | 1 - deployments/mainnet/AuthorityFactory.json | 183 ---- deployments/mainnet/CartesiDAppFactory.json | 237 ----- deployments/mainnet/ERC1155BatchPortal.json | 139 --- deployments/mainnet/ERC1155SinglePortal.json | 138 --- deployments/mainnet/ERC20Portal.json | 126 --- deployments/mainnet/ERC721Portal.json | 132 --- deployments/mainnet/EtherPortal.json | 127 --- deployments/mainnet/InputBox.json | 246 ----- deployments/optimism/.chainId | 1 - deployments/optimism/AuthorityFactory.json | 183 ---- deployments/optimism/CartesiDAppFactory.json | 237 ----- deployments/optimism/ERC1155BatchPortal.json | 139 --- deployments/optimism/ERC1155SinglePortal.json | 138 --- deployments/optimism/ERC20Portal.json | 126 --- deployments/optimism/ERC721Portal.json | 132 --- deployments/optimism/EtherPortal.json | 127 --- deployments/optimism/InputBox.json | 246 ----- deployments/optimism_sepolia/.chainId | 1 - .../optimism_sepolia/AuthorityFactory.json | 183 ---- .../optimism_sepolia/CartesiDAppFactory.json | 237 ----- .../optimism_sepolia/ERC1155BatchPortal.json | 139 --- .../optimism_sepolia/ERC1155SinglePortal.json | 138 --- deployments/optimism_sepolia/ERC20Portal.json | 126 --- .../optimism_sepolia/ERC721Portal.json | 132 --- deployments/optimism_sepolia/EtherPortal.json | 127 --- deployments/optimism_sepolia/InputBox.json | 246 ----- deployments/sepolia/.chainId | 1 - deployments/sepolia/SafeERC20Transfer.json | 124 --- export/abi/arbitrum.json | 920 ------------------ export/abi/arbitrum_sepolia.json | 920 ------------------ export/abi/mainnet.json | 920 ------------------ export/abi/optimism.json | 920 ------------------ export/abi/optimism_sepolia.json | 920 ------------------ 52 files changed, 11354 deletions(-) delete mode 100644 deployments/arbitrum/.chainId delete mode 100644 deployments/arbitrum/AuthorityFactory.json delete mode 100644 deployments/arbitrum/CartesiDAppFactory.json delete mode 100644 deployments/arbitrum/ERC1155BatchPortal.json delete mode 100644 deployments/arbitrum/ERC1155SinglePortal.json delete mode 100644 deployments/arbitrum/ERC20Portal.json delete mode 100644 deployments/arbitrum/ERC721Portal.json delete mode 100644 deployments/arbitrum/EtherPortal.json delete mode 100644 deployments/arbitrum/InputBox.json delete mode 100644 deployments/arbitrum_sepolia/.chainId delete mode 100644 deployments/arbitrum_sepolia/AuthorityFactory.json delete mode 100644 deployments/arbitrum_sepolia/CartesiDAppFactory.json delete mode 100644 deployments/arbitrum_sepolia/ERC1155BatchPortal.json delete mode 100644 deployments/arbitrum_sepolia/ERC1155SinglePortal.json delete mode 100644 deployments/arbitrum_sepolia/ERC20Portal.json delete mode 100644 deployments/arbitrum_sepolia/ERC721Portal.json delete mode 100644 deployments/arbitrum_sepolia/EtherPortal.json delete mode 100644 deployments/arbitrum_sepolia/InputBox.json delete mode 100644 deployments/mainnet/.chainId delete mode 100644 deployments/mainnet/AuthorityFactory.json delete mode 100644 deployments/mainnet/CartesiDAppFactory.json delete mode 100644 deployments/mainnet/ERC1155BatchPortal.json delete mode 100644 deployments/mainnet/ERC1155SinglePortal.json delete mode 100644 deployments/mainnet/ERC20Portal.json delete mode 100644 deployments/mainnet/ERC721Portal.json delete mode 100644 deployments/mainnet/EtherPortal.json delete mode 100644 deployments/mainnet/InputBox.json delete mode 100644 deployments/optimism/.chainId delete mode 100644 deployments/optimism/AuthorityFactory.json delete mode 100644 deployments/optimism/CartesiDAppFactory.json delete mode 100644 deployments/optimism/ERC1155BatchPortal.json delete mode 100644 deployments/optimism/ERC1155SinglePortal.json delete mode 100644 deployments/optimism/ERC20Portal.json delete mode 100644 deployments/optimism/ERC721Portal.json delete mode 100644 deployments/optimism/EtherPortal.json delete mode 100644 deployments/optimism/InputBox.json delete mode 100644 deployments/optimism_sepolia/.chainId delete mode 100644 deployments/optimism_sepolia/AuthorityFactory.json delete mode 100644 deployments/optimism_sepolia/CartesiDAppFactory.json delete mode 100644 deployments/optimism_sepolia/ERC1155BatchPortal.json delete mode 100644 deployments/optimism_sepolia/ERC1155SinglePortal.json delete mode 100644 deployments/optimism_sepolia/ERC20Portal.json delete mode 100644 deployments/optimism_sepolia/ERC721Portal.json delete mode 100644 deployments/optimism_sepolia/EtherPortal.json delete mode 100644 deployments/optimism_sepolia/InputBox.json delete mode 100644 deployments/sepolia/.chainId delete mode 100644 deployments/sepolia/SafeERC20Transfer.json delete mode 100644 export/abi/arbitrum.json delete mode 100644 export/abi/arbitrum_sepolia.json delete mode 100644 export/abi/mainnet.json delete mode 100644 export/abi/optimism.json delete mode 100644 export/abi/optimism_sepolia.json diff --git a/deployments/arbitrum/.chainId b/deployments/arbitrum/.chainId deleted file mode 100644 index 7df83ecbe..000000000 --- a/deployments/arbitrum/.chainId +++ /dev/null @@ -1 +0,0 @@ -42161 \ No newline at end of file diff --git a/deployments/arbitrum/AuthorityFactory.json b/deployments/arbitrum/AuthorityFactory.json deleted file mode 100644 index 599f75d03..000000000 --- a/deployments/arbitrum/AuthorityFactory.json +++ /dev/null @@ -1,183 +0,0 @@ -{ - "address": "0xf26a5b278C25D8D41A136d22Ad719EACEd9c3e63", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "authorityOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract Authority", - "name": "authority", - "type": "address" - } - ], - "name": "AuthorityCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateAuthorityAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newAuthority", - "outputs": [ - { - "internalType": "contract Authority", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - } - ], - "name": "newAuthority", - "outputs": [ - { - "internalType": "contract Authority", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0x75c1178960fdbc4e6cf2e90f2ac487abe7ed3d50b873fc7e76e8fbf0f487918b", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 1, - "gasUsed": "3787872", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x0b7f7ea03d72b44077f9eb9db76e8196078649039a9e5442e759bbe57e4fda50", - "transactionHash": "0x75c1178960fdbc4e6cf2e90f2ac487abe7ed3d50b873fc7e76e8fbf0f487918b", - "logs": [], - "blockNumber": 137456706, - "cumulativeGasUsed": "3787872", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 1, - "solcInputHash": "b1bc2a879218740e83dfbb7046a3cc8c", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"authorityOwner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract Authority\",\"name\":\"authority\",\"type\":\"address\"}],\"name\":\"AuthorityCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"calculateAuthorityAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"newAuthority\",\"outputs\":[{\"internalType\":\"contract Authority\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"}],\"name\":\"newAuthority\",\"outputs\":[{\"internalType\":\"contract Authority\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"AuthorityCreated(address,address)\":{\"details\":\"MUST be triggered on a successful call to `newAuthority`.\",\"params\":{\"authority\":\"The authority\",\"authorityOwner\":\"The initial authority owner\"}}},\"kind\":\"dev\",\"methods\":{\"calculateAuthorityAddress(address,bytes32)\":{\"details\":\"Beware that only the `newAuthority` function with the `_salt` parameter is able to deterministically deploy an authority.\",\"params\":{\"_authorityOwner\":\"The initial authority owner\",\"_salt\":\"The salt used to deterministically generate the authority address\"},\"returns\":{\"_0\":\"The deterministic authority address\"}},\"newAuthority(address)\":{\"details\":\"On success, MUST emit an `AuthorityCreated` event.\",\"params\":{\"_authorityOwner\":\"The initial authority owner\"},\"returns\":{\"_0\":\"The authority\"}},\"newAuthority(address,bytes32)\":{\"details\":\"On success, MUST emit an `AuthorityCreated` event.\",\"params\":{\"_authorityOwner\":\"The initial authority owner\",\"_salt\":\"The salt used to deterministically generate the authority address\"},\"returns\":{\"_0\":\"The authority\"}}},\"title\":\"Authority Factory\",\"version\":1},\"userdoc\":{\"events\":{\"AuthorityCreated(address,address)\":{\"notice\":\"A new authority was deployed.\"}},\"kind\":\"user\",\"methods\":{\"calculateAuthorityAddress(address,bytes32)\":{\"notice\":\"Calculate the address of an authority to be deployed deterministically.\"},\"newAuthority(address)\":{\"notice\":\"Deploy a new authority.\"},\"newAuthority(address,bytes32)\":{\"notice\":\"Deploy a new authority deterministically.\"}},\"notice\":\"Allows anyone to reliably deploy a new `Authority` contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/consensus/authority/AuthorityFactory.sol\":\"AuthorityFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\\n require(address(this).balance >= amount, \\\"Create2: insufficient balance\\\");\\n require(bytecode.length != 0, \\\"Create2: bytecode length is zero\\\");\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n require(addr != address(0), \\\"Create2: Failed on deploy\\\");\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6e00f269073ffc4350e56b7e8153c9092d5f70bfba423299990514183101ef89\",\"license\":\"MIT\"},\"contracts/consensus/AbstractConsensus.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IConsensus} from \\\"./IConsensus.sol\\\";\\n\\n/// @title Abstract Consensus\\n/// @notice An abstract contract that partially implements `IConsensus`.\\nabstract contract AbstractConsensus is IConsensus {\\n /// @notice Emits an `ApplicationJoined` event with the message sender.\\n function join() external override {\\n emit ApplicationJoined(msg.sender);\\n }\\n}\\n\",\"keccak256\":\"0xced9c940ccbbe81fbfcf3bc087c04b9ae90325d6bba68a8cee9ebfa3dd9d231d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/IConsensus.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @title Consensus interface\\n///\\n/// @notice This contract defines a generic interface for consensuses.\\n/// We use the word \\\"consensus\\\" to designate a contract that provides claims\\n/// in the base layer regarding the state of off-chain machines running in\\n/// the execution layer. How this contract is able to reach consensus, who is\\n/// able to submit claims, and how are claims stored in the base layer are\\n/// some of the implementation details left unspecified by this interface.\\n///\\n/// From the point of view of a DApp, these claims are necessary to validate\\n/// on-chain action allowed by the off-chain machine in the form of vouchers\\n/// and notices. Each claim is composed of three parts: an epoch hash, a first\\n/// index, and a last index. We'll explain each of these parts below.\\n///\\n/// First, let us define the word \\\"epoch\\\". For finality reasons, we need to\\n/// divide the stream of inputs being fed into the off-chain machine into\\n/// batches of inputs, which we call \\\"epoches\\\". At the end of every epoch,\\n/// we summarize the state of the off-chain machine in a single hash, called\\n/// \\\"epoch hash\\\". Please note that this interface does not define how this\\n/// stream of inputs is being chopped up into epoches.\\n///\\n/// The other two parts are simply the indices of the first and last inputs\\n/// accepted during the epoch. Logically, the first index MUST BE less than\\n/// or equal to the last index. As a result, every epoch MUST accept at least\\n/// one input. This assumption stems from the fact that the state of a machine\\n/// can only change after an input is fed into it.\\n///\\n/// Examples of possible implementations of this interface include:\\n///\\n/// * An authority consensus, controlled by a single address who has full\\n/// control over epoch boundaries, claim submission, asset management, etc.\\n///\\n/// * A quorum consensus, controlled by a limited set of validators, that\\n/// vote on the state of the machine at the end of every epoch. Also, epoch\\n/// boundaries are determined by the timestamp in the base layer, and assets\\n/// are split equally amongst the validators.\\n///\\n/// * An NxN consensus, which allows anyone to submit and dispute claims\\n/// in the base layer. Epoch boundaries are determined in the same fashion\\n/// as in the quorum example.\\n///\\ninterface IConsensus {\\n /// @notice An application has joined the consensus' validation set.\\n /// @param application The application\\n /// @dev MUST be triggered on a successful call to `join`.\\n event ApplicationJoined(address application);\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// The encoding of `_proofContext` might vary\\n /// depending on the implementation.\\n /// @param _dapp The DApp address\\n /// @param _proofContext Data for retrieving the desired claim\\n /// @return epochHash_ The claimed epoch hash\\n /// @return firstInputIndex_ The index of the first input of the epoch in the input box\\n /// @return lastInputIndex_ The index of the last input of the epoch in the input box\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n )\\n external\\n view\\n returns (\\n bytes32 epochHash_,\\n uint256 firstInputIndex_,\\n uint256 lastInputIndex_\\n );\\n\\n /// @notice Signal the consensus that the message sender wants to join its validation set.\\n /// @dev MUST fire an `ApplicationJoined` event with the message sender as argument.\\n function join() external;\\n}\\n\",\"keccak256\":\"0xc9d295fada66eb0602e0f1e2e236708e52f959927abb4ab6b04173a98b92ac16\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/Authority.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {IConsensus} from \\\"../IConsensus.sol\\\";\\nimport {AbstractConsensus} from \\\"../AbstractConsensus.sol\\\";\\nimport {IHistory} from \\\"../../history/IHistory.sol\\\";\\n\\n/// @title Authority consensus\\n/// @notice A consensus model controlled by a single address, the owner.\\n/// Claims are stored in an auxiliary contract called `History`.\\n/// @dev This contract inherits `AbstractConsensus` and OpenZeppelin's `Ownable` contract.\\n/// For more information on `Ownable`, please consult OpenZeppelin's official documentation.\\ncontract Authority is AbstractConsensus, Ownable {\\n /// @notice The current history contract.\\n /// @dev See the `getHistory` and `setHistory` functions.\\n IHistory internal history;\\n\\n /// @notice A new history contract is used to store claims.\\n /// @param history The new history contract\\n /// @dev MUST be triggered on a successful call to `setHistory`.\\n event NewHistory(IHistory history);\\n\\n /// @notice Raised when a transfer of tokens from an authority to a recipient fails.\\n error AuthorityWithdrawalFailed();\\n\\n /// @notice Constructs an `Authority` contract.\\n /// @param _owner The initial contract owner\\n constructor(address _owner) {\\n // constructor in Ownable already called `transferOwnership(msg.sender)`, so\\n // we only need to call `transferOwnership(_owner)` if _owner != msg.sender\\n if (msg.sender != _owner) {\\n transferOwnership(_owner);\\n }\\n }\\n\\n /// @notice Submits a claim to the current history contract.\\n /// The encoding of `_claimData` might vary depending on the\\n /// implementation of the current history contract.\\n /// @param _claimData Data for submitting a claim\\n /// @dev Can only be called by the `Authority` owner,\\n /// and the `Authority` contract must have ownership over\\n /// its current history contract.\\n function submitClaim(bytes calldata _claimData) external onlyOwner {\\n history.submitClaim(_claimData);\\n }\\n\\n /// @notice Transfer ownership over the current history contract to `_consensus`.\\n /// @param _consensus The new owner of the current history contract\\n /// @dev Can only be called by the `Authority` owner,\\n /// and the `Authority` contract must have ownership over\\n /// its current history contract.\\n function migrateHistoryToConsensus(address _consensus) external onlyOwner {\\n history.migrateToConsensus(_consensus);\\n }\\n\\n /// @notice Make `Authority` point to another history contract.\\n /// @param _history The new history contract\\n /// @dev Emits a `NewHistory` event.\\n /// Can only be called by the `Authority` owner.\\n function setHistory(IHistory _history) external onlyOwner {\\n history = _history;\\n emit NewHistory(_history);\\n }\\n\\n /// @notice Get the current history contract.\\n /// @return The current history contract\\n function getHistory() external view returns (IHistory) {\\n return history;\\n }\\n\\n /// @notice Get a claim from the current history.\\n /// The encoding of `_proofContext` might vary depending on the\\n /// implementation of the current history contract.\\n /// @inheritdoc IConsensus\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n ) external view override returns (bytes32, uint256, uint256) {\\n return history.getClaim(_dapp, _proofContext);\\n }\\n\\n /// @notice Transfer some amount of ERC-20 tokens to a recipient.\\n /// @param _token The token contract\\n /// @param _recipient The recipient address\\n /// @param _amount The amount of tokens to be withdrawn\\n /// @dev Can only be called by the `Authority` owner.\\n function withdrawERC20Tokens(\\n IERC20 _token,\\n address _recipient,\\n uint256 _amount\\n ) external onlyOwner {\\n bool success = _token.transfer(_recipient, _amount);\\n\\n if (!success) {\\n revert AuthorityWithdrawalFailed();\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc71ea13163833684ce576861fbb19dc40e7096a022c6976b61a99dfc9e1c0903\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/AuthorityFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Create2} from \\\"@openzeppelin/contracts/utils/Create2.sol\\\";\\n\\nimport {IAuthorityFactory} from \\\"./IAuthorityFactory.sol\\\";\\nimport {Authority} from \\\"./Authority.sol\\\";\\n\\n/// @title Authority Factory\\n/// @notice Allows anyone to reliably deploy a new `Authority` contract.\\ncontract AuthorityFactory is IAuthorityFactory {\\n function newAuthority(\\n address _authorityOwner\\n ) external override returns (Authority) {\\n Authority authority = new Authority(_authorityOwner);\\n\\n emit AuthorityCreated(_authorityOwner, authority);\\n\\n return authority;\\n }\\n\\n function newAuthority(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external override returns (Authority) {\\n Authority authority = new Authority{salt: _salt}(_authorityOwner);\\n\\n emit AuthorityCreated(_authorityOwner, authority);\\n\\n return authority;\\n }\\n\\n function calculateAuthorityAddress(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external view override returns (address) {\\n return\\n Create2.computeAddress(\\n _salt,\\n keccak256(\\n abi.encodePacked(\\n type(Authority).creationCode,\\n abi.encode(_authorityOwner)\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x1b78c9693cfd7df3833c6ea1c18d767a10167f4bf6ac8ea883c74e7da281f418\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/IAuthorityFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Authority} from \\\"./Authority.sol\\\";\\n\\n/// @title Authority Factory interface\\ninterface IAuthorityFactory {\\n // Events\\n\\n /// @notice A new authority was deployed.\\n /// @param authorityOwner The initial authority owner\\n /// @param authority The authority\\n /// @dev MUST be triggered on a successful call to `newAuthority`.\\n event AuthorityCreated(address authorityOwner, Authority authority);\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new authority.\\n /// @param _authorityOwner The initial authority owner\\n /// @return The authority\\n /// @dev On success, MUST emit an `AuthorityCreated` event.\\n function newAuthority(address _authorityOwner) external returns (Authority);\\n\\n /// @notice Deploy a new authority deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority address\\n /// @return The authority\\n /// @dev On success, MUST emit an `AuthorityCreated` event.\\n function newAuthority(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external returns (Authority);\\n\\n /// @notice Calculate the address of an authority to be deployed deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority address\\n /// @return The deterministic authority address\\n /// @dev Beware that only the `newAuthority` function with the `_salt` parameter\\n /// is able to deterministically deploy an authority.\\n function calculateAuthorityAddress(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x149bcdf9641b337836263196aabb655e69902212ede21becedd9c08b5b304717\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/history/IHistory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @title History interface\\ninterface IHistory {\\n // Permissioned functions\\n\\n /// @notice Submit a claim.\\n /// The encoding of `_claimData` might vary\\n /// depending on the history implementation.\\n /// @param _claimData Data for submitting a claim\\n /// @dev Should have access control.\\n function submitClaim(bytes calldata _claimData) external;\\n\\n /// @notice Transfer ownership to another consensus.\\n /// @param _consensus The new consensus\\n /// @dev Should have access control.\\n function migrateToConsensus(address _consensus) external;\\n\\n // Permissionless functions\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// The encoding of `_proofContext` might vary\\n /// depending on the history implementation.\\n /// @param _dapp The DApp address\\n /// @param _proofContext Data for retrieving the desired claim\\n /// @return epochHash_ The claimed epoch hash\\n /// @return firstInputIndex_ The index of the first input of the epoch in the input box\\n /// @return lastInputIndex_ The index of the last input of the epoch in the input box\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n )\\n external\\n view\\n returns (\\n bytes32 epochHash_,\\n uint256 firstInputIndex_,\\n uint256 lastInputIndex_\\n );\\n}\\n\",\"keccak256\":\"0x1378cbc831833abae8e2a565b88899d6416ea1208aa9724bd4df28e74848ffcf\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50610cb5806100206000396000f3fe608060405234801561001057600080fd5b50600436106100405760003560e01c80629c5784146100455780635a3f27d314610074578063b3a51b8414610087575b600080fd5b610058610053366004610288565b61009a565b6040516001600160a01b03909116815260200160405180910390f35b610058610082366004610288565b610115565b6100586100953660046102b2565b6101a4565b600061010e82604051806020016100b09061025f565b601f1982820381018352601f9091011660408181526001600160a01b03881660208301520160408051601f19818403018152908290526100f392916020016102fd565b6040516020818303038152906040528051906020012061022d565b9392505050565b60008082846040516101269061025f565b6001600160a01b0390911681526020018190604051809103906000f5905080158015610156573d6000803e3d6000fd5b50604080516001600160a01b038088168252831660208201529192507f0fb2d916aa6a78060ff9e89d89d62797c6668818dec04969013c5098754380ec910160405180910390a19392505050565b600080826040516101b49061025f565b6001600160a01b039091168152602001604051809103906000f0801580156101e0573d6000803e3d6000fd5b50604080516001600160a01b038087168252831660208201529192507f0fb2d916aa6a78060ff9e89d89d62797c6668818dec04969013c5098754380ec910160405180910390a192915050565b600061010e8383306000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b6109658061031b83390190565b80356001600160a01b038116811461028357600080fd5b919050565b6000806040838503121561029b57600080fd5b6102a48361026c565b946020939093013593505050565b6000602082840312156102c457600080fd5b61010e8261026c565b6000815160005b818110156102ee57602081850181015186830152016102d4565b50600093019283525090919050565b600061031261030c83866102cd565b846102cd565b94935050505056fe608060405234801561001057600080fd5b5060405161096538038061096583398101604081905261002f91610181565b61003833610057565b336001600160a01b0382161461005157610051816100a7565b506101b1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6100af610125565b6001600160a01b0381166101195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61012281610057565b50565b6000546001600160a01b0316331461017f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610110565b565b60006020828403121561019357600080fd5b81516001600160a01b03811681146101aa57600080fd5b9392505050565b6107a5806101c06000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063b688a36311610066578063b688a3631461010e578063bcdd1e1314610116578063d79a824014610129578063ddfdfbb014610157578063f2fde38b1461016a57600080fd5b8063159c5ea1146100a3578063715018a6146100b85780638da5cb5b146100c05780639368a3d3146100ea578063aa15efc8146100fd575b600080fd5b6100b66100b1366004610567565b61017d565b005b6100b66101d9565b6000546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b6100b66100f8366004610567565b6101ed565b6001546001600160a01b03166100cd565b6100b6610257565b6100b661012436600461058b565b61028c565b61013c610137366004610615565b610331565b604080519384526020840192909252908201526060016100e1565b6100b661016536600461066a565b6103ba565b6100b6610178366004610567565b61042a565b6101856104a8565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f2bcd43869347a1d42f97ac6042f3d129817abd05a6125f9750fe3724e321d23e9060200160405180910390a150565b6101e16104a8565b6101eb6000610502565b565b6101f56104a8565b60015460405163fc41168360e01b81526001600160a01b0383811660048301529091169063fc41168390602401600060405180830381600087803b15801561023c57600080fd5b505af1158015610250573d6000803e3d6000fd5b5050505050565b6040513381527f27c2b702d3bff195a18baca2daf00b20a986177c5f1449af4e2d46a3c3e02ce59060200160405180910390a1565b6102946104a8565b60405163a9059cbb60e01b81526001600160a01b038381166004830152602482018390526000919085169063a9059cbb906044016020604051808303816000875af11580156102e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030b91906106ac565b90508061032b5760405163099e1ca760e11b815260040160405180910390fd5b50505050565b60015460405163035e6a0960e61b8152600091829182916001600160a01b03169063d79a82409061036a908990899089906004016106f7565b606060405180830381865afa158015610387573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ab9190610725565b92509250925093509350939050565b6103c26104a8565b600154604051630ddfdfbb60e41b81526001600160a01b039091169063ddfdfbb0906103f49085908590600401610753565b600060405180830381600087803b15801561040e57600080fd5b505af1158015610422573d6000803e3d6000fd5b505050505050565b6104326104a8565b6001600160a01b03811661049c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6104a581610502565b50565b6000546001600160a01b031633146101eb5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610493565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146104a557600080fd5b60006020828403121561057957600080fd5b813561058481610552565b9392505050565b6000806000606084860312156105a057600080fd5b83356105ab81610552565b925060208401356105bb81610552565b929592945050506040919091013590565b60008083601f8401126105de57600080fd5b50813567ffffffffffffffff8111156105f657600080fd5b60208301915083602082850101111561060e57600080fd5b9250929050565b60008060006040848603121561062a57600080fd5b833561063581610552565b9250602084013567ffffffffffffffff81111561065157600080fd5b61065d868287016105cc565b9497909650939450505050565b6000806020838503121561067d57600080fd5b823567ffffffffffffffff81111561069457600080fd5b6106a0858286016105cc565b90969095509350505050565b6000602082840312156106be57600080fd5b8151801515811461058457600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038416815260406020820181905260009061071c90830184866106ce565b95945050505050565b60008060006060848603121561073a57600080fd5b8351925060208401519150604084015190509250925092565b6020815260006107676020830184866106ce565b94935050505056fea2646970667358221220c0785a1cc37ffa8f096145bce62f62d9cae719c200dba5e33a279c7f0894965164736f6c63430008130033a26469706673582212202de7e9a1b007ca2f3a7a6c53b2972dc3f889e83efde5ce289389b45306e1fe7864736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100405760003560e01c80629c5784146100455780635a3f27d314610074578063b3a51b8414610087575b600080fd5b610058610053366004610288565b61009a565b6040516001600160a01b03909116815260200160405180910390f35b610058610082366004610288565b610115565b6100586100953660046102b2565b6101a4565b600061010e82604051806020016100b09061025f565b601f1982820381018352601f9091011660408181526001600160a01b03881660208301520160408051601f19818403018152908290526100f392916020016102fd565b6040516020818303038152906040528051906020012061022d565b9392505050565b60008082846040516101269061025f565b6001600160a01b0390911681526020018190604051809103906000f5905080158015610156573d6000803e3d6000fd5b50604080516001600160a01b038088168252831660208201529192507f0fb2d916aa6a78060ff9e89d89d62797c6668818dec04969013c5098754380ec910160405180910390a19392505050565b600080826040516101b49061025f565b6001600160a01b039091168152602001604051809103906000f0801580156101e0573d6000803e3d6000fd5b50604080516001600160a01b038087168252831660208201529192507f0fb2d916aa6a78060ff9e89d89d62797c6668818dec04969013c5098754380ec910160405180910390a192915050565b600061010e8383306000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b6109658061031b83390190565b80356001600160a01b038116811461028357600080fd5b919050565b6000806040838503121561029b57600080fd5b6102a48361026c565b946020939093013593505050565b6000602082840312156102c457600080fd5b61010e8261026c565b6000815160005b818110156102ee57602081850181015186830152016102d4565b50600093019283525090919050565b600061031261030c83866102cd565b846102cd565b94935050505056fe608060405234801561001057600080fd5b5060405161096538038061096583398101604081905261002f91610181565b61003833610057565b336001600160a01b0382161461005157610051816100a7565b506101b1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6100af610125565b6001600160a01b0381166101195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61012281610057565b50565b6000546001600160a01b0316331461017f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610110565b565b60006020828403121561019357600080fd5b81516001600160a01b03811681146101aa57600080fd5b9392505050565b6107a5806101c06000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063b688a36311610066578063b688a3631461010e578063bcdd1e1314610116578063d79a824014610129578063ddfdfbb014610157578063f2fde38b1461016a57600080fd5b8063159c5ea1146100a3578063715018a6146100b85780638da5cb5b146100c05780639368a3d3146100ea578063aa15efc8146100fd575b600080fd5b6100b66100b1366004610567565b61017d565b005b6100b66101d9565b6000546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b6100b66100f8366004610567565b6101ed565b6001546001600160a01b03166100cd565b6100b6610257565b6100b661012436600461058b565b61028c565b61013c610137366004610615565b610331565b604080519384526020840192909252908201526060016100e1565b6100b661016536600461066a565b6103ba565b6100b6610178366004610567565b61042a565b6101856104a8565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f2bcd43869347a1d42f97ac6042f3d129817abd05a6125f9750fe3724e321d23e9060200160405180910390a150565b6101e16104a8565b6101eb6000610502565b565b6101f56104a8565b60015460405163fc41168360e01b81526001600160a01b0383811660048301529091169063fc41168390602401600060405180830381600087803b15801561023c57600080fd5b505af1158015610250573d6000803e3d6000fd5b5050505050565b6040513381527f27c2b702d3bff195a18baca2daf00b20a986177c5f1449af4e2d46a3c3e02ce59060200160405180910390a1565b6102946104a8565b60405163a9059cbb60e01b81526001600160a01b038381166004830152602482018390526000919085169063a9059cbb906044016020604051808303816000875af11580156102e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030b91906106ac565b90508061032b5760405163099e1ca760e11b815260040160405180910390fd5b50505050565b60015460405163035e6a0960e61b8152600091829182916001600160a01b03169063d79a82409061036a908990899089906004016106f7565b606060405180830381865afa158015610387573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ab9190610725565b92509250925093509350939050565b6103c26104a8565b600154604051630ddfdfbb60e41b81526001600160a01b039091169063ddfdfbb0906103f49085908590600401610753565b600060405180830381600087803b15801561040e57600080fd5b505af1158015610422573d6000803e3d6000fd5b505050505050565b6104326104a8565b6001600160a01b03811661049c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6104a581610502565b50565b6000546001600160a01b031633146101eb5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610493565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146104a557600080fd5b60006020828403121561057957600080fd5b813561058481610552565b9392505050565b6000806000606084860312156105a057600080fd5b83356105ab81610552565b925060208401356105bb81610552565b929592945050506040919091013590565b60008083601f8401126105de57600080fd5b50813567ffffffffffffffff8111156105f657600080fd5b60208301915083602082850101111561060e57600080fd5b9250929050565b60008060006040848603121561062a57600080fd5b833561063581610552565b9250602084013567ffffffffffffffff81111561065157600080fd5b61065d868287016105cc565b9497909650939450505050565b6000806020838503121561067d57600080fd5b823567ffffffffffffffff81111561069457600080fd5b6106a0858286016105cc565b90969095509350505050565b6000602082840312156106be57600080fd5b8151801515811461058457600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038416815260406020820181905260009061071c90830184866106ce565b95945050505050565b60008060006060848603121561073a57600080fd5b8351925060208401519150604084015190509250925092565b6020815260006107676020830184866106ce565b94935050505056fea2646970667358221220c0785a1cc37ffa8f096145bce62f62d9cae719c200dba5e33a279c7f0894965164736f6c63430008130033a26469706673582212202de7e9a1b007ca2f3a7a6c53b2972dc3f889e83efde5ce289389b45306e1fe7864736f6c63430008130033", - "devdoc": { - "events": { - "AuthorityCreated(address,address)": { - "details": "MUST be triggered on a successful call to `newAuthority`.", - "params": { - "authority": "The authority", - "authorityOwner": "The initial authority owner" - } - } - }, - "kind": "dev", - "methods": { - "calculateAuthorityAddress(address,bytes32)": { - "details": "Beware that only the `newAuthority` function with the `_salt` parameter is able to deterministically deploy an authority.", - "params": { - "_authorityOwner": "The initial authority owner", - "_salt": "The salt used to deterministically generate the authority address" - }, - "returns": { - "_0": "The deterministic authority address" - } - }, - "newAuthority(address)": { - "details": "On success, MUST emit an `AuthorityCreated` event.", - "params": { - "_authorityOwner": "The initial authority owner" - }, - "returns": { - "_0": "The authority" - } - }, - "newAuthority(address,bytes32)": { - "details": "On success, MUST emit an `AuthorityCreated` event.", - "params": { - "_authorityOwner": "The initial authority owner", - "_salt": "The salt used to deterministically generate the authority address" - }, - "returns": { - "_0": "The authority" - } - } - }, - "title": "Authority Factory", - "version": 1 - }, - "userdoc": { - "events": { - "AuthorityCreated(address,address)": { - "notice": "A new authority was deployed." - } - }, - "kind": "user", - "methods": { - "calculateAuthorityAddress(address,bytes32)": { - "notice": "Calculate the address of an authority to be deployed deterministically." - }, - "newAuthority(address)": { - "notice": "Deploy a new authority." - }, - "newAuthority(address,bytes32)": { - "notice": "Deploy a new authority deterministically." - } - }, - "notice": "Allows anyone to reliably deploy a new `Authority` contract.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/deployments/arbitrum/CartesiDAppFactory.json b/deployments/arbitrum/CartesiDAppFactory.json deleted file mode 100644 index bebc36512..000000000 --- a/deployments/arbitrum/CartesiDAppFactory.json +++ /dev/null @@ -1,237 +0,0 @@ -{ - "address": "0x7122cd1221C20892234186facfE8615e6743Ab02", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "contract IConsensus", - "name": "consensus", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "dappOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "templateHash", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "contract CartesiDApp", - "name": "application", - "type": "address" - } - ], - "name": "ApplicationCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "contract IConsensus", - "name": "_consensus", - "type": "address" - }, - { - "internalType": "address", - "name": "_dappOwner", - "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": "_dappOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_templateHash", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newApplication", - "outputs": [ - { - "internalType": "contract CartesiDApp", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IConsensus", - "name": "_consensus", - "type": "address" - }, - { - "internalType": "address", - "name": "_dappOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_templateHash", - "type": "bytes32" - } - ], - "name": "newApplication", - "outputs": [ - { - "internalType": "contract CartesiDApp", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0x9b1d61f802ac1c8aa4a5bcb0a5008adc8077653c011d2344a86d734264f42e10", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 3, - "gasUsed": "12118604", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x0f45cd8c240910cf26ef1dda1a434dd4770dc4e516c6a40b6852cc325e69a926", - "transactionHash": "0x9b1d61f802ac1c8aa4a5bcb0a5008adc8077653c011d2344a86d734264f42e10", - "logs": [], - "blockNumber": 115470695, - "cumulativeGasUsed": "14141900", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 1, - "solcInputHash": "d2696284402b6703b2d41170c93ef3b7", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IConsensus\",\"name\":\"consensus\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"dappOwner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"templateHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"contract CartesiDApp\",\"name\":\"application\",\"type\":\"address\"}],\"name\":\"ApplicationCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"contract IConsensus\",\"name\":\"_consensus\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_dappOwner\",\"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\":\"_dappOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_templateHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"newApplication\",\"outputs\":[{\"internalType\":\"contract CartesiDApp\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IConsensus\",\"name\":\"_consensus\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_dappOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_templateHash\",\"type\":\"bytes32\"}],\"name\":\"newApplication\",\"outputs\":[{\"internalType\":\"contract CartesiDApp\",\"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\":{\"application\":\"The application\",\"consensus\":\"The initial consensus contract\",\"dappOwner\":\"The initial DApp owner\",\"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\":{\"_consensus\":\"The initial consensus contract\",\"_dappOwner\":\"The initial DApp owner\",\"_salt\":\"The salt used to deterministically generate the DApp address\",\"_templateHash\":\"The initial machine state hash\"},\"returns\":{\"_0\":\"The deterministic application address\"}},\"newApplication(address,address,bytes32)\":{\"details\":\"On success, MUST emit an `ApplicationCreated` event.\",\"params\":{\"_consensus\":\"The initial consensus contract\",\"_dappOwner\":\"The initial DApp owner\",\"_templateHash\":\"The initial machine state hash\"},\"returns\":{\"_0\":\"The application\"}},\"newApplication(address,address,bytes32,bytes32)\":{\"details\":\"On success, MUST emit an `ApplicationCreated` event.\",\"params\":{\"_consensus\":\"The initial consensus contract\",\"_dappOwner\":\"The initial DApp owner\",\"_salt\":\"The salt used to deterministically generate the DApp address\",\"_templateHash\":\"The initial machine state hash\"},\"returns\":{\"_0\":\"The application\"}}},\"title\":\"Cartesi DApp 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 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 `CartesiDApp` contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dapp/CartesiDAppFactory.sol\":\"CartesiDAppFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@cartesi/util/contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"},\"@cartesi/util/contracts/CartesiMathV2.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\n/// @title CartesiMath\\n/// @author Felipe Argento\\npragma solidity ^0.8.0;\\n\\nlibrary CartesiMathV2 {\\n // mapping values are packed as bytes3 each\\n // see test/TestCartesiMath.ts for decimal values\\n bytes constant log2tableTimes1M =\\n hex\\\"0000000F4240182F421E8480236E082771822AD63A2DC6C0305E8532B04834C96736B3C23876D73A187A3B9D4A3D09003E5EA63FA0C540D17741F28843057D440BA745062945F60246DC1047B917488DC7495ABA4A207C4ADF8A4B98544C4B404CF8AA4DA0E64E44434EE3054F7D6D5013B750A61A5134C851BFF05247BD52CC58534DE753CC8D54486954C19C55384255AC75561E50568DE956FB575766B057D00758376F589CFA5900BA5962BC59C3135A21CA5A7EF15ADA945B34BF5B8D805BE4DF5C3AEA5C8FA95CE3265D356C5D86835DD6735E25455E73005EBFAD5F0B525F55F75F9FA25FE85A60302460770860BD0A61023061467F6189FD61CCAE620E98624FBF62902762CFD5630ECD634D12638AA963C7966403DC643F7F647A8264B4E864EEB56527EC6560906598A365D029660724663D9766738566A8F066DDDA6712476746386779AF67ACAF67DF3A6811526842FA68743268A4FC68D55C6905536934E169640A6992CF69C13169EF326A1CD46A4A186A76FF6AA38C6ACFC0\\\";\\n\\n /// @notice Approximates log2 * 1M\\n /// @param _num number to take log2 * 1M of\\n /// @return approximate log2 times 1M\\n function log2ApproxTimes1M(uint256 _num) public pure returns (uint256) {\\n require(_num > 0, \\\"Number cannot be zero\\\");\\n uint256 leading = 0;\\n\\n if (_num == 1) return 0;\\n\\n while (_num > 128) {\\n _num = _num >> 1;\\n leading += 1;\\n }\\n return (leading * uint256(1000000)) + (getLog2TableTimes1M(_num));\\n }\\n\\n /// @notice navigates log2tableTimes1M\\n /// @param _num number to take log2 of\\n /// @return result after table look-up\\n function getLog2TableTimes1M(uint256 _num) public pure returns (uint256) {\\n bytes3 result = 0;\\n for (uint8 i = 0; i < 3; i++) {\\n bytes3 tempResult = log2tableTimes1M[(_num - 1) * 3 + i];\\n result = result | (tempResult >> (i * 8));\\n }\\n\\n return uint256(uint24(result));\\n }\\n\\n /// @notice get floor of log2 of number\\n /// @param _num number to take floor(log2) of\\n /// @return floor(log2) of _num\\n function getLog2Floor(uint256 _num) public pure returns (uint8) {\\n require(_num != 0, \\\"log of zero is undefined\\\");\\n\\n return uint8(255 - clz(_num));\\n }\\n\\n /// @notice checks if a number is Power of 2\\n /// @param _num number to check\\n /// @return true if number is power of 2, false if not\\n function isPowerOf2(uint256 _num) public pure returns (bool) {\\n if (_num == 0) return false;\\n\\n return _num & (_num - 1) == 0;\\n }\\n\\n /// @notice count trailing zeros\\n /// @param _num number you want the ctz of\\n /// @dev this a binary search implementation\\n function ctz(uint256 _num) public pure returns (uint256) {\\n if (_num == 0) return 256;\\n\\n uint256 n = 0;\\n if (_num & 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF == 0) {\\n n = n + 128;\\n _num = _num >> 128;\\n }\\n if (_num & 0x000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFF == 0) {\\n n = n + 64;\\n _num = _num >> 64;\\n }\\n if (_num & 0x00000000000000000000000000000000000000000000000000000000FFFFFFFF == 0) {\\n n = n + 32;\\n _num = _num >> 32;\\n }\\n if (_num & 0x000000000000000000000000000000000000000000000000000000000000FFFF == 0) {\\n n = n + 16;\\n _num = _num >> 16;\\n }\\n if (_num & 0x00000000000000000000000000000000000000000000000000000000000000FF == 0) {\\n n = n + 8;\\n _num = _num >> 8;\\n }\\n if (_num & 0x000000000000000000000000000000000000000000000000000000000000000F == 0) {\\n n = n + 4;\\n _num = _num >> 4;\\n }\\n if (_num & 0x0000000000000000000000000000000000000000000000000000000000000003 == 0) {\\n n = n + 2;\\n _num = _num >> 2;\\n }\\n if (_num & 0x0000000000000000000000000000000000000000000000000000000000000001 == 0) {\\n n = n + 1;\\n }\\n\\n return n;\\n }\\n\\n /// @notice count leading zeros\\n /// @param _num number you want the clz of\\n /// @dev this a binary search implementation\\n function clz(uint256 _num) public pure returns (uint256) {\\n if (_num == 0) return 256;\\n\\n uint256 n = 0;\\n if (_num & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000 == 0) {\\n n = n + 128;\\n _num = _num << 128;\\n }\\n if (_num & 0xFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 64;\\n _num = _num << 64;\\n }\\n if (_num & 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 32;\\n _num = _num << 32;\\n }\\n if (_num & 0xFFFF000000000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 16;\\n _num = _num << 16;\\n }\\n if (_num & 0xFF00000000000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 8;\\n _num = _num << 8;\\n }\\n if (_num & 0xF000000000000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 4;\\n _num = _num << 4;\\n }\\n if (_num & 0xC000000000000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 2;\\n _num = _num << 2;\\n }\\n if (_num & 0x8000000000000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 1;\\n }\\n\\n return n;\\n }\\n}\\n\",\"keccak256\":\"0x98fb8d20c05b7c39c44171b6c524cf023da646749eb90157463538da8b2e13d3\",\"license\":\"Apache-2.0\"},\"@cartesi/util/contracts/MerkleV2.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\n/// @title Library for Merkle proofs\\npragma solidity ^0.8.0;\\n\\nimport \\\"./CartesiMathV2.sol\\\";\\n\\nlibrary MerkleV2 {\\n using CartesiMathV2 for uint256;\\n\\n uint128 constant L_WORD_SIZE = 3; // word = 8 bytes, log = 3\\n // number of hashes in EMPTY_TREE_HASHES\\n uint128 constant EMPTY_TREE_SIZE = 1952; // 61*32=1952. 32 bytes per 61 indexes (64 words)\\n\\n // merkle root hashes of trees of zero concatenated\\n // 32 bytes for each root, first one is keccak(0), second one is\\n // keccak(keccack(0), keccak(0)) and so on\\n\\n bytes constant EMPTY_TREE_HASHES =\\n hex\\\"011b4d03dd8c01f1049143cf9c4c817e4b167f1d1b83e5c6f0f10d89ba1e7bce4d9470a821fbe90117ec357e30bad9305732fb19ddf54a07dd3e29f440619254ae39ce8537aca75e2eff3e38c98011dfe934e700a0967732fc07b430dd656a233fc9a15f5b4869c872f81087bb6104b7d63e6f9ab47f2c43f3535eae7172aa7f17d2dd614cddaa4d879276b11e0672c9560033d3e8453a1d045339d34ba601b9c37b8b13ca95166fb7af16988a70fcc90f38bf9126fd833da710a47fb37a55e68e7a427fa943d9966b389f4f257173676090c6e95f43e2cb6d65f8758111e30930b0b9deb73e155c59740bacf14a6ff04b64bb8e201a506409c3fe381ca4ea90cd5deac729d0fdaccc441d09d7325f41586ba13c801b7eccae0f95d8f3933efed8b96e5b7f6f459e9cb6a2f41bf276c7b85c10cd4662c04cbbb365434726c0a0c9695393027fb106a8153109ac516288a88b28a93817899460d6310b71cf1e6163e8806fa0d4b197a259e8c3ac28864268159d0ac85f8581ca28fa7d2c0c03eb91e3eee5ca7a3da2b3053c9770db73599fb149f620e3facef95e947c0ee860b72122e31e4bbd2b7c783d79cc30f60c6238651da7f0726f767d22747264fdb046f7549f26cc70ed5e18baeb6c81bb0625cb95bb4019aeecd40774ee87ae29ec517a71f6ee264c5d761379b3d7d617ca83677374b49d10aec50505ac087408ca892b573c267a712a52e1d06421fe276a03efb1889f337201110fdc32a81f8e152499af665835aabfdc6740c7e2c3791a31c3cdc9f5ab962f681b12fc092816a62f27d86025599a41233848702f0cfc0437b445682df51147a632a0a083d2d38b5e13e466a8935afff58bb533b3ef5d27fba63ee6b0fd9e67ff20af9d50deee3f8bf065ec220c1fd4ba57e341261d55997f85d66d32152526736872693d2b437a233e2337b715f6ac9a6a272622fdc2d67fcfe1da3459f8dab4ed7e40a657a54c36766c5e8ac9a88b35b05c34747e6507f6b044ab66180dc76ac1a696de03189593fedc0d0dbbd855c8ead673544899b0960e4a5a7ca43b4ef90afe607de7698caefdc242788f654b57a4fb32a71b335ef6ff9a4cc118b282b53bdd6d6192b7a82c3c5126b9c7e33c8e5a5ac9738b8bd31247fb7402054f97b573e8abb9faad219f4fd085aceaa7f542d787ee4196d365f3cc566e7bbcfbfd451230c48d804c017d21e2d8fa914e2559bb72bf0ab78c8ab92f00ef0d0d576eccdd486b64138a4172674857e543d1d5b639058dd908186597e366ad5f3d9c7ceaff44d04d1550b8d33abc751df07437834ba5acb32328a396994aebb3c40f759c2d6d7a3cb5377e55d5d218ef5a296dda8ddc355f3f50c3d0b660a51dfa4d98a6a5a33564556cf83c1373a814641d6a1dcef97b883fee61bb84fe60a3409340217e629cc7e4dcc93b85d8820921ff5826148b60e6939acd7838e1d7f20562bff8ee4b5ec4a05ad997a57b9796fdcb2eda87883c2640b072b140b946bfdf6575cacc066fdae04f6951e63624cbd316a677cad529bbe4e97b9144e4bc06c4afd1de55dd3e1175f90423847a230d34dfb71ed56f2965a7f6c72e6aa33c24c303fd67745d632656c5ef90bec80f4f5d1daa251988826cef375c81c36bf457e09687056f924677cb0bccf98dff81e014ce25f2d132497923e267363963cdf4302c5049d63131dc03fd95f65d8b6aa5934f817252c028c90f56d413b9d5d10d89790707dae2fabb249f649929927c21dd71e3f656826de5451c5da375aadecbd59d5ebf3a31fae65ac1b316a1611f1b276b26530f58d7247df459ce1f86db1d734f6f811932f042cee45d0e455306d01081bc3384f82c5fb2aacaa19d89cdfa46cc916eac61121475ba2e6191b4feecbe1789717021a158ace5d06744b40f551076b67cd63af60007f8c99876e1424883a45ec49d497ddaf808a5521ca74a999ab0b3c7aa9c80f85e93977ec61ce68b20307a1a81f71ca645b568fcd319ccbb5f651e87b707d37c39e15f945ea69e2f7c7d2ccc85b7e654c07e96f0636ae4044fe0e38590b431795ad0f8647bdd613713ada493cc17efd313206380e6a685b8198475bbd021c6e9d94daab2214947127506073e44d5408ba166c512a0b86805d07f5a44d3c41706be2bc15e712e55805248b92e8677d90f6d284d1d6ffaff2c430657042a0e82624fa3717b06cc0a6fd12230ea586dae83019fb9e06034ed2803c98d554b93c9a52348cafff75c40174a91f9ae6b8647854a156029f0b88b83316663ce574a4978277bb6bb27a31085634b6ec78864b6d8201c7e93903d75815067e378289a3d072ae172dafa6a452470f8d645bebfad9779594fc0784bb764a22e3a8181d93db7bf97893c414217a618ccb14caa9e92e8c61673afc9583662e812adba1f87a9c68202d60e909efab43c42c0cb00695fc7f1ffe67c75ca894c3c51e1e5e731360199e600f6ced9a87b2a6a87e70bf251bb5075ab222138288164b2eda727515ea7de12e2496d4fe42ea8d1a120c03cf9c50622c2afe4acb0dad98fd62d07ab4e828a94495f6d1ab973982c7ccbe6c1fae02788e4422ae22282fa49cbdb04ba54a7a238c6fc41187451383460762c06d1c8a72b9cd718866ad4b689e10c9a8c38fe5ef045bd785b01e980fc82c7e3532ce81876b778dd9f1ceeba4478e86411fb6fdd790683916ca832592485093644e8760cd7b4c01dba1ccc82b661bf13f0e3f34acd6b88\\\";\\n\\n /// @notice Gets merkle root hash of drive with a replacement\\n /// @param _position position of _drive\\n /// @param _logSizeOfReplacement log2 of size the replacement\\n /// @param _logSizeOfFullDrive log2 of size the full drive, which can be the entire machine\\n /// @param _replacement hash of the replacement\\n /// @param siblings of replacement that merkle root can be calculated\\n function getRootAfterReplacementInDrive(\\n uint256 _position,\\n uint256 _logSizeOfReplacement,\\n uint256 _logSizeOfFullDrive,\\n bytes32 _replacement,\\n bytes32[] calldata siblings\\n ) public pure returns (bytes32) {\\n require(\\n _logSizeOfFullDrive >= _logSizeOfReplacement && _logSizeOfReplacement >= 3 && _logSizeOfFullDrive <= 64,\\n \\\"3 <= logSizeOfReplacement <= logSizeOfFullDrive <= 64\\\"\\n );\\n\\n uint256 size = 1 << _logSizeOfReplacement;\\n\\n require(((size - 1) & _position) == 0, \\\"Position is not aligned\\\");\\n require(siblings.length == _logSizeOfFullDrive - _logSizeOfReplacement, \\\"Proof length does not match\\\");\\n\\n for (uint256 i; i < siblings.length; i++) {\\n if ((_position & (size << i)) == 0) {\\n _replacement = keccak256(abi.encodePacked(_replacement, siblings[i]));\\n } else {\\n _replacement = keccak256(abi.encodePacked(siblings[i], _replacement));\\n }\\n }\\n\\n return _replacement;\\n }\\n\\n /// @notice Gets precomputed hash of zero in empty tree hashes\\n /// @param _index of hash wanted\\n /// @dev first index is keccak(0), second index is keccak(keccak(0), keccak(0))\\n function getEmptyTreeHashAtIndex(uint256 _index) public pure returns (bytes32) {\\n uint256 start = _index * 32;\\n require(EMPTY_TREE_SIZE >= start + 32, \\\"index out of bounds\\\");\\n bytes32 hashedZeros;\\n bytes memory zeroTree = EMPTY_TREE_HASHES;\\n\\n // first word is length, then skip index words\\n assembly {\\n hashedZeros := mload(add(add(zeroTree, 0x20), start))\\n }\\n return hashedZeros;\\n }\\n\\n /// @notice get merkle root of generic array of bytes\\n /// @param _data array of bytes to be merklelized\\n /// @param _log2Size log2 of total size of the drive\\n /// @dev _data is padded with zeroes until is multiple of 8\\n /// @dev root is completed with zero tree until log2size is complete\\n /// @dev hashes are taken word by word (8 bytes by 8 bytes)\\n function getMerkleRootFromBytes(bytes calldata _data, uint256 _log2Size) public pure returns (bytes32) {\\n require(_log2Size >= 3 && _log2Size <= 64, \\\"range of log2Size: [3,64]\\\");\\n\\n // if _data is empty return pristine drive of size log2size\\n if (_data.length == 0) return getEmptyTreeHashAtIndex(_log2Size - 3);\\n\\n // total size of the drive in words\\n uint256 size = 1 << (_log2Size - 3);\\n require(size << L_WORD_SIZE >= _data.length, \\\"data is bigger than drive\\\");\\n // the stack depth is log2(_data.length / 8) + 2\\n uint256 stack_depth = 2 + ((_data.length) >> L_WORD_SIZE).getLog2Floor();\\n bytes32[] memory stack = new bytes32[](stack_depth);\\n\\n uint256 numOfHashes; // total number of hashes on stack (counting levels)\\n uint256 stackLength; // total length of stack\\n uint256 numOfJoins; // number of hashes of the same level on stack\\n uint256 topStackLevel; // hash level of the top of the stack\\n\\n while (numOfHashes < size) {\\n if ((numOfHashes << L_WORD_SIZE) < _data.length) {\\n // we still have words to hash\\n stack[stackLength] = getHashOfWordAtIndex(_data, numOfHashes);\\n numOfHashes++;\\n\\n numOfJoins = numOfHashes;\\n } else {\\n // since padding happens in hashOfWordAtIndex function\\n // we only need to complete the stack with pre-computed\\n // hash(0), hash(hash(0),hash(0)) and so on\\n topStackLevel = numOfHashes.ctz();\\n\\n stack[stackLength] = getEmptyTreeHashAtIndex(topStackLevel);\\n\\n //Empty Tree Hash summarizes many hashes\\n numOfHashes = numOfHashes + (1 << topStackLevel);\\n numOfJoins = numOfHashes >> topStackLevel;\\n }\\n\\n stackLength++;\\n\\n // while there are joins, hash top of stack together\\n while (numOfJoins & 1 == 0) {\\n bytes32 h2 = stack[stackLength - 1];\\n bytes32 h1 = stack[stackLength - 2];\\n\\n stack[stackLength - 2] = keccak256(abi.encodePacked(h1, h2));\\n stackLength = stackLength - 1; // remove hashes from stack\\n\\n numOfJoins = numOfJoins >> 1;\\n }\\n }\\n require(stackLength == 1, \\\"stack error\\\");\\n\\n return stack[0];\\n }\\n\\n /// @notice Get the hash of a word in an array of bytes\\n /// @param _data array of bytes\\n /// @param _wordIndex index of word inside the bytes to get the hash of\\n /// @dev if word is incomplete (< 8 bytes) it gets padded with zeroes\\n function getHashOfWordAtIndex(bytes calldata _data, uint256 _wordIndex) public pure returns (bytes32) {\\n uint256 start = _wordIndex << L_WORD_SIZE;\\n uint256 end = start + (1 << L_WORD_SIZE);\\n\\n // TODO: in .lua this just returns zero, but this might be more consistent\\n require(start <= _data.length, \\\"word out of bounds\\\");\\n\\n if (end <= _data.length) {\\n return keccak256(abi.encodePacked(_data[start:end]));\\n }\\n\\n // word is incomplete\\n // fill paddedSlice with incomplete words - the rest is going to be bytes(0)\\n bytes memory paddedSlice = new bytes(8);\\n uint256 remaining = _data.length - start;\\n\\n for (uint256 i; i < remaining; i++) {\\n paddedSlice[i] = _data[start + i];\\n }\\n\\n return keccak256(paddedSlice);\\n }\\n\\n /// @notice Calculate the root of Merkle tree from an array of power of 2 elements\\n /// @param hashes The array containing power of 2 elements\\n /// @return byte32 the root hash being calculated\\n function calculateRootFromPowerOfTwo(bytes32[] memory hashes) public pure returns (bytes32) {\\n // revert when the input is not of power of 2\\n require((hashes.length).isPowerOf2(), \\\"array len not power of 2\\\");\\n\\n if (hashes.length == 1) {\\n return hashes[0];\\n } else {\\n bytes32[] memory newHashes = new bytes32[](hashes.length >> 1);\\n\\n for (uint256 i; i < hashes.length; i += 2) {\\n newHashes[i >> 1] = keccak256(abi.encodePacked(hashes[i], hashes[i + 1]));\\n }\\n\\n return calculateRootFromPowerOfTwo(newHashes);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x73d86cb2dfa2ca887987c6da8d193d523c6a65ea89e296d1f47f190ebda7fa9b\",\"license\":\"Apache-2.0\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\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 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 require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\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\":\"0xa535a5df777d44e945dd24aa43a11e44b024140fc340ad0dfe42acf4002aade1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev _Available since v3.1._\\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\":\"0xeb373f1fdc7b755c6a750123a9b9e3a8a02c1470042fd6505d875000a80bde0b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/utils/ERC1155Holder.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./ERC1155Receiver.sol\\\";\\n\\n/**\\n * Simple implementation of `ERC1155Receiver` 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 *\\n * @dev _Available since v3.1._\\n */\\ncontract ERC1155Holder is ERC1155Receiver {\\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\":\"0x2e024ca51ce5abe16c0d34e6992a1104f356e2244eb4ccbec970435e8b3405e3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC1155Receiver.sol\\\";\\nimport \\\"../../../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev _Available since v3.1._\\n */\\nabstract contract ERC1155Receiver 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\",\"keccak256\":\"0x3dd5e1a66a56f30302108a1da97d677a42b1daa60e503696b2bcbbf3e4c95bcb\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\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 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\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/utils/ERC721Holder.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../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 {IERC721-setApprovalForAll}.\\n */\\ncontract 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 override returns (bytes4) {\\n return this.onERC721Received.selector;\\n }\\n}\\n\",\"keccak256\":\"0x67ef46fef257faae47adb630aad49694dda0334e5f7a7c5fb386243b974886b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\\n require(address(this).balance >= amount, \\\"Create2: insufficient balance\\\");\\n require(bytecode.length != 0, \\\"Create2: bytecode length is zero\\\");\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n require(addr != address(0), \\\"Create2: Failed on deploy\\\");\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6e00f269073ffc4350e56b7e8153c9092d5f70bfba423299990514183101ef89\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./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 *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/common/CanonicalMachine.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @title Canonical Machine Constants Library\\n///\\n/// @notice Defines several constants related to the reference implementation\\n/// of the RISC-V machine that runs Linux, also known as the \\\"Cartesi Machine\\\".\\nlibrary CanonicalMachine {\\n /// @notice Base-2 logarithm of number of bytes.\\n type Log2Size is uint64;\\n\\n /// @notice Machine word size (8 bytes).\\n Log2Size constant WORD_LOG2_SIZE = Log2Size.wrap(3);\\n\\n /// @notice Machine address space size (2^64 bytes).\\n Log2Size constant MACHINE_LOG2_SIZE = Log2Size.wrap(64);\\n\\n /// @notice Keccak-256 output size (32 bytes).\\n Log2Size constant KECCAK_LOG2_SIZE = Log2Size.wrap(5);\\n\\n /// @notice Maximum input size (~2 megabytes).\\n /// @dev The offset and size fields use up the extra 64 bytes.\\n uint256 constant INPUT_MAX_SIZE = (1 << 21) - 64;\\n\\n /// @notice Maximum voucher metadata memory range (2 megabytes).\\n Log2Size constant VOUCHER_METADATA_LOG2_SIZE = Log2Size.wrap(21);\\n\\n /// @notice Maximum notice metadata memory range (2 megabytes).\\n Log2Size constant NOTICE_METADATA_LOG2_SIZE = Log2Size.wrap(21);\\n\\n /// @notice Maximum epoch voucher memory range (128 megabytes).\\n Log2Size constant EPOCH_VOUCHER_LOG2_SIZE = Log2Size.wrap(37);\\n\\n /// @notice Maximum epoch notice memory range (128 megabytes).\\n Log2Size constant EPOCH_NOTICE_LOG2_SIZE = Log2Size.wrap(37);\\n\\n /// @notice Unwrap `s` into its underlying uint64 value.\\n /// @param s Base-2 logarithm of some number of bytes\\n function uint64OfSize(Log2Size s) internal pure returns (uint64) {\\n return Log2Size.unwrap(s);\\n }\\n\\n /// @notice Return the position of an intra memory range on a memory range\\n /// with contents with the same size.\\n /// @param index Index of intra memory range\\n /// @param log2Size Base-2 logarithm of intra memory range size\\n function getIntraMemoryRangePosition(\\n uint64 index,\\n Log2Size log2Size\\n ) internal pure returns (uint64) {\\n return index << Log2Size.unwrap(log2Size);\\n }\\n}\\n\",\"keccak256\":\"0x97cdce56cdb4f0b4164e6be3a72e50469a3124e4716e753a1792aa70eac614f5\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/common/OutputEncoding.sol\":{\"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 Output Encoding Library\\n///\\n/// @notice Defines the encoding of outputs generated by the off-chain machine.\\nlibrary OutputEncoding {\\n /// @notice Encode a notice.\\n /// @param notice The notice\\n /// @return The encoded output\\n function encodeNotice(\\n bytes calldata notice\\n ) internal pure returns (bytes memory) {\\n return abi.encode(notice);\\n }\\n\\n /// @notice Encode a voucher.\\n /// @param destination The address that will receive the payload through a message call\\n /// @param payload The payload, which\\u2014in the case of Solidity contracts\\u2014encodes a function call\\n /// @return The encoded output\\n function encodeVoucher(\\n address destination,\\n bytes calldata payload\\n ) internal pure returns (bytes memory) {\\n return abi.encode(destination, payload);\\n }\\n}\\n\",\"keccak256\":\"0xfbf8bd40a11aeb380c77910ef7a8c3a4b358dddbd8bc795529de39c955dd6f60\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/IConsensus.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @title Consensus interface\\n///\\n/// @notice This contract defines a generic interface for consensuses.\\n/// We use the word \\\"consensus\\\" to designate a contract that provides claims\\n/// in the base layer regarding the state of off-chain machines running in\\n/// the execution layer. How this contract is able to reach consensus, who is\\n/// able to submit claims, and how are claims stored in the base layer are\\n/// some of the implementation details left unspecified by this interface.\\n///\\n/// From the point of view of a DApp, these claims are necessary to validate\\n/// on-chain action allowed by the off-chain machine in the form of vouchers\\n/// and notices. Each claim is composed of three parts: an epoch hash, a first\\n/// index, and a last index. We'll explain each of these parts below.\\n///\\n/// First, let us define the word \\\"epoch\\\". For finality reasons, we need to\\n/// divide the stream of inputs being fed into the off-chain machine into\\n/// batches of inputs, which we call \\\"epoches\\\". At the end of every epoch,\\n/// we summarize the state of the off-chain machine in a single hash, called\\n/// \\\"epoch hash\\\". Please note that this interface does not define how this\\n/// stream of inputs is being chopped up into epoches.\\n///\\n/// The other two parts are simply the indices of the first and last inputs\\n/// accepted during the epoch. Logically, the first index MUST BE less than\\n/// or equal to the last index. As a result, every epoch MUST accept at least\\n/// one input. This assumption stems from the fact that the state of a machine\\n/// can only change after an input is fed into it.\\n///\\n/// Examples of possible implementations of this interface include:\\n///\\n/// * An authority consensus, controlled by a single address who has full\\n/// control over epoch boundaries, claim submission, asset management, etc.\\n///\\n/// * A quorum consensus, controlled by a limited set of validators, that\\n/// vote on the state of the machine at the end of every epoch. Also, epoch\\n/// boundaries are determined by the timestamp in the base layer, and assets\\n/// are split equally amongst the validators.\\n///\\n/// * An NxN consensus, which allows anyone to submit and dispute claims\\n/// in the base layer. Epoch boundaries are determined in the same fashion\\n/// as in the quorum example.\\n///\\ninterface IConsensus {\\n /// @notice An application has joined the consensus' validation set.\\n /// @param application The application\\n /// @dev MUST be triggered on a successful call to `join`.\\n event ApplicationJoined(address application);\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// The encoding of `_proofContext` might vary\\n /// depending on the implementation.\\n /// @param _dapp The DApp address\\n /// @param _proofContext Data for retrieving the desired claim\\n /// @return epochHash_ The claimed epoch hash\\n /// @return firstInputIndex_ The index of the first input of the epoch in the input box\\n /// @return lastInputIndex_ The index of the last input of the epoch in the input box\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n )\\n external\\n view\\n returns (\\n bytes32 epochHash_,\\n uint256 firstInputIndex_,\\n uint256 lastInputIndex_\\n );\\n\\n /// @notice Signal the consensus that the message sender wants to join its validation set.\\n /// @dev MUST fire an `ApplicationJoined` event with the message sender as argument.\\n function join() external;\\n}\\n\",\"keccak256\":\"0xc9d295fada66eb0602e0f1e2e236708e52f959927abb4ab6b04173a98b92ac16\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/CartesiDApp.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {ICartesiDApp, Proof} from \\\"./ICartesiDApp.sol\\\";\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\nimport {LibOutputValidation, OutputValidityProof} from \\\"../library/LibOutputValidation.sol\\\";\\nimport {Bitmask} from \\\"@cartesi/util/contracts/Bitmask.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/security/ReentrancyGuard.sol\\\";\\n\\n/// @title Cartesi DApp\\n///\\n/// @notice This contract acts as the base layer incarnation of a DApp running on the execution layer.\\n/// The DApp is hereby able to interact with other smart contracts through the execution of vouchers\\n/// and the validation of notices. These outputs are generated by the DApp backend on the execution\\n/// layer and can be proven in the base layer thanks to claims submitted by a consensus contract.\\n///\\n/// A voucher is a one-time message call to another contract. It can encode asset transfers, approvals,\\n/// or any other message call that doesn't require Ether to be sent along. A voucher will only be consumed\\n/// if the underlying message call succeeds (that is, it doesn't revert). Furthermore, the return data of\\n/// the message call is discarded entirely. As a protective measure against reentrancy attacks, nested\\n/// voucher executions are prohibited.\\n///\\n/// A notice, on the other hand, constitutes an arbitrary piece of data that can be proven any number of times.\\n/// On their own, they do not trigger any type of contract-to-contract interaction.\\n/// Rather, they merely serve to attest off-chain results, e.g. which player won a particular chess match.\\n///\\n/// Every DApp is subscribed to a consensus contract, and governed by a single address, the owner.\\n/// The consensus has the power of submitting claims, which, in turn, are used to validate vouchers and notices.\\n/// Meanwhile, the owner has complete power over the DApp, as it can replace the consensus at any time.\\n/// Therefore, the users of a DApp must trust both the consensus and the DApp owner.\\n///\\n/// The DApp developer can choose whichever ownership and consensus models it wants.\\n///\\n/// Examples of DApp ownership models include:\\n///\\n/// * no owner (address zero)\\n/// * individual signer (externally-owned account)\\n/// * multiple signers (multi-sig)\\n/// * DAO (decentralized autonomous organization)\\n/// * self-owned DApp (off-chain governance logic)\\n///\\n/// See `IConsensus` for examples of consensus models.\\n///\\n/// This contract inherits the following OpenZeppelin contracts.\\n/// For more information, please consult OpenZeppelin's official documentation.\\n///\\n/// * `Ownable`\\n/// * `ERC721Holder`\\n/// * `ERC1155Holder`\\n/// * `ReentrancyGuard`\\n///\\ncontract CartesiDApp is\\n ICartesiDApp,\\n Ownable,\\n ERC721Holder,\\n ERC1155Holder,\\n ReentrancyGuard\\n{\\n using Bitmask for mapping(uint256 => uint256);\\n using LibOutputValidation for OutputValidityProof;\\n\\n /// @notice Raised when executing an already executed voucher.\\n error VoucherReexecutionNotAllowed();\\n\\n /// @notice Raised when the transfer fails.\\n error EtherTransferFailed();\\n\\n /// @notice Raised when a mehtod is not called by DApp itself.\\n error OnlyDApp();\\n\\n /// @notice The initial machine state hash.\\n /// @dev See the `getTemplateHash` function.\\n bytes32 internal immutable templateHash;\\n\\n /// @notice The executed voucher bitmask, which keeps track of which vouchers\\n /// were executed already in order to avoid re-execution.\\n /// @dev See the `wasVoucherExecuted` function.\\n mapping(uint256 => uint256) internal voucherBitmask;\\n\\n /// @notice The current consensus contract.\\n /// @dev See the `getConsensus` and `migrateToConsensus` functions.\\n IConsensus internal consensus;\\n\\n /// @notice Creates a `CartesiDApp` contract.\\n /// @param _consensus The initial consensus contract\\n /// @param _owner The initial DApp owner\\n /// @param _templateHash The initial machine state hash\\n /// @dev Calls the `join` function on `_consensus`.\\n constructor(IConsensus _consensus, address _owner, bytes32 _templateHash) {\\n transferOwnership(_owner);\\n templateHash = _templateHash;\\n consensus = _consensus;\\n\\n _consensus.join();\\n }\\n\\n function executeVoucher(\\n address _destination,\\n bytes calldata _payload,\\n Proof calldata _proof\\n ) external override nonReentrant returns (bool) {\\n bytes32 epochHash;\\n uint256 firstInputIndex;\\n uint256 lastInputIndex;\\n uint256 inputIndex;\\n\\n // query the current consensus for the desired claim\\n (epochHash, firstInputIndex, lastInputIndex) = getClaim(_proof.context);\\n\\n // validate input index range and calculate the input index\\n // based on the input index range provided by the consensus\\n inputIndex = _proof.validity.validateInputIndexRange(\\n firstInputIndex,\\n lastInputIndex\\n );\\n\\n // reverts if proof isn't valid\\n _proof.validity.validateVoucher(_destination, _payload, epochHash);\\n\\n uint256 voucherPosition = LibOutputValidation.getBitMaskPosition(\\n _proof.validity.outputIndexWithinInput,\\n inputIndex\\n );\\n\\n // check if voucher has been executed\\n if (_wasVoucherExecuted(voucherPosition)) {\\n revert VoucherReexecutionNotAllowed();\\n }\\n\\n // execute voucher\\n (bool succ, ) = _destination.call(_payload);\\n\\n // if properly executed, mark it as executed and emit event\\n if (succ) {\\n voucherBitmask.setBit(voucherPosition, true);\\n emit VoucherExecuted(voucherPosition);\\n }\\n\\n return succ;\\n }\\n\\n function wasVoucherExecuted(\\n uint256 _inputIndex,\\n uint256 _outputIndexWithinInput\\n ) external view override returns (bool) {\\n uint256 voucherPosition = LibOutputValidation.getBitMaskPosition(\\n _outputIndexWithinInput,\\n _inputIndex\\n );\\n return _wasVoucherExecuted(voucherPosition);\\n }\\n\\n function _wasVoucherExecuted(\\n uint256 _voucherPosition\\n ) internal view returns (bool) {\\n return voucherBitmask.getBit(_voucherPosition);\\n }\\n\\n function validateNotice(\\n bytes calldata _notice,\\n Proof calldata _proof\\n ) external view override returns (bool) {\\n bytes32 epochHash;\\n uint256 firstInputIndex;\\n uint256 lastInputIndex;\\n\\n // query the current consensus for the desired claim\\n (epochHash, firstInputIndex, lastInputIndex) = getClaim(_proof.context);\\n\\n // validate the epoch input index based on the input index range\\n // provided by the consensus\\n _proof.validity.validateInputIndexRange(\\n firstInputIndex,\\n lastInputIndex\\n );\\n\\n // reverts if proof isn't valid\\n _proof.validity.validateNotice(_notice, epochHash);\\n\\n return true;\\n }\\n\\n /// @notice Retrieve a claim about the DApp from the current consensus.\\n /// The encoding of `_proofContext` might vary depending on the implementation.\\n /// @param _proofContext Data for retrieving the desired claim\\n /// @return The claimed epoch hash\\n /// @return The index of the first input of the epoch in the input box\\n /// @return The index of the last input of the epoch in the input box\\n function getClaim(\\n bytes calldata _proofContext\\n ) internal view returns (bytes32, uint256, uint256) {\\n return consensus.getClaim(address(this), _proofContext);\\n }\\n\\n function migrateToConsensus(\\n IConsensus _newConsensus\\n ) external override onlyOwner {\\n consensus = _newConsensus;\\n\\n _newConsensus.join();\\n\\n emit NewConsensus(_newConsensus);\\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 /// @notice Accept Ether transfers.\\n /// @dev If you wish to transfer Ether to a DApp while informing\\n /// the DApp backend of it, then please do so through the Ether portal contract.\\n receive() external payable {}\\n\\n /// @notice Transfer some amount of Ether to some recipient.\\n /// @param _receiver The address which will receive the amount of Ether\\n /// @param _value The amount of Ether to be transferred in Wei\\n /// @dev This function can only be called by the DApp itself through vouchers.\\n /// If this method is not called by DApp itself, `OnlyDApp` error is raised.\\n /// If the transfer fails, `EtherTransferFailed` error is raised.\\n function withdrawEther(address _receiver, uint256 _value) external {\\n if (msg.sender != address(this)) {\\n revert OnlyDApp();\\n }\\n\\n (bool sent, ) = _receiver.call{value: _value}(\\\"\\\");\\n\\n if (!sent) {\\n revert EtherTransferFailed();\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe54766db1afcbb9578fffc1a87927d95673f1a630d88a7889941878a89761128\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/CartesiDAppFactory.sol\":{\"content\":\"// (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 {ICartesiDAppFactory} from \\\"./ICartesiDAppFactory.sol\\\";\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\nimport {CartesiDApp} from \\\"./CartesiDApp.sol\\\";\\n\\n/// @title Cartesi DApp Factory\\n/// @notice Allows anyone to reliably deploy a new `CartesiDApp` contract.\\ncontract CartesiDAppFactory is ICartesiDAppFactory {\\n function newApplication(\\n IConsensus _consensus,\\n address _dappOwner,\\n bytes32 _templateHash\\n ) external override returns (CartesiDApp) {\\n CartesiDApp application = new CartesiDApp(\\n _consensus,\\n _dappOwner,\\n _templateHash\\n );\\n\\n emit ApplicationCreated(\\n _consensus,\\n _dappOwner,\\n _templateHash,\\n application\\n );\\n\\n return application;\\n }\\n\\n function newApplication(\\n IConsensus _consensus,\\n address _dappOwner,\\n bytes32 _templateHash,\\n bytes32 _salt\\n ) external override returns (CartesiDApp) {\\n CartesiDApp application = new CartesiDApp{salt: _salt}(\\n _consensus,\\n _dappOwner,\\n _templateHash\\n );\\n\\n emit ApplicationCreated(\\n _consensus,\\n _dappOwner,\\n _templateHash,\\n application\\n );\\n\\n return application;\\n }\\n\\n function calculateApplicationAddress(\\n IConsensus _consensus,\\n address _dappOwner,\\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(CartesiDApp).creationCode,\\n abi.encode(_consensus, _dappOwner, _templateHash)\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0xd5f93d28a69df7dc63205026dc5a1865ee989a683f3e648812ded6cefb35f10d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/ICartesiDApp.sol\":{\"content\":\"// (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 \\\"../consensus/IConsensus.sol\\\";\\nimport {OutputValidityProof} from \\\"../library/LibOutputValidation.sol\\\";\\n\\n/// @notice Data for validating outputs.\\n/// @param validity A validity proof for the output\\n/// @param context Data for querying the right claim from the current consensus contract\\n/// @dev The encoding of `context` might vary depending on the implementation of the consensus contract.\\nstruct Proof {\\n OutputValidityProof validity;\\n bytes context;\\n}\\n\\n/// @title Cartesi DApp interface\\ninterface ICartesiDApp {\\n // Events\\n\\n /// @notice The DApp has migrated to another consensus contract.\\n /// @param newConsensus The new consensus contract\\n /// @dev MUST be triggered on a successful call to `migrateToConsensus`.\\n event NewConsensus(IConsensus newConsensus);\\n\\n /// @notice A voucher was executed from the DApp.\\n /// @param voucherId A number that uniquely identifies the voucher\\n /// amongst all vouchers emitted by this DApp\\n event VoucherExecuted(uint256 voucherId);\\n\\n // Permissioned functions\\n\\n /// @notice Migrate the DApp to a new consensus.\\n /// @param _newConsensus The new consensus\\n /// @dev Can only be called by the DApp owner.\\n function migrateToConsensus(IConsensus _newConsensus) external;\\n\\n // Permissionless functions\\n\\n /// @notice Try to execute a voucher.\\n ///\\n /// Reverts if voucher was already successfully executed.\\n ///\\n /// @param _destination The address that will receive the payload through a message call\\n /// @param _payload The payload, which\\u2014in the case of Solidity contracts\\u2014encodes a function call\\n /// @param _proof The proof used to validate the voucher against\\n /// a claim submitted by the current consensus contract\\n /// @return Whether the execution was successful or not\\n /// @dev On a successful execution, emits a `VoucherExecuted` event.\\n /// Execution of already executed voucher will raise a `VoucherReexecutionNotAllowed` error.\\n function executeVoucher(\\n address _destination,\\n bytes calldata _payload,\\n Proof calldata _proof\\n ) external returns (bool);\\n\\n /// @notice Check whether a voucher has been executed.\\n /// @param _inputIndex The index of the input in the input box\\n /// @param _outputIndexWithinInput The index of output emitted by the input\\n /// @return Whether the voucher has been executed before\\n function wasVoucherExecuted(\\n uint256 _inputIndex,\\n uint256 _outputIndexWithinInput\\n ) external view returns (bool);\\n\\n /// @notice Validate a notice.\\n /// @param _notice The notice\\n /// @param _proof Data for validating outputs\\n /// @return Whether the notice is valid or not\\n function validateNotice(\\n bytes calldata _notice,\\n Proof calldata _proof\\n ) external view returns (bool);\\n\\n /// @notice Get the DApp's template hash.\\n /// @return The DApp'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\":\"0x7bb375a4deb593af06955bbf1d88e096f4288f25fa032349796f93705d29386f\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/ICartesiDAppFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {CartesiDApp} from \\\"./CartesiDApp.sol\\\";\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\n\\n/// @title Cartesi DApp Factory interface\\ninterface ICartesiDAppFactory {\\n // Events\\n\\n /// @notice A new application was deployed.\\n /// @param consensus The initial consensus contract\\n /// @param dappOwner The initial DApp owner\\n /// @param templateHash The initial machine state hash\\n /// @param application The application\\n /// @dev MUST be triggered on a successful call to `newApplication`.\\n event ApplicationCreated(\\n IConsensus indexed consensus,\\n address dappOwner,\\n bytes32 templateHash,\\n CartesiDApp application\\n );\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new application.\\n /// @param _consensus The initial consensus contract\\n /// @param _dappOwner The initial DApp owner\\n /// @param _templateHash The initial machine state hash\\n /// @return The application\\n /// @dev On success, MUST emit an `ApplicationCreated` event.\\n function newApplication(\\n IConsensus _consensus,\\n address _dappOwner,\\n bytes32 _templateHash\\n ) external returns (CartesiDApp);\\n\\n /// @notice Deploy a new application deterministically.\\n /// @param _consensus The initial consensus contract\\n /// @param _dappOwner The initial DApp owner\\n /// @param _templateHash The initial machine state hash\\n /// @param _salt The salt used to deterministically generate the DApp address\\n /// @return The application\\n /// @dev On success, MUST emit an `ApplicationCreated` event.\\n function newApplication(\\n IConsensus _consensus,\\n address _dappOwner,\\n bytes32 _templateHash,\\n bytes32 _salt\\n ) external returns (CartesiDApp);\\n\\n /// @notice Calculate the address of an application to be deployed deterministically.\\n /// @param _consensus The initial consensus contract\\n /// @param _dappOwner The initial DApp owner\\n /// @param _templateHash The initial machine state hash\\n /// @param _salt The salt used to deterministically generate the DApp address\\n /// @return The deterministic application 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 _dappOwner,\\n bytes32 _templateHash,\\n bytes32 _salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0xb6d6ae44b2195f54a5c5ac85dc1c33801036878982c6b9aafe8fb66a3103517b\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/library/LibOutputValidation.sol\":{\"content\":\"// (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 {MerkleV2} from \\\"@cartesi/util/contracts/MerkleV2.sol\\\";\\nimport {OutputEncoding} from \\\"../common/OutputEncoding.sol\\\";\\n\\n/// @param inputIndexWithinEpoch Which input, inside the epoch, the output belongs to\\n/// @param outputIndexWithinInput Index of output emitted by the input\\n/// @param outputHashesRootHash Merkle root of hashes of outputs emitted by the input\\n/// @param vouchersEpochRootHash Merkle root of all epoch's voucher metadata hashes\\n/// @param noticesEpochRootHash Merkle root of all epoch's notice metadata hashes\\n/// @param machineStateHash Hash of the machine state claimed this epoch\\n/// @param outputHashInOutputHashesSiblings Proof that this output metadata is in metadata memory range\\n/// @param outputHashesInEpochSiblings Proof that this output metadata is in epoch's output memory range\\nstruct OutputValidityProof {\\n uint64 inputIndexWithinEpoch;\\n uint64 outputIndexWithinInput;\\n bytes32 outputHashesRootHash;\\n bytes32 vouchersEpochRootHash;\\n bytes32 noticesEpochRootHash;\\n bytes32 machineStateHash;\\n bytes32[] outputHashInOutputHashesSiblings;\\n bytes32[] outputHashesInEpochSiblings;\\n}\\n\\n/// @title Output Validation Library\\nlibrary LibOutputValidation {\\n using CanonicalMachine for CanonicalMachine.Log2Size;\\n\\n /// @notice Raised when some `OutputValidityProof` variables does not match\\n /// the presented finalized epoch.\\n error IncorrectEpochHash();\\n\\n /// @notice Raised when `OutputValidityProof` metadata memory range is NOT\\n /// contained in epoch's output memory range.\\n error IncorrectOutputsEpochRootHash();\\n\\n /// @notice Raised when Merkle root of output hash is NOT contained\\n /// in the output metadata array memory range.\\n error IncorrectOutputHashesRootHash();\\n\\n /// @notice Raised when epoch input index is NOT compatible with the\\n /// provided input index range.\\n error InputIndexOutOfClaimBounds();\\n\\n /// @notice Make sure the output proof is valid, otherwise revert.\\n /// @param v The output validity proof\\n /// @param encodedOutput The encoded output\\n /// @param epochHash The hash of the epoch in which the output was generated\\n /// @param outputsEpochRootHash Either `v.vouchersEpochRootHash` (for vouchers)\\n /// or `v.noticesEpochRootHash` (for notices)\\n /// @param outputEpochLog2Size Either `EPOCH_VOUCHER_LOG2_SIZE` (for vouchers)\\n /// or `EPOCH_NOTICE_LOG2_SIZE` (for notices)\\n /// @param outputHashesLog2Size Either `VOUCHER_METADATA_LOG2_SIZE` (for vouchers)\\n /// or `NOTICE_METADATA_LOG2_SIZE` (for notices)\\n function validateEncodedOutput(\\n OutputValidityProof calldata v,\\n bytes memory encodedOutput,\\n bytes32 epochHash,\\n bytes32 outputsEpochRootHash,\\n uint256 outputEpochLog2Size,\\n uint256 outputHashesLog2Size\\n ) internal pure {\\n // prove that outputs hash is represented in a finalized epoch\\n if (\\n keccak256(\\n abi.encodePacked(\\n v.vouchersEpochRootHash,\\n v.noticesEpochRootHash,\\n v.machineStateHash\\n )\\n ) != epochHash\\n ) {\\n revert IncorrectEpochHash();\\n }\\n\\n // prove that output metadata memory range is contained in epoch's output memory range\\n if (\\n MerkleV2.getRootAfterReplacementInDrive(\\n CanonicalMachine.getIntraMemoryRangePosition(\\n v.inputIndexWithinEpoch,\\n CanonicalMachine.KECCAK_LOG2_SIZE\\n ),\\n CanonicalMachine.KECCAK_LOG2_SIZE.uint64OfSize(),\\n outputEpochLog2Size,\\n v.outputHashesRootHash,\\n v.outputHashesInEpochSiblings\\n ) != outputsEpochRootHash\\n ) {\\n revert IncorrectOutputsEpochRootHash();\\n }\\n\\n // The hash of the output is converted to bytes (abi.encode) and\\n // treated as data. The metadata output memory range stores that data while\\n // being indifferent to its contents. To prove that the received\\n // output is contained in the metadata output memory range we need to\\n // prove that x, where:\\n // x = keccak(\\n // keccak(\\n // keccak(hashOfOutput[0:7]),\\n // keccak(hashOfOutput[8:15])\\n // ),\\n // keccak(\\n // keccak(hashOfOutput[16:23]),\\n // keccak(hashOfOutput[24:31])\\n // )\\n // )\\n // is contained in it. We can't simply use hashOfOutput because the\\n // log2size of the leaf is three (8 bytes) not five (32 bytes)\\n bytes32 merkleRootOfHashOfOutput = MerkleV2.getMerkleRootFromBytes(\\n abi.encodePacked(keccak256(encodedOutput)),\\n CanonicalMachine.KECCAK_LOG2_SIZE.uint64OfSize()\\n );\\n\\n // prove that Merkle root of bytes(hashOfOutput) is contained\\n // in the output metadata array memory range\\n if (\\n MerkleV2.getRootAfterReplacementInDrive(\\n CanonicalMachine.getIntraMemoryRangePosition(\\n v.outputIndexWithinInput,\\n CanonicalMachine.KECCAK_LOG2_SIZE\\n ),\\n CanonicalMachine.KECCAK_LOG2_SIZE.uint64OfSize(),\\n outputHashesLog2Size,\\n merkleRootOfHashOfOutput,\\n v.outputHashInOutputHashesSiblings\\n ) != v.outputHashesRootHash\\n ) {\\n revert IncorrectOutputHashesRootHash();\\n }\\n }\\n\\n /// @notice Make sure the output proof is valid, otherwise revert.\\n /// @param v The output validity proof\\n /// @param destination The address that will receive the payload through a message call\\n /// @param payload The payload, which\\u2014in the case of Solidity contracts\\u2014encodes a function call\\n /// @param epochHash The hash of the epoch in which the output was generated\\n function validateVoucher(\\n OutputValidityProof calldata v,\\n address destination,\\n bytes calldata payload,\\n bytes32 epochHash\\n ) internal pure {\\n bytes memory encodedVoucher = OutputEncoding.encodeVoucher(\\n destination,\\n payload\\n );\\n validateEncodedOutput(\\n v,\\n encodedVoucher,\\n epochHash,\\n v.vouchersEpochRootHash,\\n CanonicalMachine.EPOCH_VOUCHER_LOG2_SIZE.uint64OfSize(),\\n CanonicalMachine.VOUCHER_METADATA_LOG2_SIZE.uint64OfSize()\\n );\\n }\\n\\n /// @notice Make sure the output proof is valid, otherwise revert.\\n /// @param v The output validity proof\\n /// @param notice The notice\\n /// @param epochHash The hash of the epoch in which the output was generated\\n function validateNotice(\\n OutputValidityProof calldata v,\\n bytes calldata notice,\\n bytes32 epochHash\\n ) internal pure {\\n bytes memory encodedNotice = OutputEncoding.encodeNotice(notice);\\n validateEncodedOutput(\\n v,\\n encodedNotice,\\n epochHash,\\n v.noticesEpochRootHash,\\n CanonicalMachine.EPOCH_NOTICE_LOG2_SIZE.uint64OfSize(),\\n CanonicalMachine.NOTICE_METADATA_LOG2_SIZE.uint64OfSize()\\n );\\n }\\n\\n /// @notice Get the position of a voucher on the bit mask.\\n /// @param voucher The index of voucher from those generated by such input\\n /// @param input The index of the input in the DApp's input box\\n /// @return Position of the voucher on the bit mask\\n function getBitMaskPosition(\\n uint256 voucher,\\n uint256 input\\n ) internal pure returns (uint256) {\\n // voucher * 2 ** 128 + input\\n // this shouldn't overflow because it is impossible to have > 2**128 vouchers\\n // and because we are assuming there will be < 2 ** 128 inputs on the input box\\n return (((voucher << 128) | input));\\n }\\n\\n /// @notice Validate input index range and get the input index.\\n /// @param v The output validity proof\\n /// @param firstInputIndex The index of the first input of the epoch in the input box\\n /// @param lastInputIndex The index of the last input of the epoch in the input box\\n /// @return The index of the input in the DApp's input box\\n /// @dev Reverts if epoch input index is not compatible with the provided input index range.\\n function validateInputIndexRange(\\n OutputValidityProof calldata v,\\n uint256 firstInputIndex,\\n uint256 lastInputIndex\\n ) internal pure returns (uint256) {\\n uint256 inputIndex = firstInputIndex + v.inputIndexWithinEpoch;\\n\\n if (inputIndex > lastInputIndex) {\\n revert InputIndexOutOfClaimBounds();\\n }\\n\\n return inputIndex;\\n }\\n}\\n\",\"keccak256\":\"0x874ef478bd265acc94f2480a97191da907f05c6b46dc9e901c534b6acab14e03\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50611af9806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80630e1a07f5146100465780633648bfb514610075578063bd4f121914610088575b600080fd5b6100596100543660046102df565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b610059610083366004610325565b610148565b6100596100963660046102df565b6101ef565b600080828686866040516100ae906102ba565b6001600160a01b03938416815292909116602083015260408201526060018190604051809103906000f59050801580156100ec573d6000803e3d6000fd5b50604080516001600160a01b03888116825260208201889052838116828401529151929350908816917fe73165c2d277daf8713fd08b40845cb6bb7a20b2b543f3d35324a475660fcebd9181900360600190a295945050505050565b60008084848460405161015a906102ba565b6001600160a01b0393841681529290911660208301526040820152606001604051809103906000f080158015610194573d6000803e3d6000fd5b50604080516001600160a01b03878116825260208201879052838116828401529151929350908716917fe73165c2d277daf8713fd08b40845cb6bb7a20b2b543f3d35324a475660fcebd9181900360600190a2949350505050565b60006102738260405180602001610205906102ba565b601f1982820381018352601f9091011660408181526001600160a01b038a811660208401528916908201526060810187905260800160408051601f19818403018152908290526102589291602001610396565b6040516020818303038152906040528051906020012061027c565b95945050505050565b6000610289838330610290565b9392505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b611710806103b483390190565b6001600160a01b03811681146102dc57600080fd5b50565b600080600080608085870312156102f557600080fd5b8435610300816102c7565b93506020850135610310816102c7565b93969395505050506040820135916060013590565b60008060006060848603121561033a57600080fd5b8335610345816102c7565b92506020840135610355816102c7565b929592945050506040919091013590565b6000815160005b81811015610387576020818501810151868301520161036d565b50600093019283525090919050565b60006103ab6103a58386610366565b84610366565b94935050505056fe60a06040523480156200001157600080fd5b506040516200171038038062001710833981016040819052620000349162000212565b6200003f33620000cb565b600180556200004e826200011b565b6080819052600380546001600160a01b0319166001600160a01b0385169081179091556040805163b688a36360e01b8152905163b688a3639160048082019260009290919082900301818387803b158015620000a957600080fd5b505af1158015620000be573d6000803e3d6000fd5b505050505050506200025a565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b620001256200019e565b6001600160a01b038116620001905760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6200019b81620000cb565b50565b6000546001600160a01b03163314620001fa5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000187565b565b6001600160a01b03811681146200019b57600080fd5b6000806000606084860312156200022857600080fd5b83516200023581620001fc565b60208501519093506200024881620001fc565b80925050604084015190509250925092565b60805161149a6200027660003960006101ec015261149a6000f3fe6080604052600436106100e15760003560e01c80638da5cb5b1161007f578063bc197c8111610059578063bc197c8114610288578063f23a6e61146102b4578063f2fde38b146102e0578063fc4116831461030057600080fd5b80638da5cb5b1461022a57806396487d46146102485780639d9b11451461026857600080fd5b8063179e740b116100bb578063179e740b14610186578063522f6815146101b857806361b12c66146101da578063715018a61461021557600080fd5b806301ffc9a7146100ed5780631250482f14610122578063150b7a021461014257600080fd5b366100e857005b600080fd5b3480156100f957600080fd5b5061010d610108366004610d2a565b610320565b60405190151581526020015b60405180910390f35b34801561012e57600080fd5b5061010d61013d366004610dd0565b610357565b34801561014e57600080fd5b5061016d61015d366004610f00565b630a85bd0160e11b949350505050565b6040516001600160e01b03199091168152602001610119565b34801561019257600080fd5b506003546001600160a01b03165b6040516001600160a01b039091168152602001610119565b3480156101c457600080fd5b506101d86101d3366004610f5f565b61053c565b005b3480156101e657600080fd5b506040517f00000000000000000000000000000000000000000000000000000000000000008152602001610119565b34801561022157600080fd5b506101d86105d5565b34801561023657600080fd5b506000546001600160a01b03166101a0565b34801561025457600080fd5b5061010d610263366004610f8b565b6105e9565b34801561027457600080fd5b5061010d610283366004610ff3565b61063a565b34801561029457600080fd5b5061016d6102a3366004611094565b63bc197c8160e01b95945050505050565b3480156102c057600080fd5b5061016d6102cf366004611141565b63f23a6e6160e01b95945050505050565b3480156102ec57600080fd5b506101d86102fb3660046111a9565b61064c565b34801561030c57600080fd5b506101d861031b3660046111a9565b6106ca565b60006001600160e01b03198216630271189760e51b148061035157506301ffc9a760e01b6001600160e01b03198316145b92915050565b600061036161077f565b600080808061037b61037660208801886111c6565b6107d8565b919550935091506103988383610391898061120c565b919061085f565b90506103b4898989876103ab8b8061120c565b939291906108a5565b60006103e86103c3888061120c565b6103d490604081019060200161122c565b6001600160401b03168360809190911b1790565b90506103f3816108da565b15610411576040516370de22b760e01b815260040160405180910390fd5b60008a6001600160a01b03168a8a60405161042d929190611255565b6000604051808303816000865af19150503d806000811461046a576040519150601f19603f3d011682016040523d82523d6000602084013e61046f565b606091505b505090508015610524576040516306449da160e41b815260026004820152602481018390526001604482015273F5B2d8c81cDE4D6238bBf20D3D77DB37df13f73590636449da109060640160006040518083038186803b1580156104d257600080fd5b505af41580156104e6573d6000803e3d6000fd5b505050507f0eb7ee080f865f1cadc4f54daf58cc3b8879e888832867d13351edcec0fbdc548260405161051b91815260200190565b60405180910390a15b9550505050505061053460018055565b949350505050565b33301461055c5760405163a08d601d60e01b815260040160405180910390fd5b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146105a9576040519150601f19603f3d011682016040523d82523d6000602084013e6105ae565b606091505b50509050806105d057604051630ce8f45160e31b815260040160405180910390fd5b505050565b6105dd610958565b6105e760006109b2565b565b60008080806105fe61037660208701876111c6565b919450925090506106148282610391888061120c565b5061062d878785610625898061120c565b929190610a02565b5060019695505050505050565b6000608082901b8317610534816108da565b610654610958565b6001600160a01b0381166106be5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6106c7816109b2565b50565b6106d2610958565b600380546001600160a01b0319166001600160a01b0383169081179091556040805163b688a36360e01b8152905163b688a3639160048082019260009290919082900301818387803b15801561072757600080fd5b505af115801561073b573d6000803e3d6000fd5b50506040516001600160a01b03841681527f4991c6f37185659e276ff918a96f3e20e6c5abcd8c9aab450dc19c2f7ad35cb59250602001905060405180910390a150565b6002600154036107d15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016106b5565b6002600155565b60035460405163035e6a0960e61b8152600091829182916001600160a01b03169063d79a8240906108119030908990899060040161128e565b606060405180830381865afa15801561082e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085291906112bc565b9250925092509250925092565b60008061086f602086018661122c565b610882906001600160401b0316856112ea565b9050828111156105345760405163fd9ae91f60e01b815260040160405180910390fd5b60006108b2858585610a29565b90506108d2868284606083013560255b6001600160401b03166015610a58565b505050505050565b6040516303fbaf7360e01b8152600260048201526024810182905260009073F5B2d8c81cDE4D6238bBf20D3D77DB37df13f735906303fbaf7390604401602060405180830381865af4158015610934573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610351919061130b565b6000546001600160a01b031633146105e75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106b5565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610a0e8484610cfe565b9050610a22858284608083013560256108c2565b5050505050565b6060838383604051602001610a409392919061128e565b60405160208183030381529060405290509392505050565b6040805160608089013560208301526080808a01359383019390935260a0890135908201528591016040516020818303038152906040528051906020012014610ab457604051636fbd3b7160e11b815260040160405180910390fd5b827333436035441927Df1a73FE3AAC5906854632e53d6379de4601610af0610adf60208b018b61122c565b60051b681fffffffffffffffe01690565b60058660408c0135610b0560e08e018e61132d565b6040518763ffffffff1660e01b8152600401610b2696959493929190611376565b602060405180830381865af4158015610b43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6791906113d9565b14610b8557604051634371daa160e11b815260040160405180910390fd5b60007333436035441927Df1a73FE3AAC5906854632e53d63c84583a18780519060200120604051602001610bbb91815260200190565b60408051601f19818403018152908290526001600160e01b031960e084901b168252610bec916005906004016113f2565b602060405180830381865af4158015610c09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2d91906113d9565b905086604001357333436035441927Df1a73FE3AAC5906854632e53d6379de4601610c648a6020016020810190610adf919061122c565b60058686610c7560c08f018f61132d565b6040518763ffffffff1660e01b8152600401610c9696959493929190611376565b602060405180830381865af4158015610cb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd791906113d9565b14610cf55760405163017c689560e61b815260040160405180910390fd5b50505050505050565b60608282604051602001610d13929190611450565b604051602081830303815290604052905092915050565b600060208284031215610d3c57600080fd5b81356001600160e01b031981168114610d5457600080fd5b9392505050565b6001600160a01b03811681146106c757600080fd5b60008083601f840112610d8257600080fd5b5081356001600160401b03811115610d9957600080fd5b602083019150836020828501011115610db157600080fd5b9250929050565b600060408284031215610dca57600080fd5b50919050565b60008060008060608587031215610de657600080fd5b8435610df181610d5b565b935060208501356001600160401b0380821115610e0d57600080fd5b610e1988838901610d70565b90955093506040870135915080821115610e3257600080fd5b50610e3f87828801610db8565b91505092959194509250565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715610e8957610e89610e4b565b604052919050565b600082601f830112610ea257600080fd5b81356001600160401b03811115610ebb57610ebb610e4b565b610ece601f8201601f1916602001610e61565b818152846020838601011115610ee357600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215610f1657600080fd5b8435610f2181610d5b565b93506020850135610f3181610d5b565b92506040850135915060608501356001600160401b03811115610f5357600080fd5b610e3f87828801610e91565b60008060408385031215610f7257600080fd5b8235610f7d81610d5b565b946020939093013593505050565b600080600060408486031215610fa057600080fd5b83356001600160401b0380821115610fb757600080fd5b610fc387838801610d70565b90955093506020860135915080821115610fdc57600080fd5b50610fe986828701610db8565b9150509250925092565b6000806040838503121561100657600080fd5b50508035926020909101359150565b600082601f83011261102657600080fd5b813560206001600160401b0382111561104157611041610e4b565b8160051b611050828201610e61565b928352848101820192828101908785111561106a57600080fd5b83870192505b8483101561108957823582529183019190830190611070565b979650505050505050565b600080600080600060a086880312156110ac57600080fd5b85356110b781610d5b565b945060208601356110c781610d5b565b935060408601356001600160401b03808211156110e357600080fd5b6110ef89838a01611015565b9450606088013591508082111561110557600080fd5b61111189838a01611015565b9350608088013591508082111561112757600080fd5b5061113488828901610e91565b9150509295509295909350565b600080600080600060a0868803121561115957600080fd5b853561116481610d5b565b9450602086013561117481610d5b565b9350604086013592506060860135915060808601356001600160401b0381111561119d57600080fd5b61113488828901610e91565b6000602082840312156111bb57600080fd5b8135610d5481610d5b565b6000808335601e198436030181126111dd57600080fd5b8301803591506001600160401b038211156111f757600080fd5b602001915036819003821315610db157600080fd5b6000823560fe1983360301811261122257600080fd5b9190910192915050565b60006020828403121561123e57600080fd5b81356001600160401b0381168114610d5457600080fd5b8183823760009101908152919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03841681526040602082018190526000906112b39083018486611265565b95945050505050565b6000806000606084860312156112d157600080fd5b8351925060208401519150604084015190509250925092565b8082018082111561035157634e487b7160e01b600052601160045260246000fd5b60006020828403121561131d57600080fd5b81518015158114610d5457600080fd5b6000808335601e1984360301811261134457600080fd5b8301803591506001600160401b0382111561135e57600080fd5b6020019150600581901b3603821315610db157600080fd5b6001600160401b03878116825286166020820152604081018590526060810184905260a060808201819052810182905260006001600160fb1b038311156113bc57600080fd5b8260051b808560c08501379190910160c001979650505050505050565b6000602082840312156113eb57600080fd5b5051919050565b604081526000835180604084015260005b818110156114205760208187018101516060868401015201611403565b506000606082850101526060601f19601f8301168401019150506001600160401b03831660208301529392505050565b60208152600061053460208301848661126556fea2646970667358221220981835fbbf44aedaeb41e0c0c9001ffe55187a0b5606db0cdbf7500fc7c5e30e64736f6c63430008130033a2646970667358221220a12c770ef21751c306949fd9ed57ed453446a67f2dfb1d63d08c918461eca99764736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80630e1a07f5146100465780633648bfb514610075578063bd4f121914610088575b600080fd5b6100596100543660046102df565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b610059610083366004610325565b610148565b6100596100963660046102df565b6101ef565b600080828686866040516100ae906102ba565b6001600160a01b03938416815292909116602083015260408201526060018190604051809103906000f59050801580156100ec573d6000803e3d6000fd5b50604080516001600160a01b03888116825260208201889052838116828401529151929350908816917fe73165c2d277daf8713fd08b40845cb6bb7a20b2b543f3d35324a475660fcebd9181900360600190a295945050505050565b60008084848460405161015a906102ba565b6001600160a01b0393841681529290911660208301526040820152606001604051809103906000f080158015610194573d6000803e3d6000fd5b50604080516001600160a01b03878116825260208201879052838116828401529151929350908716917fe73165c2d277daf8713fd08b40845cb6bb7a20b2b543f3d35324a475660fcebd9181900360600190a2949350505050565b60006102738260405180602001610205906102ba565b601f1982820381018352601f9091011660408181526001600160a01b038a811660208401528916908201526060810187905260800160408051601f19818403018152908290526102589291602001610396565b6040516020818303038152906040528051906020012061027c565b95945050505050565b6000610289838330610290565b9392505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b611710806103b483390190565b6001600160a01b03811681146102dc57600080fd5b50565b600080600080608085870312156102f557600080fd5b8435610300816102c7565b93506020850135610310816102c7565b93969395505050506040820135916060013590565b60008060006060848603121561033a57600080fd5b8335610345816102c7565b92506020840135610355816102c7565b929592945050506040919091013590565b6000815160005b81811015610387576020818501810151868301520161036d565b50600093019283525090919050565b60006103ab6103a58386610366565b84610366565b94935050505056fe60a06040523480156200001157600080fd5b506040516200171038038062001710833981016040819052620000349162000212565b6200003f33620000cb565b600180556200004e826200011b565b6080819052600380546001600160a01b0319166001600160a01b0385169081179091556040805163b688a36360e01b8152905163b688a3639160048082019260009290919082900301818387803b158015620000a957600080fd5b505af1158015620000be573d6000803e3d6000fd5b505050505050506200025a565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b620001256200019e565b6001600160a01b038116620001905760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6200019b81620000cb565b50565b6000546001600160a01b03163314620001fa5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000187565b565b6001600160a01b03811681146200019b57600080fd5b6000806000606084860312156200022857600080fd5b83516200023581620001fc565b60208501519093506200024881620001fc565b80925050604084015190509250925092565b60805161149a6200027660003960006101ec015261149a6000f3fe6080604052600436106100e15760003560e01c80638da5cb5b1161007f578063bc197c8111610059578063bc197c8114610288578063f23a6e61146102b4578063f2fde38b146102e0578063fc4116831461030057600080fd5b80638da5cb5b1461022a57806396487d46146102485780639d9b11451461026857600080fd5b8063179e740b116100bb578063179e740b14610186578063522f6815146101b857806361b12c66146101da578063715018a61461021557600080fd5b806301ffc9a7146100ed5780631250482f14610122578063150b7a021461014257600080fd5b366100e857005b600080fd5b3480156100f957600080fd5b5061010d610108366004610d2a565b610320565b60405190151581526020015b60405180910390f35b34801561012e57600080fd5b5061010d61013d366004610dd0565b610357565b34801561014e57600080fd5b5061016d61015d366004610f00565b630a85bd0160e11b949350505050565b6040516001600160e01b03199091168152602001610119565b34801561019257600080fd5b506003546001600160a01b03165b6040516001600160a01b039091168152602001610119565b3480156101c457600080fd5b506101d86101d3366004610f5f565b61053c565b005b3480156101e657600080fd5b506040517f00000000000000000000000000000000000000000000000000000000000000008152602001610119565b34801561022157600080fd5b506101d86105d5565b34801561023657600080fd5b506000546001600160a01b03166101a0565b34801561025457600080fd5b5061010d610263366004610f8b565b6105e9565b34801561027457600080fd5b5061010d610283366004610ff3565b61063a565b34801561029457600080fd5b5061016d6102a3366004611094565b63bc197c8160e01b95945050505050565b3480156102c057600080fd5b5061016d6102cf366004611141565b63f23a6e6160e01b95945050505050565b3480156102ec57600080fd5b506101d86102fb3660046111a9565b61064c565b34801561030c57600080fd5b506101d861031b3660046111a9565b6106ca565b60006001600160e01b03198216630271189760e51b148061035157506301ffc9a760e01b6001600160e01b03198316145b92915050565b600061036161077f565b600080808061037b61037660208801886111c6565b6107d8565b919550935091506103988383610391898061120c565b919061085f565b90506103b4898989876103ab8b8061120c565b939291906108a5565b60006103e86103c3888061120c565b6103d490604081019060200161122c565b6001600160401b03168360809190911b1790565b90506103f3816108da565b15610411576040516370de22b760e01b815260040160405180910390fd5b60008a6001600160a01b03168a8a60405161042d929190611255565b6000604051808303816000865af19150503d806000811461046a576040519150601f19603f3d011682016040523d82523d6000602084013e61046f565b606091505b505090508015610524576040516306449da160e41b815260026004820152602481018390526001604482015273__$f57eb21c11c6dae369da3ca36f4f48eb77$__90636449da109060640160006040518083038186803b1580156104d257600080fd5b505af41580156104e6573d6000803e3d6000fd5b505050507f0eb7ee080f865f1cadc4f54daf58cc3b8879e888832867d13351edcec0fbdc548260405161051b91815260200190565b60405180910390a15b9550505050505061053460018055565b949350505050565b33301461055c5760405163a08d601d60e01b815260040160405180910390fd5b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146105a9576040519150601f19603f3d011682016040523d82523d6000602084013e6105ae565b606091505b50509050806105d057604051630ce8f45160e31b815260040160405180910390fd5b505050565b6105dd610958565b6105e760006109b2565b565b60008080806105fe61037660208701876111c6565b919450925090506106148282610391888061120c565b5061062d878785610625898061120c565b929190610a02565b5060019695505050505050565b6000608082901b8317610534816108da565b610654610958565b6001600160a01b0381166106be5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6106c7816109b2565b50565b6106d2610958565b600380546001600160a01b0319166001600160a01b0383169081179091556040805163b688a36360e01b8152905163b688a3639160048082019260009290919082900301818387803b15801561072757600080fd5b505af115801561073b573d6000803e3d6000fd5b50506040516001600160a01b03841681527f4991c6f37185659e276ff918a96f3e20e6c5abcd8c9aab450dc19c2f7ad35cb59250602001905060405180910390a150565b6002600154036107d15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016106b5565b6002600155565b60035460405163035e6a0960e61b8152600091829182916001600160a01b03169063d79a8240906108119030908990899060040161128e565b606060405180830381865afa15801561082e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085291906112bc565b9250925092509250925092565b60008061086f602086018661122c565b610882906001600160401b0316856112ea565b9050828111156105345760405163fd9ae91f60e01b815260040160405180910390fd5b60006108b2858585610a29565b90506108d2868284606083013560255b6001600160401b03166015610a58565b505050505050565b6040516303fbaf7360e01b8152600260048201526024810182905260009073__$f57eb21c11c6dae369da3ca36f4f48eb77$__906303fbaf7390604401602060405180830381865af4158015610934573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610351919061130b565b6000546001600160a01b031633146105e75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106b5565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610a0e8484610cfe565b9050610a22858284608083013560256108c2565b5050505050565b6060838383604051602001610a409392919061128e565b60405160208183030381529060405290509392505050565b6040805160608089013560208301526080808a01359383019390935260a0890135908201528591016040516020818303038152906040528051906020012014610ab457604051636fbd3b7160e11b815260040160405180910390fd5b8273__$2a7ef22e717e9afc55afc95d018bf1a85b$__6379de4601610af0610adf60208b018b61122c565b60051b681fffffffffffffffe01690565b60058660408c0135610b0560e08e018e61132d565b6040518763ffffffff1660e01b8152600401610b2696959493929190611376565b602060405180830381865af4158015610b43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6791906113d9565b14610b8557604051634371daa160e11b815260040160405180910390fd5b600073__$2a7ef22e717e9afc55afc95d018bf1a85b$__63c84583a18780519060200120604051602001610bbb91815260200190565b60408051601f19818403018152908290526001600160e01b031960e084901b168252610bec916005906004016113f2565b602060405180830381865af4158015610c09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2d91906113d9565b9050866040013573__$2a7ef22e717e9afc55afc95d018bf1a85b$__6379de4601610c648a6020016020810190610adf919061122c565b60058686610c7560c08f018f61132d565b6040518763ffffffff1660e01b8152600401610c9696959493929190611376565b602060405180830381865af4158015610cb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd791906113d9565b14610cf55760405163017c689560e61b815260040160405180910390fd5b50505050505050565b60608282604051602001610d13929190611450565b604051602081830303815290604052905092915050565b600060208284031215610d3c57600080fd5b81356001600160e01b031981168114610d5457600080fd5b9392505050565b6001600160a01b03811681146106c757600080fd5b60008083601f840112610d8257600080fd5b5081356001600160401b03811115610d9957600080fd5b602083019150836020828501011115610db157600080fd5b9250929050565b600060408284031215610dca57600080fd5b50919050565b60008060008060608587031215610de657600080fd5b8435610df181610d5b565b935060208501356001600160401b0380821115610e0d57600080fd5b610e1988838901610d70565b90955093506040870135915080821115610e3257600080fd5b50610e3f87828801610db8565b91505092959194509250565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715610e8957610e89610e4b565b604052919050565b600082601f830112610ea257600080fd5b81356001600160401b03811115610ebb57610ebb610e4b565b610ece601f8201601f1916602001610e61565b818152846020838601011115610ee357600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215610f1657600080fd5b8435610f2181610d5b565b93506020850135610f3181610d5b565b92506040850135915060608501356001600160401b03811115610f5357600080fd5b610e3f87828801610e91565b60008060408385031215610f7257600080fd5b8235610f7d81610d5b565b946020939093013593505050565b600080600060408486031215610fa057600080fd5b83356001600160401b0380821115610fb757600080fd5b610fc387838801610d70565b90955093506020860135915080821115610fdc57600080fd5b50610fe986828701610db8565b9150509250925092565b6000806040838503121561100657600080fd5b50508035926020909101359150565b600082601f83011261102657600080fd5b813560206001600160401b0382111561104157611041610e4b565b8160051b611050828201610e61565b928352848101820192828101908785111561106a57600080fd5b83870192505b8483101561108957823582529183019190830190611070565b979650505050505050565b600080600080600060a086880312156110ac57600080fd5b85356110b781610d5b565b945060208601356110c781610d5b565b935060408601356001600160401b03808211156110e357600080fd5b6110ef89838a01611015565b9450606088013591508082111561110557600080fd5b61111189838a01611015565b9350608088013591508082111561112757600080fd5b5061113488828901610e91565b9150509295509295909350565b600080600080600060a0868803121561115957600080fd5b853561116481610d5b565b9450602086013561117481610d5b565b9350604086013592506060860135915060808601356001600160401b0381111561119d57600080fd5b61113488828901610e91565b6000602082840312156111bb57600080fd5b8135610d5481610d5b565b6000808335601e198436030181126111dd57600080fd5b8301803591506001600160401b038211156111f757600080fd5b602001915036819003821315610db157600080fd5b6000823560fe1983360301811261122257600080fd5b9190910192915050565b60006020828403121561123e57600080fd5b81356001600160401b0381168114610d5457600080fd5b8183823760009101908152919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03841681526040602082018190526000906112b39083018486611265565b95945050505050565b6000806000606084860312156112d157600080fd5b8351925060208401519150604084015190509250925092565b8082018082111561035157634e487b7160e01b600052601160045260246000fd5b60006020828403121561131d57600080fd5b81518015158114610d5457600080fd5b6000808335601e1984360301811261134457600080fd5b8301803591506001600160401b0382111561135e57600080fd5b6020019150600581901b3603821315610db157600080fd5b6001600160401b03878116825286166020820152604081018590526060810184905260a060808201819052810182905260006001600160fb1b038311156113bc57600080fd5b8260051b808560c08501379190910160c001979650505050505050565b6000602082840312156113eb57600080fd5b5051919050565b604081526000835180604084015260005b818110156114205760208187018101516060868401015201611403565b506000606082850101526060601f19601f8301168401019150506001600160401b03831660208301529392505050565b60208152600061053460208301848661126556fea2646970667358221220981835fbbf44aedaeb41e0c0c9001ffe55187a0b5606db0cdbf7500fc7c5e30e64736f6c63430008130033a2646970667358221220a12c770ef21751c306949fd9ed57ed453446a67f2dfb1d63d08c918461eca99764736f6c63430008130033", - "libraries": { - "Bitmask": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", - "MerkleV2": "0x33436035441927Df1a73FE3AAC5906854632e53d" - }, - "devdoc": { - "events": { - "ApplicationCreated(address,address,bytes32,address)": { - "details": "MUST be triggered on a successful call to `newApplication`.", - "params": { - "application": "The application", - "consensus": "The initial consensus contract", - "dappOwner": "The initial DApp owner", - "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": { - "_consensus": "The initial consensus contract", - "_dappOwner": "The initial DApp owner", - "_salt": "The salt used to deterministically generate the DApp address", - "_templateHash": "The initial machine state hash" - }, - "returns": { - "_0": "The deterministic application address" - } - }, - "newApplication(address,address,bytes32)": { - "details": "On success, MUST emit an `ApplicationCreated` event.", - "params": { - "_consensus": "The initial consensus contract", - "_dappOwner": "The initial DApp owner", - "_templateHash": "The initial machine state hash" - }, - "returns": { - "_0": "The application" - } - }, - "newApplication(address,address,bytes32,bytes32)": { - "details": "On success, MUST emit an `ApplicationCreated` event.", - "params": { - "_consensus": "The initial consensus contract", - "_dappOwner": "The initial DApp owner", - "_salt": "The salt used to deterministically generate the DApp address", - "_templateHash": "The initial machine state hash" - }, - "returns": { - "_0": "The application" - } - } - }, - "title": "Cartesi DApp 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 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 `CartesiDApp` contract.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/deployments/arbitrum/ERC1155BatchPortal.json b/deployments/arbitrum/ERC1155BatchPortal.json deleted file mode 100644 index 4f59da640..000000000 --- a/deployments/arbitrum/ERC1155BatchPortal.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "address": "0xedB53860A6B52bbb7561Ad596416ee9965B055Aa", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC1155", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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": "0xd20a36dab70ce74abe4daa810c7991d7b773332acc58d1aed3a05ac52e706c71", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 16, - "gasUsed": "3597120", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x0c13d34e61f7ad63d374d2f467ac6e9a47705c580edc02aab1f1927fcb1b8776", - "transactionHash": "0xd20a36dab70ce74abe4daa810c7991d7b773332acc58d1aed3a05ac52e706c71", - "logs": [], - "blockNumber": 115470671, - "cumulativeGasUsed": "18668054", - "status": 1, - "byzantium": true - }, - "args": [ - "0x59b22D57D4f067708AB0c00552767405926dc768" - ], - "numDeployments": 1, - "solcInputHash": "d2696284402b6703b2d41170c93ef3b7", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"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\":\"_dapp\",\"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 `_tokenIds` and `_values` have the same length.\",\"params\":{\"_baseLayerData\":\"Additional data to be interpreted by the base layer\",\"_dapp\":\"The address of the DApp\",\"_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 to a DApp and add an input to the DApp'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 input relay.\"}},\"notice\":\"This contract allows anyone to perform batch transfers of ERC-1155 tokens to a DApp 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 v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token 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 amount 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 `amount` tokens of token type `id` from `from` to `to`.\\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 `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 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` 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 amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon 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 caller.\\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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"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 and relays.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Ether being sent in Wei\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\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 ret The return value of `transferFrom`\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param amount The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\n function encodeERC20Deposit(\\n bool ret,\\n IERC20 token,\\n address sender,\\n uint256 amount,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n ret, // 1B\\n token, // 20B\\n sender, // 20B\\n amount, // 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\\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\\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\\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 /// @notice Encode a DApp address relay.\\n /// @param dapp The DApp address\\n /// @return The encoded input\\n function encodeDAppAddressRelay(\\n address dapp\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n dapp // 20B\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5dce266a7b70ba86adf6a728c7667255d3e2b20f1789a951150a1d05439b7019\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputRelay.sol\":{\"content\":\"// (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 \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay interface\\ninterface IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this input relay.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x8c9316c43cc2c7754fbd5abccfcdbc5ed09a2f1228d993240eac6c41ea531521\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/InputRelay.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputRelay} from \\\"./IInputRelay.sol\\\";\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay\\n/// @notice This contract serves as a base for all the other input relays.\\ncontract InputRelay is IInputRelay {\\n /// @notice The input box used by the input relay.\\n IInputBox internal immutable inputBox;\\n\\n /// @notice Constructs the input relay.\\n /// @param _inputBox The input box used by the input relay\\n constructor(IInputBox _inputBox) {\\n inputBox = _inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return inputBox;\\n }\\n}\\n\",\"keccak256\":\"0xbb489f157a0bd7a9da29b0bf3c47c4b4051d90ccd252abc3f81c8e897329e590\",\"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 {InputRelay} from \\\"../inputs/InputRelay.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 a DApp while informing the off-chain machine.\\ncontract ERC1155BatchPortal is InputRelay, IERC1155BatchPortal {\\n /// @notice Constructs the portal.\\n /// @param _inputBox The input box used by the portal\\n constructor(IInputBox _inputBox) InputRelay(_inputBox) {}\\n\\n function depositBatchERC1155Token(\\n IERC1155 _token,\\n address _dapp,\\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 _dapp,\\n _tokenIds,\\n _values,\\n _baseLayerData\\n );\\n\\n bytes memory input = InputEncoding.encodeBatchERC1155Deposit(\\n _token,\\n msg.sender,\\n _tokenIds,\\n _values,\\n _baseLayerData,\\n _execLayerData\\n );\\n\\n inputBox.addInput(_dapp, input);\\n }\\n}\\n\",\"keccak256\":\"0x8aab3384ab673cf9dd34da33b2a1c9efbbfb4960acaee44c7d50c63344237d86\",\"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 {IInputRelay} from \\\"../inputs/IInputRelay.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title ERC-1155 Batch Transfer Portal interface\\ninterface IERC1155BatchPortal is IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Transfer a batch of ERC-1155 tokens to a DApp and add an input to\\n /// the DApp'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 _dapp The address of the DApp\\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 `_tokenIds` and `_values` have the same length.\\n function depositBatchERC1155Token(\\n IERC1155 _token,\\n address _dapp,\\n uint256[] calldata _tokenIds,\\n uint256[] calldata _values,\\n bytes calldata _baseLayerData,\\n bytes calldata _execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0xfd76007f27ca0b4886d477eabdbda517e6a4a139c2b044cd8b59debf4894016d\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b5060405161064538038061064583398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516105b461009160003960008181603c015261012601526105b46000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806324d15c6714610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a6100853660046102c1565b61008c565b005b604051631759616b60e11b81526001600160a01b038b1690632eb2c2d6906100c69033908d908d908d908d908d908d908d90600401610404565b600060405180830381600087803b1580156100e057600080fd5b505af11580156100f4573d6000803e3d6000fd5b50505050600061010c8b338b8b8b8b8b8b8b8b6101ae565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061015d908d90859060040161048c565b6020604051808303816000875af115801561017c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a091906104ce565b505050505050505050505050565b6060600089898989898989896040516020016101d19897969594939291906104e7565b60405160208183030381529060405290508b8b826040516020016101f793929190610538565b6040516020818303038152906040529150509a9950505050505050505050565b80356001600160a01b038116811461022e57600080fd5b919050565b60008083601f84011261024557600080fd5b50813567ffffffffffffffff81111561025d57600080fd5b6020830191508360208260051b850101111561027857600080fd5b9250929050565b60008083601f84011261029157600080fd5b50813567ffffffffffffffff8111156102a957600080fd5b60208301915083602082850101111561027857600080fd5b60008060008060008060008060008060c08b8d0312156102e057600080fd5b6102e98b610217565b99506102f760208c01610217565b985060408b013567ffffffffffffffff8082111561031457600080fd5b6103208e838f01610233565b909a50985060608d013591508082111561033957600080fd5b6103458e838f01610233565b909850965060808d013591508082111561035e57600080fd5b61036a8e838f0161027f565b909650945060a08d013591508082111561038357600080fd5b506103908d828e0161027f565b915080935050809150509295989b9194979a5092959850565b81835260006001600160fb1b038311156103c257600080fd5b8260051b80836020870137939093016020019392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0389811682528816602082015260a060408201819052600090610431908301888a6103a9565b82810360608401526104448187896103a9565b905082810360808401526104598185876103db565b9b9a5050505050505050505050565b60005b8381101561048357818101518382015260200161046b565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526104b9816060850160208701610468565b601f01601f1916919091016060019392505050565b6000602082840312156104e057600080fd5b5051919050565b6080815260006104fb608083018a8c6103a9565b828103602084015261050e81898b6103a9565b905082810360408401526105238187896103db565b905082810360608401526104598185876103db565b60006bffffffffffffffffffffffff19808660601b168352808560601b16601484015250825161056f816028850160208701610468565b9190910160280194935050505056fea2646970667358221220b1261ceaf7c0f69c5d0d611864ae36802a7987738f02b3c9f93c1843357f32eb64736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806324d15c6714610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a6100853660046102c1565b61008c565b005b604051631759616b60e11b81526001600160a01b038b1690632eb2c2d6906100c69033908d908d908d908d908d908d908d90600401610404565b600060405180830381600087803b1580156100e057600080fd5b505af11580156100f4573d6000803e3d6000fd5b50505050600061010c8b338b8b8b8b8b8b8b8b6101ae565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061015d908d90859060040161048c565b6020604051808303816000875af115801561017c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a091906104ce565b505050505050505050505050565b6060600089898989898989896040516020016101d19897969594939291906104e7565b60405160208183030381529060405290508b8b826040516020016101f793929190610538565b6040516020818303038152906040529150509a9950505050505050505050565b80356001600160a01b038116811461022e57600080fd5b919050565b60008083601f84011261024557600080fd5b50813567ffffffffffffffff81111561025d57600080fd5b6020830191508360208260051b850101111561027857600080fd5b9250929050565b60008083601f84011261029157600080fd5b50813567ffffffffffffffff8111156102a957600080fd5b60208301915083602082850101111561027857600080fd5b60008060008060008060008060008060c08b8d0312156102e057600080fd5b6102e98b610217565b99506102f760208c01610217565b985060408b013567ffffffffffffffff8082111561031457600080fd5b6103208e838f01610233565b909a50985060608d013591508082111561033957600080fd5b6103458e838f01610233565b909850965060808d013591508082111561035e57600080fd5b61036a8e838f0161027f565b909650945060a08d013591508082111561038357600080fd5b506103908d828e0161027f565b915080935050809150509295989b9194979a5092959850565b81835260006001600160fb1b038311156103c257600080fd5b8260051b80836020870137939093016020019392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0389811682528816602082015260a060408201819052600090610431908301888a6103a9565b82810360608401526104448187896103a9565b905082810360808401526104598185876103db565b9b9a5050505050505050505050565b60005b8381101561048357818101518382015260200161046b565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526104b9816060850160208701610468565b601f01601f1916919091016060019392505050565b6000602082840312156104e057600080fd5b5051919050565b6080815260006104fb608083018a8c6103a9565b828103602084015261050e81898b6103a9565b905082810360408401526105238187896103db565b905082810360608401526104598185876103db565b60006bffffffffffffffffffffffff19808660601b168352808560601b16601484015250825161056f816028850160208701610468565b9190910160280194935050505056fea2646970667358221220b1261ceaf7c0f69c5d0d611864ae36802a7987738f02b3c9f93c1843357f32eb64736f6c63430008130033", - "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 `_tokenIds` and `_values` have the same length.", - "params": { - "_baseLayerData": "Additional data to be interpreted by the base layer", - "_dapp": "The address of the DApp", - "_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 to a DApp and add an input to the DApp'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 input relay." - } - }, - "notice": "This contract allows anyone to perform batch transfers of ERC-1155 tokens to a DApp while informing the off-chain machine.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/deployments/arbitrum/ERC1155SinglePortal.json b/deployments/arbitrum/ERC1155SinglePortal.json deleted file mode 100644 index 27861d3df..000000000 --- a/deployments/arbitrum/ERC1155SinglePortal.json +++ /dev/null @@ -1,138 +0,0 @@ -{ - "address": "0x7CFB0193Ca87eB6e48056885E026552c3A941FC4", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC1155", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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": "0xb63f7b01bd8d149c4dc144c6aaba385f93090f044669fe32e2ec9dfb54dd9086", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 1, - "gasUsed": "3333095", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x945df07acf3136402a00dab221723af473db4f61e69692d6cb9c0142831bd3d7", - "transactionHash": "0xb63f7b01bd8d149c4dc144c6aaba385f93090f044669fe32e2ec9dfb54dd9086", - "logs": [], - "blockNumber": 115470661, - "cumulativeGasUsed": "3333095", - "status": 1, - "byzantium": true - }, - "args": [ - "0x59b22D57D4f067708AB0c00552767405926dc768" - ], - "numDeployments": 1, - "solcInputHash": "d2696284402b6703b2d41170c93ef3b7", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"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\":\"_dapp\",\"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\":{\"_baseLayerData\":\"Additional data to be interpreted by the base layer\",\"_dapp\":\"The address of the DApp\",\"_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 an ERC-1155 token to a DApp and add an input to the DApp'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 input relay.\"}},\"notice\":\"This contract allows anyone to perform single transfers of ERC-1155 tokens to a DApp 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 v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token 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 amount 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 `amount` tokens of token type `id` from `from` to `to`.\\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 `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 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` 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 amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon 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 caller.\\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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"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 and relays.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Ether being sent in Wei\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\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 ret The return value of `transferFrom`\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param amount The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\n function encodeERC20Deposit(\\n bool ret,\\n IERC20 token,\\n address sender,\\n uint256 amount,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n ret, // 1B\\n token, // 20B\\n sender, // 20B\\n amount, // 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\\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\\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\\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 /// @notice Encode a DApp address relay.\\n /// @param dapp The DApp address\\n /// @return The encoded input\\n function encodeDAppAddressRelay(\\n address dapp\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n dapp // 20B\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5dce266a7b70ba86adf6a728c7667255d3e2b20f1789a951150a1d05439b7019\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputRelay.sol\":{\"content\":\"// (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 \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay interface\\ninterface IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this input relay.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x8c9316c43cc2c7754fbd5abccfcdbc5ed09a2f1228d993240eac6c41ea531521\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/InputRelay.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputRelay} from \\\"./IInputRelay.sol\\\";\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay\\n/// @notice This contract serves as a base for all the other input relays.\\ncontract InputRelay is IInputRelay {\\n /// @notice The input box used by the input relay.\\n IInputBox internal immutable inputBox;\\n\\n /// @notice Constructs the input relay.\\n /// @param _inputBox The input box used by the input relay\\n constructor(IInputBox _inputBox) {\\n inputBox = _inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return inputBox;\\n }\\n}\\n\",\"keccak256\":\"0xbb489f157a0bd7a9da29b0bf3c47c4b4051d90ccd252abc3f81c8e897329e590\",\"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 {InputRelay} from \\\"../inputs/InputRelay.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 a DApp while informing the off-chain machine.\\ncontract ERC1155SinglePortal is InputRelay, IERC1155SinglePortal {\\n /// @notice Constructs the portal.\\n /// @param _inputBox The input box used by the portal\\n constructor(IInputBox _inputBox) InputRelay(_inputBox) {}\\n\\n function depositSingleERC1155Token(\\n IERC1155 _token,\\n address _dapp,\\n uint256 _tokenId,\\n uint256 _value,\\n bytes calldata _baseLayerData,\\n bytes calldata _execLayerData\\n ) external override {\\n _token.safeTransferFrom(\\n msg.sender,\\n _dapp,\\n _tokenId,\\n _value,\\n _baseLayerData\\n );\\n\\n bytes memory input = InputEncoding.encodeSingleERC1155Deposit(\\n _token,\\n msg.sender,\\n _tokenId,\\n _value,\\n _baseLayerData,\\n _execLayerData\\n );\\n\\n inputBox.addInput(_dapp, input);\\n }\\n}\\n\",\"keccak256\":\"0x1647752c6abb80e283258cc863425845d31f3b2a53f85bc4d1db91853416b434\",\"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 {IInputRelay} from \\\"../inputs/IInputRelay.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title ERC-1155 Single Transfer Portal interface\\ninterface IERC1155SinglePortal is IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Transfer an ERC-1155 token to a DApp and add an input to\\n /// the DApp'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 _dapp The address of the DApp\\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 _dapp,\\n uint256 _tokenId,\\n uint256 _value,\\n bytes calldata _baseLayerData,\\n bytes calldata _execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0x1d3c93c70d81ede71436b43dfecbfa9f644010ca08f4197bfb966831451dab6d\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b5060405161054e38038061054e83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516104bd61009160003960008181603c015261012001526104bd6000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a578063dec07dca14610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a61008536600461026a565b61008c565b005b604051637921219560e11b81526001600160a01b0389169063f242432a906100c29033908b908b908b908b908b9060040161033b565b600060405180830381600087803b1580156100dc57600080fd5b505af11580156100f0573d6000803e3d6000fd5b50505050600061010689338989898989896101a6565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd6390610157908b9085906004016103a6565b6020604051808303816000875af1158015610176573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019a91906103e8565b50505050505050505050565b60606000858585856040516020016101c19493929190610401565b604051602081830303815290604052905089898989846040516020016101eb959493929190610433565b60405160208183030381529060405291505098975050505050505050565b6001600160a01b038116811461021e57600080fd5b50565b60008083601f84011261023357600080fd5b50813567ffffffffffffffff81111561024b57600080fd5b60208301915083602082850101111561026357600080fd5b9250929050565b60008060008060008060008060c0898b03121561028657600080fd5b883561029181610209565b975060208901356102a181610209565b96506040890135955060608901359450608089013567ffffffffffffffff808211156102cc57600080fd5b6102d88c838d01610221565b909650945060a08b01359150808211156102f157600080fd5b506102fe8b828c01610221565b999c989b5096995094979396929594505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03878116825286166020820152604081018590526060810184905260a0608082018190526000906103769083018486610312565b98975050505050505050565b60005b8381101561039d578181015183820152602001610385565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526103d3816060850160208701610382565b601f01601f1916919091016060019392505050565b6000602082840312156103fa57600080fd5b5051919050565b604081526000610415604083018688610312565b8281036020840152610428818587610312565b979650505050505050565b60006bffffffffffffffffffffffff19808860601b168352808760601b166014840152508460288301528360488301528251610476816068850160208701610382565b91909101606801969550505050505056fea26469706673582212208a2be17b506fdeea2c29cef703e184884f695e71e9147dce06da5055620ed53364736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a578063dec07dca14610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a61008536600461026a565b61008c565b005b604051637921219560e11b81526001600160a01b0389169063f242432a906100c29033908b908b908b908b908b9060040161033b565b600060405180830381600087803b1580156100dc57600080fd5b505af11580156100f0573d6000803e3d6000fd5b50505050600061010689338989898989896101a6565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd6390610157908b9085906004016103a6565b6020604051808303816000875af1158015610176573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019a91906103e8565b50505050505050505050565b60606000858585856040516020016101c19493929190610401565b604051602081830303815290604052905089898989846040516020016101eb959493929190610433565b60405160208183030381529060405291505098975050505050505050565b6001600160a01b038116811461021e57600080fd5b50565b60008083601f84011261023357600080fd5b50813567ffffffffffffffff81111561024b57600080fd5b60208301915083602082850101111561026357600080fd5b9250929050565b60008060008060008060008060c0898b03121561028657600080fd5b883561029181610209565b975060208901356102a181610209565b96506040890135955060608901359450608089013567ffffffffffffffff808211156102cc57600080fd5b6102d88c838d01610221565b909650945060a08b01359150808211156102f157600080fd5b506102fe8b828c01610221565b999c989b5096995094979396929594505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03878116825286166020820152604081018590526060810184905260a0608082018190526000906103769083018486610312565b98975050505050505050565b60005b8381101561039d578181015183820152602001610385565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526103d3816060850160208701610382565b601f01601f1916919091016060019392505050565b6000602082840312156103fa57600080fd5b5051919050565b604081526000610415604083018688610312565b8281036020840152610428818587610312565b979650505050505050565b60006bffffffffffffffffffffffff19808860601b168352808760601b166014840152508460288301528360488301528251610476816068850160208701610382565b91909101606801969550505050505056fea26469706673582212208a2be17b506fdeea2c29cef703e184884f695e71e9147dce06da5055620ed53364736f6c63430008130033", - "devdoc": { - "kind": "dev", - "methods": { - "constructor": { - "params": { - "_inputBox": "The input box used by the portal" - } - }, - "depositSingleERC1155Token(address,address,uint256,uint256,bytes,bytes)": { - "params": { - "_baseLayerData": "Additional data to be interpreted by the base layer", - "_dapp": "The address of the DApp", - "_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 an ERC-1155 token to a DApp and add an input to the DApp'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 input relay." - } - }, - "notice": "This contract allows anyone to perform single transfers of ERC-1155 tokens to a DApp while informing the off-chain machine.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/deployments/arbitrum/ERC20Portal.json b/deployments/arbitrum/ERC20Portal.json deleted file mode 100644 index 950571e7d..000000000 --- a/deployments/arbitrum/ERC20Portal.json +++ /dev/null @@ -1,126 +0,0 @@ -{ - "address": "0x9C21AEb2093C32DDbC53eEF24B873BDCd1aDa1DB", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC20", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "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": "0x408224fa7c4975fb2f964bc7f2bb2ac556fc6915e41496a454300e21b96b076a", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 2, - "gasUsed": "2867844", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x15f5bc27b0f2c84d8878c0ea544bc74a49474d516942caf532d478b2ba3c2146", - "transactionHash": "0x408224fa7c4975fb2f964bc7f2bb2ac556fc6915e41496a454300e21b96b076a", - "logs": [], - "blockNumber": 115470641, - "cumulativeGasUsed": "5172811", - "status": 1, - "byzantium": true - }, - "args": [ - "0x59b22D57D4f067708AB0c00552767405926dc768" - ], - "numDeployments": 1, - "solcInputHash": "d2696284402b6703b2d41170c93ef3b7", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"_inputBox\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_dapp\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"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\":{\"_amount\":\"The amount of tokens to be transferred\",\"_dapp\":\"The address of the DApp\",\"_execLayerData\":\"Additional data to be interpreted by the execution layer\",\"_token\":\"The ERC-20 token contract\"}},\"getInputBox()\":{\"returns\":{\"_0\":\"The input box\"}}},\"title\":\"ERC-20 Portal\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs the portal.\"},\"depositERC20Tokens(address,address,uint256,bytes)\":{\"notice\":\"Transfer ERC-20 tokens to a DApp and add an input to the DApp's input box to signal such operation. The caller must allow the portal to withdraw at least `_amount` tokens from their account beforehand, by calling the `approve` function in the token contract.\"},\"getInputBox()\":{\"notice\":\"Get the input box used by this input relay.\"}},\"notice\":\"This contract allows anyone to perform transfers of ERC-20 tokens to a DApp 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 v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token 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 amount 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 `amount` tokens of token type `id` from `from` to `to`.\\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 `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 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` 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 amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon 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 caller.\\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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"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 and relays.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Ether being sent in Wei\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\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 ret The return value of `transferFrom`\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param amount The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\n function encodeERC20Deposit(\\n bool ret,\\n IERC20 token,\\n address sender,\\n uint256 amount,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n ret, // 1B\\n token, // 20B\\n sender, // 20B\\n amount, // 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\\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\\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\\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 /// @notice Encode a DApp address relay.\\n /// @param dapp The DApp address\\n /// @return The encoded input\\n function encodeDAppAddressRelay(\\n address dapp\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n dapp // 20B\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5dce266a7b70ba86adf6a728c7667255d3e2b20f1789a951150a1d05439b7019\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputRelay.sol\":{\"content\":\"// (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 \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay interface\\ninterface IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this input relay.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x8c9316c43cc2c7754fbd5abccfcdbc5ed09a2f1228d993240eac6c41ea531521\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/InputRelay.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputRelay} from \\\"./IInputRelay.sol\\\";\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay\\n/// @notice This contract serves as a base for all the other input relays.\\ncontract InputRelay is IInputRelay {\\n /// @notice The input box used by the input relay.\\n IInputBox internal immutable inputBox;\\n\\n /// @notice Constructs the input relay.\\n /// @param _inputBox The input box used by the input relay\\n constructor(IInputBox _inputBox) {\\n inputBox = _inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return inputBox;\\n }\\n}\\n\",\"keccak256\":\"0xbb489f157a0bd7a9da29b0bf3c47c4b4051d90ccd252abc3f81c8e897329e590\",\"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 {InputRelay} from \\\"../inputs/InputRelay.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 a DApp while informing the off-chain machine.\\ncontract ERC20Portal is InputRelay, IERC20Portal {\\n /// @notice Constructs the portal.\\n /// @param _inputBox The input box used by the portal\\n constructor(IInputBox _inputBox) InputRelay(_inputBox) {}\\n\\n function depositERC20Tokens(\\n IERC20 _token,\\n address _dapp,\\n uint256 _amount,\\n bytes calldata _execLayerData\\n ) external override {\\n bool success = _token.transferFrom(msg.sender, _dapp, _amount);\\n\\n bytes memory input = InputEncoding.encodeERC20Deposit(\\n success,\\n _token,\\n msg.sender,\\n _amount,\\n _execLayerData\\n );\\n\\n inputBox.addInput(_dapp, input);\\n }\\n}\\n\",\"keccak256\":\"0x0de20df5988c4cda715ff1b1fbf30119822b850d2541d9a7119b8d44907da31f\",\"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 {IInputRelay} from \\\"../inputs/IInputRelay.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title ERC-20 Portal interface\\ninterface IERC20Portal is IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Transfer ERC-20 tokens to a DApp and add an input to\\n /// the DApp's input box to signal such operation.\\n ///\\n /// The caller must allow the portal to withdraw at least `_amount` 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 _dapp The address of the DApp\\n /// @param _amount 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 _dapp,\\n uint256 _amount,\\n bytes calldata _execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0xaeacb82606f1a687170c230eb169094cb3eea8ddc4838dc13f4830721fb5234b\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b5060405161045f38038061045f83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516103ce61009160003960008181603c015261013501526103ce6000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806395854b8114610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a610085366004610209565b61008c565b005b6040516323b872dd60e01b81523360048201526001600160a01b03858116602483015260448201859052600091908716906323b872dd906064016020604051808303816000875af11580156100e5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061010991906102a8565b9050600061011b8288338888886101b9565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061016c90899085906004016102d1565b6020604051808303816000875af115801561018b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101af919061032f565b5050505050505050565b60608686868686866040516020016101d696959493929190610348565b60405160208183030381529060405290509695505050505050565b6001600160a01b038116811461020657600080fd5b50565b60008060008060006080868803121561022157600080fd5b853561022c816101f1565b9450602086013561023c816101f1565b935060408601359250606086013567ffffffffffffffff8082111561026057600080fd5b818801915088601f83011261027457600080fd5b81358181111561028357600080fd5b89602082850101111561029557600080fd5b9699959850939650602001949392505050565b6000602082840312156102ba57600080fd5b815180151581146102ca57600080fd5b9392505050565b60018060a01b038316815260006020604081840152835180604085015260005b8181101561030d578581018301518582016060015282016102f1565b506000606082860101526060601f19601f830116850101925050509392505050565b60006020828403121561034157600080fd5b5051919050565b86151560f81b815260006bffffffffffffffffffffffff19808860601b166001840152808760601b166015840152508460298301528284604984013750600091016049019081529594505050505056fea26469706673582212205635c4a24e9e9f5e128a69b633d53f24838d8833b76e4fca1f3bf3b490e380c664736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806395854b8114610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a610085366004610209565b61008c565b005b6040516323b872dd60e01b81523360048201526001600160a01b03858116602483015260448201859052600091908716906323b872dd906064016020604051808303816000875af11580156100e5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061010991906102a8565b9050600061011b8288338888886101b9565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061016c90899085906004016102d1565b6020604051808303816000875af115801561018b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101af919061032f565b5050505050505050565b60608686868686866040516020016101d696959493929190610348565b60405160208183030381529060405290509695505050505050565b6001600160a01b038116811461020657600080fd5b50565b60008060008060006080868803121561022157600080fd5b853561022c816101f1565b9450602086013561023c816101f1565b935060408601359250606086013567ffffffffffffffff8082111561026057600080fd5b818801915088601f83011261027457600080fd5b81358181111561028357600080fd5b89602082850101111561029557600080fd5b9699959850939650602001949392505050565b6000602082840312156102ba57600080fd5b815180151581146102ca57600080fd5b9392505050565b60018060a01b038316815260006020604081840152835180604085015260005b8181101561030d578581018301518582016060015282016102f1565b506000606082860101526060601f19601f830116850101925050509392505050565b60006020828403121561034157600080fd5b5051919050565b86151560f81b815260006bffffffffffffffffffffffff19808860601b166001840152808760601b166015840152508460298301528284604984013750600091016049019081529594505050505056fea26469706673582212205635c4a24e9e9f5e128a69b633d53f24838d8833b76e4fca1f3bf3b490e380c664736f6c63430008130033", - "devdoc": { - "kind": "dev", - "methods": { - "constructor": { - "params": { - "_inputBox": "The input box used by the portal" - } - }, - "depositERC20Tokens(address,address,uint256,bytes)": { - "params": { - "_amount": "The amount of tokens to be transferred", - "_dapp": "The address of the DApp", - "_execLayerData": "Additional data to be interpreted by the execution layer", - "_token": "The ERC-20 token contract" - } - }, - "getInputBox()": { - "returns": { - "_0": "The input box" - } - } - }, - "title": "ERC-20 Portal", - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "constructor": { - "notice": "Constructs the portal." - }, - "depositERC20Tokens(address,address,uint256,bytes)": { - "notice": "Transfer ERC-20 tokens to a DApp and add an input to the DApp's input box to signal such operation. The caller must allow the portal to withdraw at least `_amount` tokens from their account beforehand, by calling the `approve` function in the token contract." - }, - "getInputBox()": { - "notice": "Get the input box used by this input relay." - } - }, - "notice": "This contract allows anyone to perform transfers of ERC-20 tokens to a DApp while informing the off-chain machine.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/deployments/arbitrum/ERC721Portal.json b/deployments/arbitrum/ERC721Portal.json deleted file mode 100644 index 472af270e..000000000 --- a/deployments/arbitrum/ERC721Portal.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "address": "0x237F8DD094C0e47f4236f12b4Fa01d6Dae89fb87", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC721", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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": "0x85b75ae4657d7f3197d52478f31e689eedddb4c06c7b641d084fdfccb66e114d", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 2, - "gasUsed": "3249513", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xe6ac00399b16bf60deb239e13e0bfecb87e0f82e111bdcd271cfef3339c95838", - "transactionHash": "0x85b75ae4657d7f3197d52478f31e689eedddb4c06c7b641d084fdfccb66e114d", - "logs": [], - "blockNumber": 115470651, - "cumulativeGasUsed": "4807711", - "status": 1, - "byzantium": true - }, - "args": [ - "0x59b22D57D4f067708AB0c00552767405926dc768" - ], - "numDeployments": 1, - "solcInputHash": "d2696284402b6703b2d41170c93ef3b7", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"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\":\"_dapp\",\"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\":{\"_baseLayerData\":\"Additional data to be interpreted by the base layer\",\"_dapp\":\"The address of the DApp\",\"_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 a DApp and add an input to the DApp'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 input relay.\"}},\"notice\":\"This contract allows anyone to perform transfers of ERC-721 tokens to a DApp 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 v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token 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 amount 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 `amount` tokens of token type `id` from `from` to `to`.\\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 `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 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` 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 amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon 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 caller.\\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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"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 and relays.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Ether being sent in Wei\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\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 ret The return value of `transferFrom`\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param amount The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\n function encodeERC20Deposit(\\n bool ret,\\n IERC20 token,\\n address sender,\\n uint256 amount,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n ret, // 1B\\n token, // 20B\\n sender, // 20B\\n amount, // 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\\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\\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\\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 /// @notice Encode a DApp address relay.\\n /// @param dapp The DApp address\\n /// @return The encoded input\\n function encodeDAppAddressRelay(\\n address dapp\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n dapp // 20B\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5dce266a7b70ba86adf6a728c7667255d3e2b20f1789a951150a1d05439b7019\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputRelay.sol\":{\"content\":\"// (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 \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay interface\\ninterface IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this input relay.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x8c9316c43cc2c7754fbd5abccfcdbc5ed09a2f1228d993240eac6c41ea531521\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/InputRelay.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputRelay} from \\\"./IInputRelay.sol\\\";\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay\\n/// @notice This contract serves as a base for all the other input relays.\\ncontract InputRelay is IInputRelay {\\n /// @notice The input box used by the input relay.\\n IInputBox internal immutable inputBox;\\n\\n /// @notice Constructs the input relay.\\n /// @param _inputBox The input box used by the input relay\\n constructor(IInputBox _inputBox) {\\n inputBox = _inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return inputBox;\\n }\\n}\\n\",\"keccak256\":\"0xbb489f157a0bd7a9da29b0bf3c47c4b4051d90ccd252abc3f81c8e897329e590\",\"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 {InputRelay} from \\\"../inputs/InputRelay.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 a DApp while informing the off-chain machine.\\ncontract ERC721Portal is InputRelay, IERC721Portal {\\n /// @notice Constructs the portal.\\n /// @param _inputBox The input box used by the portal\\n constructor(IInputBox _inputBox) InputRelay(_inputBox) {}\\n\\n function depositERC721Token(\\n IERC721 _token,\\n address _dapp,\\n uint256 _tokenId,\\n bytes calldata _baseLayerData,\\n bytes calldata _execLayerData\\n ) external override {\\n _token.safeTransferFrom(msg.sender, _dapp, _tokenId, _baseLayerData);\\n\\n bytes memory input = InputEncoding.encodeERC721Deposit(\\n _token,\\n msg.sender,\\n _tokenId,\\n _baseLayerData,\\n _execLayerData\\n );\\n\\n inputBox.addInput(_dapp, input);\\n }\\n}\\n\",\"keccak256\":\"0xe402b9ad4394ceb4e6bc0a0fe9df7fa0f9ee46709b8046ed50fe2f83ab259a9e\",\"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 {IInputRelay} from \\\"../inputs/IInputRelay.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title ERC-721 Portal interface\\ninterface IERC721Portal is IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Transfer an ERC-721 token to a DApp and add an input to\\n /// the DApp'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 _dapp The address of the DApp\\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 _dapp,\\n uint256 _tokenId,\\n bytes calldata _baseLayerData,\\n bytes calldata _execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0x9da43aa0b2c19659dd96c244ce260760d7c1c675aaec85feacd322d35b8e1844\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b5060405161052438038061052483398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b60805161049361009160003960008181603c015261011d01526104936000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806328911e8314610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a610085366004610263565b61008c565b005b604051635c46a7ef60e11b81526001600160a01b0388169063b88d4fde906100c09033908a908a908a908a9060040161032b565b600060405180830381600087803b1580156100da57600080fd5b505af11580156100ee573d6000803e3d6000fd5b505050506000610103883388888888886101a2565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd6390610154908a90859060040161038e565b6020604051808303816000875af1158015610173573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019791906103d0565b505050505050505050565b60606000858585856040516020016101bd94939291906103e9565b6040516020818303038152906040529050888888836040516020016101e59493929190610410565b604051602081830303815290604052915050979650505050505050565b6001600160a01b038116811461021757600080fd5b50565b60008083601f84011261022c57600080fd5b50813567ffffffffffffffff81111561024457600080fd5b60208301915083602082850101111561025c57600080fd5b9250929050565b600080600080600080600060a0888a03121561027e57600080fd5b873561028981610202565b9650602088013561029981610202565b955060408801359450606088013567ffffffffffffffff808211156102bd57600080fd5b6102c98b838c0161021a565b909650945060808a01359150808211156102e257600080fd5b506102ef8a828b0161021a565b989b979a50959850939692959293505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038681168252851660208201526040810184905260806060820181905260009061035f9083018486610302565b979650505050505050565b60005b8381101561038557818101518382015260200161036d565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526103bb81606085016020870161036a565b601f01601f1916919091016060019392505050565b6000602082840312156103e257600080fd5b5051919050565b6040815260006103fd604083018688610302565b828103602084015261035f818587610302565b60006bffffffffffffffffffffffff19808760601b168352808660601b16601484015250836028830152825161044d81604885016020870161036a565b919091016048019594505050505056fea2646970667358221220c2c237b79e46918de25850a3a3944f2f3cce2d65223f9c2c4e6fefb21e70609864736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806328911e8314610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a610085366004610263565b61008c565b005b604051635c46a7ef60e11b81526001600160a01b0388169063b88d4fde906100c09033908a908a908a908a9060040161032b565b600060405180830381600087803b1580156100da57600080fd5b505af11580156100ee573d6000803e3d6000fd5b505050506000610103883388888888886101a2565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd6390610154908a90859060040161038e565b6020604051808303816000875af1158015610173573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019791906103d0565b505050505050505050565b60606000858585856040516020016101bd94939291906103e9565b6040516020818303038152906040529050888888836040516020016101e59493929190610410565b604051602081830303815290604052915050979650505050505050565b6001600160a01b038116811461021757600080fd5b50565b60008083601f84011261022c57600080fd5b50813567ffffffffffffffff81111561024457600080fd5b60208301915083602082850101111561025c57600080fd5b9250929050565b600080600080600080600060a0888a03121561027e57600080fd5b873561028981610202565b9650602088013561029981610202565b955060408801359450606088013567ffffffffffffffff808211156102bd57600080fd5b6102c98b838c0161021a565b909650945060808a01359150808211156102e257600080fd5b506102ef8a828b0161021a565b989b979a50959850939692959293505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038681168252851660208201526040810184905260806060820181905260009061035f9083018486610302565b979650505050505050565b60005b8381101561038557818101518382015260200161036d565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526103bb81606085016020870161036a565b601f01601f1916919091016060019392505050565b6000602082840312156103e257600080fd5b5051919050565b6040815260006103fd604083018688610302565b828103602084015261035f818587610302565b60006bffffffffffffffffffffffff19808760601b168352808660601b16601484015250836028830152825161044d81604885016020870161036a565b919091016048019594505050505056fea2646970667358221220c2c237b79e46918de25850a3a3944f2f3cce2d65223f9c2c4e6fefb21e70609864736f6c63430008130033", - "devdoc": { - "kind": "dev", - "methods": { - "constructor": { - "params": { - "_inputBox": "The input box used by the portal" - } - }, - "depositERC721Token(address,address,uint256,bytes,bytes)": { - "params": { - "_baseLayerData": "Additional data to be interpreted by the base layer", - "_dapp": "The address of the DApp", - "_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 a DApp and add an input to the DApp'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 input relay." - } - }, - "notice": "This contract allows anyone to perform transfers of ERC-721 tokens to a DApp while informing the off-chain machine.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/deployments/arbitrum/EtherPortal.json b/deployments/arbitrum/EtherPortal.json deleted file mode 100644 index 7f81f7932..000000000 --- a/deployments/arbitrum/EtherPortal.json +++ /dev/null @@ -1,127 +0,0 @@ -{ - "address": "0xFfdbe43d4c855BF7e0f105c400A50857f53AB044", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "EtherTransferFailed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "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": "0x43e93cdf673af5aa09b96e8484c660d16c8f71dff453d9f243c550ea3194febc", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 2, - "gasUsed": "2742334", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x7e89950691633d25d22415f45aaf0dce1827d2913cbcb0f8eff253f59c56262b", - "transactionHash": "0x43e93cdf673af5aa09b96e8484c660d16c8f71dff453d9f243c550ea3194febc", - "logs": [], - "blockNumber": 115470631, - "cumulativeGasUsed": "3056164", - "status": 1, - "byzantium": true - }, - "args": [ - "0x59b22D57D4f067708AB0c00552767405926dc768" - ], - "numDeployments": 1, - "solcInputHash": "d2696284402b6703b2d41170c93ef3b7", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"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\":\"_dapp\",\"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\":\"All the value sent through this function is forwarded to the DApp. If the transfer fails, `EtherTransferFailed` error is raised.\",\"params\":{\"_dapp\":\"The address of the DApp\",\"_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\":\"Raised when the Ether transfer fails.\"}]},\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs the portal.\"},\"depositEther(address,bytes)\":{\"notice\":\"Transfer Ether to a DApp and add an input to the DApp's input box to signal such operation. All the value sent through this function is forwarded to the DApp.\"},\"getInputBox()\":{\"notice\":\"Get the input box used by this input relay.\"}},\"notice\":\"This contract allows anyone to perform transfers of Ether to a DApp 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 v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token 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 amount 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 `amount` tokens of token type `id` from `from` to `to`.\\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 `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 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` 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 amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon 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 caller.\\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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"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 and relays.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Ether being sent in Wei\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\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 ret The return value of `transferFrom`\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param amount The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\n function encodeERC20Deposit(\\n bool ret,\\n IERC20 token,\\n address sender,\\n uint256 amount,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n ret, // 1B\\n token, // 20B\\n sender, // 20B\\n amount, // 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\\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\\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\\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 /// @notice Encode a DApp address relay.\\n /// @param dapp The DApp address\\n /// @return The encoded input\\n function encodeDAppAddressRelay(\\n address dapp\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n dapp // 20B\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5dce266a7b70ba86adf6a728c7667255d3e2b20f1789a951150a1d05439b7019\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputRelay.sol\":{\"content\":\"// (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 \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay interface\\ninterface IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this input relay.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x8c9316c43cc2c7754fbd5abccfcdbc5ed09a2f1228d993240eac6c41ea531521\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/InputRelay.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputRelay} from \\\"./IInputRelay.sol\\\";\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay\\n/// @notice This contract serves as a base for all the other input relays.\\ncontract InputRelay is IInputRelay {\\n /// @notice The input box used by the input relay.\\n IInputBox internal immutable inputBox;\\n\\n /// @notice Constructs the input relay.\\n /// @param _inputBox The input box used by the input relay\\n constructor(IInputBox _inputBox) {\\n inputBox = _inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return inputBox;\\n }\\n}\\n\",\"keccak256\":\"0xbb489f157a0bd7a9da29b0bf3c47c4b4051d90ccd252abc3f81c8e897329e590\",\"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 {InputRelay} from \\\"../inputs/InputRelay.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 a DApp while informing the off-chain machine.\\ncontract EtherPortal is InputRelay, IEtherPortal {\\n /// @notice Raised when the Ether transfer fails.\\n error EtherTransferFailed();\\n\\n /// @notice Constructs the portal.\\n /// @param _inputBox The input box used by the portal\\n constructor(IInputBox _inputBox) InputRelay(_inputBox) {}\\n\\n function depositEther(\\n address _dapp,\\n bytes calldata _execLayerData\\n ) external payable override {\\n // We used to call `transfer()` but it's not considered safe,\\n // as it assumes gas costs are immutable (they are not).\\n (bool success, ) = _dapp.call{value: msg.value}(\\\"\\\");\\n\\n if (!success) {\\n revert EtherTransferFailed();\\n }\\n\\n bytes memory input = InputEncoding.encodeEtherDeposit(\\n msg.sender,\\n msg.value,\\n _execLayerData\\n );\\n\\n inputBox.addInput(_dapp, input);\\n }\\n}\\n\",\"keccak256\":\"0x47950c335ae2d0dd03b680d6fcd9cb26aa1333ecf6772b1f3a71a80100b8b34c\",\"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 {IInputRelay} from \\\"../inputs/IInputRelay.sol\\\";\\n\\n/// @title Ether Portal interface\\ninterface IEtherPortal is IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Transfer Ether to a DApp and add an input to\\n /// the DApp's input box to signal such operation.\\n ///\\n /// All the value sent through this function is forwarded to the DApp.\\n ///\\n /// @param _dapp The address of the DApp\\n /// @param _execLayerData Additional data to be interpreted by the execution layer\\n /// @dev All the value sent through this function is forwarded to the DApp.\\n /// If the transfer fails, `EtherTransferFailed` error is raised.\\n function depositEther(\\n address _dapp,\\n bytes calldata _execLayerData\\n ) external payable;\\n}\\n\",\"keccak256\":\"0xa8bdb1f91935db3d7ba158935164e61f042da26a9abe872edccbff28614d9143\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b506040516103de3803806103de83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b60805161034d61009160003960008181603c0152610128015261034d6000f3fe6080604052600436106100285760003560e01c8062aace9a1461002d578063938c054f14610077575b600080fd5b34801561003957600080fd5b507f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a6100853660046101dc565b61008c565b005b6000836001600160a01b03163460405160006040518083038185875af1925050503d80600081146100d9576040519150601f19603f3d011682016040523d82523d6000602084013e6100de565b606091505b505090508061010057604051630ce8f45160e31b815260040160405180910390fd5b600061010e333486866101aa565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061015f908890859060040161026d565b6020604051808303816000875af115801561017e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a291906102cb565b505050505050565b6060848484846040516020016101c394939291906102e4565b6040516020818303038152906040529050949350505050565b6000806000604084860312156101f157600080fd5b83356001600160a01b038116811461020857600080fd5b9250602084013567ffffffffffffffff8082111561022557600080fd5b818601915086601f83011261023957600080fd5b81358181111561024857600080fd5b87602082850101111561025a57600080fd5b6020830194508093505050509250925092565b60018060a01b038316815260006020604081840152835180604085015260005b818110156102a95785810183015185820160600152820161028d565b506000606082860101526060601f19601f830116850101925050509392505050565b6000602082840312156102dd57600080fd5b5051919050565b6bffffffffffffffffffffffff198560601b1681528360148201528183603483013760009101603401908152939250505056fea26469706673582212203555bb6cf9b2020729bb19c561673a225f367cd3219906075930d8b9f3fb219864736f6c63430008130033", - "deployedBytecode": "0x6080604052600436106100285760003560e01c8062aace9a1461002d578063938c054f14610077575b600080fd5b34801561003957600080fd5b507f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a6100853660046101dc565b61008c565b005b6000836001600160a01b03163460405160006040518083038185875af1925050503d80600081146100d9576040519150601f19603f3d011682016040523d82523d6000602084013e6100de565b606091505b505090508061010057604051630ce8f45160e31b815260040160405180910390fd5b600061010e333486866101aa565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061015f908890859060040161026d565b6020604051808303816000875af115801561017e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a291906102cb565b505050505050565b6060848484846040516020016101c394939291906102e4565b6040516020818303038152906040529050949350505050565b6000806000604084860312156101f157600080fd5b83356001600160a01b038116811461020857600080fd5b9250602084013567ffffffffffffffff8082111561022557600080fd5b818601915086601f83011261023957600080fd5b81358181111561024857600080fd5b87602082850101111561025a57600080fd5b6020830194508093505050509250925092565b60018060a01b038316815260006020604081840152835180604085015260005b818110156102a95785810183015185820160600152820161028d565b506000606082860101526060601f19601f830116850101925050509392505050565b6000602082840312156102dd57600080fd5b5051919050565b6bffffffffffffffffffffffff198560601b1681528360148201528183603483013760009101603401908152939250505056fea26469706673582212203555bb6cf9b2020729bb19c561673a225f367cd3219906075930d8b9f3fb219864736f6c63430008130033", - "devdoc": { - "kind": "dev", - "methods": { - "constructor": { - "params": { - "_inputBox": "The input box used by the portal" - } - }, - "depositEther(address,bytes)": { - "details": "All the value sent through this function is forwarded to the DApp. If the transfer fails, `EtherTransferFailed` error is raised.", - "params": { - "_dapp": "The address of the DApp", - "_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": "Raised when the Ether transfer fails." - } - ] - }, - "kind": "user", - "methods": { - "constructor": { - "notice": "Constructs the portal." - }, - "depositEther(address,bytes)": { - "notice": "Transfer Ether to a DApp and add an input to the DApp's input box to signal such operation. All the value sent through this function is forwarded to the DApp." - }, - "getInputBox()": { - "notice": "Get the input box used by this input relay." - } - }, - "notice": "This contract allows anyone to perform transfers of Ether to a DApp while informing the off-chain machine.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/deployments/arbitrum/InputBox.json b/deployments/arbitrum/InputBox.json deleted file mode 100644 index 150cc4e03..000000000 --- a/deployments/arbitrum/InputBox.json +++ /dev/null @@ -1,246 +0,0 @@ -{ - "address": "0x59b22D57D4f067708AB0c00552767405926dc768", - "abi": [ - { - "inputs": [], - "name": "InputSizeExceedsLimit", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "dapp", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "inputIndex", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "input", - "type": "bytes" - } - ], - "name": "InputAdded", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_input", - "type": "bytes" - } - ], - "name": "addInput", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "getInputHash", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - } - ], - "name": "getNumberOfInputs", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "transactionHash": "0x69a5c10983dc655320482c64fe148091d16d17fa5f5681a06027bf45a4fbda3f", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 2, - "gasUsed": "2770275", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xb9fbcd29bbb06bc5fac73a9cb76c428d00634176ea967832a3af555625442143", - "transactionHash": "0x69a5c10983dc655320482c64fe148091d16d17fa5f5681a06027bf45a4fbda3f", - "logs": [], - "blockNumber": 115470622, - "cumulativeGasUsed": "4331042", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 1, - "solcInputHash": "d2696284402b6703b2d41170c93ef3b7", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"InputSizeExceedsLimit\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"dapp\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"inputIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"input\",\"type\":\"bytes\"}],\"name\":\"InputAdded\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_dapp\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_input\",\"type\":\"bytes\"}],\"name\":\"addInput\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_dapp\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"getInputHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_dapp\",\"type\":\"address\"}],\"name\":\"getNumberOfInputs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"InputAdded(address,uint256,address,bytes)\":{\"details\":\"MUST be triggered on a successful call to `addInput`.\",\"params\":{\"dapp\":\"The address of the DApp\",\"input\":\"The contents of the input\",\"inputIndex\":\"The index of the input in the input box\",\"sender\":\"The address that sent the input\"}}},\"kind\":\"dev\",\"methods\":{\"addInput(address,bytes)\":{\"details\":\"MUST fire an `InputAdded` event accordingly. Input larger than machine limit will raise `InputSizeExceedsLimit` error.\",\"params\":{\"_dapp\":\"The address of the DApp\",\"_input\":\"The contents of the input\"},\"returns\":{\"_0\":\"The hash of the input plus some extra metadata\"}},\"getInputHash(address,uint256)\":{\"details\":\"`_index` MUST be in the interval `[0,n)` where `n` is the number of inputs in the DApp's input box. See the `getNumberOfInputs` function.\",\"params\":{\"_dapp\":\"The address of the DApp\",\"_index\":\"The index of the input in the DApp's input box\"},\"returns\":{\"_0\":\"The hash of the input at the provided index in the DApp's input box\"}},\"getNumberOfInputs(address)\":{\"params\":{\"_dapp\":\"The address of the DApp\"},\"returns\":{\"_0\":\"Number of inputs in the DApp's input box\"}}},\"stateVariables\":{\"inputBoxes\":{\"details\":\"See the `getNumberOfInputs`, `getInputHash` and `addInput` functions.\"}},\"title\":\"Input Box\",\"version\":1},\"userdoc\":{\"errors\":{\"InputSizeExceedsLimit()\":[{\"notice\":\"Raised when input is larger than the machine limit.\"}]},\"events\":{\"InputAdded(address,uint256,address,bytes)\":{\"notice\":\"Emitted when an input is added to a DApp's input box.\"}},\"kind\":\"user\",\"methods\":{\"addInput(address,bytes)\":{\"notice\":\"Add an input to a DApp's input box.\"},\"getInputHash(address,uint256)\":{\"notice\":\"Get the hash of an input in a DApp's input box.\"},\"getNumberOfInputs(address)\":{\"notice\":\"Get the number of inputs in a DApp's input box.\"}},\"notice\":\"Trustless and permissionless contract that receives arbitrary blobs (called \\\"inputs\\\") from anyone and adds a compound hash to an append-only list (called \\\"input box\\\"). Each DApp has its own input box. The hash that is stored on-chain is composed by the hash of the input blob, the block number and timestamp, the input sender address, and the input index. Data availability is guaranteed by the emission of `InputAdded` events on every successful call to `addInput`. This ensures that inputs can be retrieved by anyone at any time, without having to rely on centralized data providers. From the perspective of this contract, inputs are encoding-agnostic byte arrays. It is up to the DApp to interpret, validate and act upon inputs.\",\"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 Base-2 logarithm of number of bytes.\\n type Log2Size is uint64;\\n\\n /// @notice Machine word size (8 bytes).\\n Log2Size constant WORD_LOG2_SIZE = Log2Size.wrap(3);\\n\\n /// @notice Machine address space size (2^64 bytes).\\n Log2Size constant MACHINE_LOG2_SIZE = Log2Size.wrap(64);\\n\\n /// @notice Keccak-256 output size (32 bytes).\\n Log2Size constant KECCAK_LOG2_SIZE = Log2Size.wrap(5);\\n\\n /// @notice Maximum input size (~2 megabytes).\\n /// @dev The offset and size fields use up the extra 64 bytes.\\n uint256 constant INPUT_MAX_SIZE = (1 << 21) - 64;\\n\\n /// @notice Maximum voucher metadata memory range (2 megabytes).\\n Log2Size constant VOUCHER_METADATA_LOG2_SIZE = Log2Size.wrap(21);\\n\\n /// @notice Maximum notice metadata memory range (2 megabytes).\\n Log2Size constant NOTICE_METADATA_LOG2_SIZE = Log2Size.wrap(21);\\n\\n /// @notice Maximum epoch voucher memory range (128 megabytes).\\n Log2Size constant EPOCH_VOUCHER_LOG2_SIZE = Log2Size.wrap(37);\\n\\n /// @notice Maximum epoch notice memory range (128 megabytes).\\n Log2Size constant EPOCH_NOTICE_LOG2_SIZE = Log2Size.wrap(37);\\n\\n /// @notice Unwrap `s` into its underlying uint64 value.\\n /// @param s Base-2 logarithm of some number of bytes\\n function uint64OfSize(Log2Size s) internal pure returns (uint64) {\\n return Log2Size.unwrap(s);\\n }\\n\\n /// @notice Return the position of an intra memory range on a memory range\\n /// with contents with the same size.\\n /// @param index Index of intra memory range\\n /// @param log2Size Base-2 logarithm of intra memory range size\\n function getIntraMemoryRangePosition(\\n uint64 index,\\n Log2Size log2Size\\n ) internal pure returns (uint64) {\\n return index << Log2Size.unwrap(log2Size);\\n }\\n}\\n\",\"keccak256\":\"0x97cdce56cdb4f0b4164e6be3a72e50469a3124e4716e753a1792aa70eac614f5\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"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.8;\\n\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\nimport {LibInput} from \\\"../library/LibInput.sol\\\";\\n\\n/// @title Input Box\\n///\\n/// @notice Trustless and permissionless contract that receives arbitrary blobs\\n/// (called \\\"inputs\\\") from anyone and adds a compound hash to an append-only list\\n/// (called \\\"input box\\\"). Each DApp has its own input box.\\n///\\n/// The hash that is stored on-chain is composed by the hash of the input blob,\\n/// the block number and timestamp, the input sender address, and the input index.\\n///\\n/// Data availability is guaranteed by the emission of `InputAdded` events\\n/// on every successful call to `addInput`. This ensures that inputs can be\\n/// retrieved by anyone at any time, without having to rely on centralized data\\n/// providers.\\n///\\n/// From the perspective of this contract, inputs are encoding-agnostic byte\\n/// arrays. It is up to the DApp to interpret, validate and act upon inputs.\\ncontract InputBox is IInputBox {\\n /// @notice Mapping from DApp address to list of input hashes.\\n /// @dev See the `getNumberOfInputs`, `getInputHash` and `addInput` functions.\\n mapping(address => bytes32[]) internal inputBoxes;\\n\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external override returns (bytes32) {\\n bytes32[] storage inputBox = inputBoxes[_dapp];\\n uint256 inputIndex = inputBox.length;\\n\\n bytes32 inputHash = LibInput.computeInputHash(\\n msg.sender,\\n block.number,\\n block.timestamp,\\n _input,\\n inputIndex\\n );\\n\\n // add input to the input box\\n inputBox.push(inputHash);\\n\\n // block.number and timestamp can be retrieved by the event metadata itself\\n emit InputAdded(_dapp, inputIndex, msg.sender, _input);\\n\\n return inputHash;\\n }\\n\\n function getNumberOfInputs(\\n address _dapp\\n ) external view override returns (uint256) {\\n return inputBoxes[_dapp].length;\\n }\\n\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view override returns (bytes32) {\\n return inputBoxes[_dapp][_index];\\n }\\n}\\n\",\"keccak256\":\"0x83d36baf0bda5a63ea5eae7e021b80eabb30f9ace14fcdb5936f0e27b779fccb\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/library/LibInput.sol\":{\"content\":\"// (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\\\";\\n\\n/// @title Input Library\\nlibrary LibInput {\\n using CanonicalMachine for CanonicalMachine.Log2Size;\\n\\n /// @notice Raised when input is larger than the machine limit.\\n error InputSizeExceedsLimit();\\n\\n /// @notice Summarize input data in a single hash.\\n /// @param sender `msg.sender`\\n /// @param blockNumber `block.number`\\n /// @param blockTimestamp `block.timestamp`\\n /// @param input The input blob\\n /// @param inputIndex The index of the input in the input box\\n /// @return The input hash\\n function computeInputHash(\\n address sender,\\n uint256 blockNumber,\\n uint256 blockTimestamp,\\n bytes calldata input,\\n uint256 inputIndex\\n ) internal pure returns (bytes32) {\\n if (input.length > CanonicalMachine.INPUT_MAX_SIZE) {\\n revert InputSizeExceedsLimit();\\n }\\n\\n bytes32 keccakMetadata = keccak256(\\n abi.encode(\\n sender,\\n blockNumber,\\n blockTimestamp,\\n 0, //TODO decide how to deal with epoch index\\n inputIndex // input index in the input box\\n )\\n );\\n\\n bytes32 keccakInput = keccak256(input);\\n\\n return keccak256(abi.encode(keccakMetadata, keccakInput));\\n }\\n}\\n\",\"keccak256\":\"0x27f2fe9efc2f6fc85687ea78e5c79a090c46ece27e7bb26e0c184a3fef62317a\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506103be806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80631789cd631461004657806361a93c871461006b578063677087c914610094575b600080fd5b610059610054366004610253565b6100a7565b60405190815260200160405180910390f35b6100596100793660046102d6565b6001600160a01b031660009081526020819052604090205490565b6100596100a23660046102f8565b61013b565b6001600160a01b03831660009081526020819052604081208054826100d0334342898987610178565b83546001810185556000858152602090200181905560405190915082906001600160a01b038916907f6aaa400068bf4ca337265e2a1e1e841f66b8597fd5b452fdc52a44bed28a0784906101299033908b908b90610322565b60405180910390a39695505050505050565b6001600160a01b038216600090815260208190526040812080548390811061016557610165610362565b9060005260206000200154905092915050565b6000621fffc083111561019e57604051634273a49560e11b815260040160405180910390fd5b604080516001600160a01b03891660208201529081018790526060810186905260006080820181905260a082018490529060c001604051602081830303815290604052805190602001209050600085856040516101fc929190610378565b604080519182900382206020808401959095528282015280518083038201815260609092019052805192019190912098975050505050505050565b80356001600160a01b038116811461024e57600080fd5b919050565b60008060006040848603121561026857600080fd5b61027184610237565b9250602084013567ffffffffffffffff8082111561028e57600080fd5b818601915086601f8301126102a257600080fd5b8135818111156102b157600080fd5b8760208285010111156102c357600080fd5b6020830194508093505050509250925092565b6000602082840312156102e857600080fd5b6102f182610237565b9392505050565b6000806040838503121561030b57600080fd5b61031483610237565b946020939093013593505050565b6001600160a01b03841681526040602082018190528101829052818360608301376000818301606090810191909152601f909201601f1916010192915050565b634e487b7160e01b600052603260045260246000fd5b818382376000910190815291905056fea264697066735822122043b0a58952371efb5f75573ec65e82305da7154e6338f4e9c00f5cc07f92c4af64736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80631789cd631461004657806361a93c871461006b578063677087c914610094575b600080fd5b610059610054366004610253565b6100a7565b60405190815260200160405180910390f35b6100596100793660046102d6565b6001600160a01b031660009081526020819052604090205490565b6100596100a23660046102f8565b61013b565b6001600160a01b03831660009081526020819052604081208054826100d0334342898987610178565b83546001810185556000858152602090200181905560405190915082906001600160a01b038916907f6aaa400068bf4ca337265e2a1e1e841f66b8597fd5b452fdc52a44bed28a0784906101299033908b908b90610322565b60405180910390a39695505050505050565b6001600160a01b038216600090815260208190526040812080548390811061016557610165610362565b9060005260206000200154905092915050565b6000621fffc083111561019e57604051634273a49560e11b815260040160405180910390fd5b604080516001600160a01b03891660208201529081018790526060810186905260006080820181905260a082018490529060c001604051602081830303815290604052805190602001209050600085856040516101fc929190610378565b604080519182900382206020808401959095528282015280518083038201815260609092019052805192019190912098975050505050505050565b80356001600160a01b038116811461024e57600080fd5b919050565b60008060006040848603121561026857600080fd5b61027184610237565b9250602084013567ffffffffffffffff8082111561028e57600080fd5b818601915086601f8301126102a257600080fd5b8135818111156102b157600080fd5b8760208285010111156102c357600080fd5b6020830194508093505050509250925092565b6000602082840312156102e857600080fd5b6102f182610237565b9392505050565b6000806040838503121561030b57600080fd5b61031483610237565b946020939093013593505050565b6001600160a01b03841681526040602082018190528101829052818360608301376000818301606090810191909152601f909201601f1916010192915050565b634e487b7160e01b600052603260045260246000fd5b818382376000910190815291905056fea264697066735822122043b0a58952371efb5f75573ec65e82305da7154e6338f4e9c00f5cc07f92c4af64736f6c63430008130033", - "devdoc": { - "events": { - "InputAdded(address,uint256,address,bytes)": { - "details": "MUST be triggered on a successful call to `addInput`.", - "params": { - "dapp": "The address of the DApp", - "input": "The contents of the input", - "inputIndex": "The index of the input in the input box", - "sender": "The address that sent the input" - } - } - }, - "kind": "dev", - "methods": { - "addInput(address,bytes)": { - "details": "MUST fire an `InputAdded` event accordingly. Input larger than machine limit will raise `InputSizeExceedsLimit` error.", - "params": { - "_dapp": "The address of the DApp", - "_input": "The contents of the input" - }, - "returns": { - "_0": "The hash of the input plus some extra metadata" - } - }, - "getInputHash(address,uint256)": { - "details": "`_index` MUST be in the interval `[0,n)` where `n` is the number of inputs in the DApp's input box. See the `getNumberOfInputs` function.", - "params": { - "_dapp": "The address of the DApp", - "_index": "The index of the input in the DApp's input box" - }, - "returns": { - "_0": "The hash of the input at the provided index in the DApp's input box" - } - }, - "getNumberOfInputs(address)": { - "params": { - "_dapp": "The address of the DApp" - }, - "returns": { - "_0": "Number of inputs in the DApp's input box" - } - } - }, - "stateVariables": { - "inputBoxes": { - "details": "See the `getNumberOfInputs`, `getInputHash` and `addInput` functions." - } - }, - "title": "Input Box", - "version": 1 - }, - "userdoc": { - "errors": { - "InputSizeExceedsLimit()": [ - { - "notice": "Raised when input is larger than the machine limit." - } - ] - }, - "events": { - "InputAdded(address,uint256,address,bytes)": { - "notice": "Emitted when an input is added to a DApp's input box." - } - }, - "kind": "user", - "methods": { - "addInput(address,bytes)": { - "notice": "Add an input to a DApp's input box." - }, - "getInputHash(address,uint256)": { - "notice": "Get the hash of an input in a DApp's input box." - }, - "getNumberOfInputs(address)": { - "notice": "Get the number of inputs in a DApp's input box." - } - }, - "notice": "Trustless and permissionless contract that receives arbitrary blobs (called \"inputs\") from anyone and adds a compound hash to an append-only list (called \"input box\"). Each DApp has its own input box. The hash that is stored on-chain is composed by the hash of the input blob, the block number and timestamp, the input sender address, and the input index. Data availability is guaranteed by the emission of `InputAdded` events on every successful call to `addInput`. This ensures that inputs can be retrieved by anyone at any time, without having to rely on centralized data providers. From the perspective of this contract, inputs are encoding-agnostic byte arrays. It is up to the DApp to interpret, validate and act upon inputs.", - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 3451, - "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/.chainId b/deployments/arbitrum_sepolia/.chainId deleted file mode 100644 index 71ba4d632..000000000 --- a/deployments/arbitrum_sepolia/.chainId +++ /dev/null @@ -1 +0,0 @@ -421614 \ No newline at end of file diff --git a/deployments/arbitrum_sepolia/AuthorityFactory.json b/deployments/arbitrum_sepolia/AuthorityFactory.json deleted file mode 100644 index 5c25311a1..000000000 --- a/deployments/arbitrum_sepolia/AuthorityFactory.json +++ /dev/null @@ -1,183 +0,0 @@ -{ - "address": "0xf26a5b278C25D8D41A136d22Ad719EACEd9c3e63", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "authorityOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract Authority", - "name": "authority", - "type": "address" - } - ], - "name": "AuthorityCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateAuthorityAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newAuthority", - "outputs": [ - { - "internalType": "contract Authority", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - } - ], - "name": "newAuthority", - "outputs": [ - { - "internalType": "contract Authority", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0x57467653b9de5a9469187608509210d5eff361b2ab8116e4b50b561bd653b550", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", - "contractAddress": null, - "transactionIndex": 1, - "gasUsed": "756688", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5070b4cf918ba0f83f1c2a74543b487177f7b90a3511023a7095591f178dd884", - "transactionHash": "0x57467653b9de5a9469187608509210d5eff361b2ab8116e4b50b561bd653b550", - "logs": [], - "blockNumber": 2838783, - "cumulativeGasUsed": "756688", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 1, - "solcInputHash": "54ee33aea592269e6046663615f287b6", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"authorityOwner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract Authority\",\"name\":\"authority\",\"type\":\"address\"}],\"name\":\"AuthorityCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"calculateAuthorityAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"newAuthority\",\"outputs\":[{\"internalType\":\"contract Authority\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"}],\"name\":\"newAuthority\",\"outputs\":[{\"internalType\":\"contract Authority\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"AuthorityCreated(address,address)\":{\"details\":\"MUST be triggered on a successful call to `newAuthority`.\",\"params\":{\"authority\":\"The authority\",\"authorityOwner\":\"The initial authority owner\"}}},\"kind\":\"dev\",\"methods\":{\"calculateAuthorityAddress(address,bytes32)\":{\"details\":\"Beware that only the `newAuthority` function with the `_salt` parameter is able to deterministically deploy an authority.\",\"params\":{\"_authorityOwner\":\"The initial authority owner\",\"_salt\":\"The salt used to deterministically generate the authority address\"},\"returns\":{\"_0\":\"The deterministic authority address\"}},\"newAuthority(address)\":{\"details\":\"On success, MUST emit an `AuthorityCreated` event.\",\"params\":{\"_authorityOwner\":\"The initial authority owner\"},\"returns\":{\"_0\":\"The authority\"}},\"newAuthority(address,bytes32)\":{\"details\":\"On success, MUST emit an `AuthorityCreated` event.\",\"params\":{\"_authorityOwner\":\"The initial authority owner\",\"_salt\":\"The salt used to deterministically generate the authority address\"},\"returns\":{\"_0\":\"The authority\"}}},\"title\":\"Authority Factory\",\"version\":1},\"userdoc\":{\"events\":{\"AuthorityCreated(address,address)\":{\"notice\":\"A new authority was deployed.\"}},\"kind\":\"user\",\"methods\":{\"calculateAuthorityAddress(address,bytes32)\":{\"notice\":\"Calculate the address of an authority to be deployed deterministically.\"},\"newAuthority(address)\":{\"notice\":\"Deploy a new authority.\"},\"newAuthority(address,bytes32)\":{\"notice\":\"Deploy a new authority deterministically.\"}},\"notice\":\"Allows anyone to reliably deploy a new `Authority` contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/consensus/authority/AuthorityFactory.sol\":\"AuthorityFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\\n require(address(this).balance >= amount, \\\"Create2: insufficient balance\\\");\\n require(bytecode.length != 0, \\\"Create2: bytecode length is zero\\\");\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n require(addr != address(0), \\\"Create2: Failed on deploy\\\");\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6e00f269073ffc4350e56b7e8153c9092d5f70bfba423299990514183101ef89\",\"license\":\"MIT\"},\"contracts/consensus/AbstractConsensus.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IConsensus} from \\\"./IConsensus.sol\\\";\\n\\n/// @title Abstract Consensus\\n/// @notice An abstract contract that partially implements `IConsensus`.\\nabstract contract AbstractConsensus is IConsensus {\\n /// @notice Emits an `ApplicationJoined` event with the message sender.\\n function join() external override {\\n emit ApplicationJoined(msg.sender);\\n }\\n}\\n\",\"keccak256\":\"0xced9c940ccbbe81fbfcf3bc087c04b9ae90325d6bba68a8cee9ebfa3dd9d231d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/IConsensus.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @title Consensus interface\\n///\\n/// @notice This contract defines a generic interface for consensuses.\\n/// We use the word \\\"consensus\\\" to designate a contract that provides claims\\n/// in the base layer regarding the state of off-chain machines running in\\n/// the execution layer. How this contract is able to reach consensus, who is\\n/// able to submit claims, and how are claims stored in the base layer are\\n/// some of the implementation details left unspecified by this interface.\\n///\\n/// From the point of view of a DApp, these claims are necessary to validate\\n/// on-chain action allowed by the off-chain machine in the form of vouchers\\n/// and notices. Each claim is composed of three parts: an epoch hash, a first\\n/// index, and a last index. We'll explain each of these parts below.\\n///\\n/// First, let us define the word \\\"epoch\\\". For finality reasons, we need to\\n/// divide the stream of inputs being fed into the off-chain machine into\\n/// batches of inputs, which we call \\\"epoches\\\". At the end of every epoch,\\n/// we summarize the state of the off-chain machine in a single hash, called\\n/// \\\"epoch hash\\\". Please note that this interface does not define how this\\n/// stream of inputs is being chopped up into epoches.\\n///\\n/// The other two parts are simply the indices of the first and last inputs\\n/// accepted during the epoch. Logically, the first index MUST BE less than\\n/// or equal to the last index. As a result, every epoch MUST accept at least\\n/// one input. This assumption stems from the fact that the state of a machine\\n/// can only change after an input is fed into it.\\n///\\n/// Examples of possible implementations of this interface include:\\n///\\n/// * An authority consensus, controlled by a single address who has full\\n/// control over epoch boundaries, claim submission, asset management, etc.\\n///\\n/// * A quorum consensus, controlled by a limited set of validators, that\\n/// vote on the state of the machine at the end of every epoch. Also, epoch\\n/// boundaries are determined by the timestamp in the base layer, and assets\\n/// are split equally amongst the validators.\\n///\\n/// * An NxN consensus, which allows anyone to submit and dispute claims\\n/// in the base layer. Epoch boundaries are determined in the same fashion\\n/// as in the quorum example.\\n///\\ninterface IConsensus {\\n /// @notice An application has joined the consensus' validation set.\\n /// @param application The application\\n /// @dev MUST be triggered on a successful call to `join`.\\n event ApplicationJoined(address application);\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// The encoding of `_proofContext` might vary\\n /// depending on the implementation.\\n /// @param _dapp The DApp address\\n /// @param _proofContext Data for retrieving the desired claim\\n /// @return epochHash_ The claimed epoch hash\\n /// @return firstInputIndex_ The index of the first input of the epoch in the input box\\n /// @return lastInputIndex_ The index of the last input of the epoch in the input box\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n )\\n external\\n view\\n returns (\\n bytes32 epochHash_,\\n uint256 firstInputIndex_,\\n uint256 lastInputIndex_\\n );\\n\\n /// @notice Signal the consensus that the message sender wants to join its validation set.\\n /// @dev MUST fire an `ApplicationJoined` event with the message sender as argument.\\n function join() external;\\n}\\n\",\"keccak256\":\"0xc9d295fada66eb0602e0f1e2e236708e52f959927abb4ab6b04173a98b92ac16\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/Authority.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {IConsensus} from \\\"../IConsensus.sol\\\";\\nimport {AbstractConsensus} from \\\"../AbstractConsensus.sol\\\";\\nimport {IHistory} from \\\"../../history/IHistory.sol\\\";\\n\\n/// @title Authority consensus\\n/// @notice A consensus model controlled by a single address, the owner.\\n/// Claims are stored in an auxiliary contract called `History`.\\n/// @dev This contract inherits `AbstractConsensus` and OpenZeppelin's `Ownable` contract.\\n/// For more information on `Ownable`, please consult OpenZeppelin's official documentation.\\ncontract Authority is AbstractConsensus, Ownable {\\n /// @notice The current history contract.\\n /// @dev See the `getHistory` and `setHistory` functions.\\n IHistory internal history;\\n\\n /// @notice A new history contract is used to store claims.\\n /// @param history The new history contract\\n /// @dev MUST be triggered on a successful call to `setHistory`.\\n event NewHistory(IHistory history);\\n\\n /// @notice Raised when a transfer of tokens from an authority to a recipient fails.\\n error AuthorityWithdrawalFailed();\\n\\n /// @notice Constructs an `Authority` contract.\\n /// @param _owner The initial contract owner\\n constructor(address _owner) {\\n // constructor in Ownable already called `transferOwnership(msg.sender)`, so\\n // we only need to call `transferOwnership(_owner)` if _owner != msg.sender\\n if (msg.sender != _owner) {\\n transferOwnership(_owner);\\n }\\n }\\n\\n /// @notice Submits a claim to the current history contract.\\n /// The encoding of `_claimData` might vary depending on the\\n /// implementation of the current history contract.\\n /// @param _claimData Data for submitting a claim\\n /// @dev Can only be called by the `Authority` owner,\\n /// and the `Authority` contract must have ownership over\\n /// its current history contract.\\n function submitClaim(bytes calldata _claimData) external onlyOwner {\\n history.submitClaim(_claimData);\\n }\\n\\n /// @notice Transfer ownership over the current history contract to `_consensus`.\\n /// @param _consensus The new owner of the current history contract\\n /// @dev Can only be called by the `Authority` owner,\\n /// and the `Authority` contract must have ownership over\\n /// its current history contract.\\n function migrateHistoryToConsensus(address _consensus) external onlyOwner {\\n history.migrateToConsensus(_consensus);\\n }\\n\\n /// @notice Make `Authority` point to another history contract.\\n /// @param _history The new history contract\\n /// @dev Emits a `NewHistory` event.\\n /// Can only be called by the `Authority` owner.\\n function setHistory(IHistory _history) external onlyOwner {\\n history = _history;\\n emit NewHistory(_history);\\n }\\n\\n /// @notice Get the current history contract.\\n /// @return The current history contract\\n function getHistory() external view returns (IHistory) {\\n return history;\\n }\\n\\n /// @notice Get a claim from the current history.\\n /// The encoding of `_proofContext` might vary depending on the\\n /// implementation of the current history contract.\\n /// @inheritdoc IConsensus\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n ) external view override returns (bytes32, uint256, uint256) {\\n return history.getClaim(_dapp, _proofContext);\\n }\\n\\n /// @notice Transfer some amount of ERC-20 tokens to a recipient.\\n /// @param _token The token contract\\n /// @param _recipient The recipient address\\n /// @param _amount The amount of tokens to be withdrawn\\n /// @dev Can only be called by the `Authority` owner.\\n function withdrawERC20Tokens(\\n IERC20 _token,\\n address _recipient,\\n uint256 _amount\\n ) external onlyOwner {\\n bool success = _token.transfer(_recipient, _amount);\\n\\n if (!success) {\\n revert AuthorityWithdrawalFailed();\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc71ea13163833684ce576861fbb19dc40e7096a022c6976b61a99dfc9e1c0903\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/AuthorityFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Create2} from \\\"@openzeppelin/contracts/utils/Create2.sol\\\";\\n\\nimport {IAuthorityFactory} from \\\"./IAuthorityFactory.sol\\\";\\nimport {Authority} from \\\"./Authority.sol\\\";\\n\\n/// @title Authority Factory\\n/// @notice Allows anyone to reliably deploy a new `Authority` contract.\\ncontract AuthorityFactory is IAuthorityFactory {\\n function newAuthority(\\n address _authorityOwner\\n ) external override returns (Authority) {\\n Authority authority = new Authority(_authorityOwner);\\n\\n emit AuthorityCreated(_authorityOwner, authority);\\n\\n return authority;\\n }\\n\\n function newAuthority(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external override returns (Authority) {\\n Authority authority = new Authority{salt: _salt}(_authorityOwner);\\n\\n emit AuthorityCreated(_authorityOwner, authority);\\n\\n return authority;\\n }\\n\\n function calculateAuthorityAddress(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external view override returns (address) {\\n return\\n Create2.computeAddress(\\n _salt,\\n keccak256(\\n abi.encodePacked(\\n type(Authority).creationCode,\\n abi.encode(_authorityOwner)\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x1b78c9693cfd7df3833c6ea1c18d767a10167f4bf6ac8ea883c74e7da281f418\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/IAuthorityFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Authority} from \\\"./Authority.sol\\\";\\n\\n/// @title Authority Factory interface\\ninterface IAuthorityFactory {\\n // Events\\n\\n /// @notice A new authority was deployed.\\n /// @param authorityOwner The initial authority owner\\n /// @param authority The authority\\n /// @dev MUST be triggered on a successful call to `newAuthority`.\\n event AuthorityCreated(address authorityOwner, Authority authority);\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new authority.\\n /// @param _authorityOwner The initial authority owner\\n /// @return The authority\\n /// @dev On success, MUST emit an `AuthorityCreated` event.\\n function newAuthority(address _authorityOwner) external returns (Authority);\\n\\n /// @notice Deploy a new authority deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority address\\n /// @return The authority\\n /// @dev On success, MUST emit an `AuthorityCreated` event.\\n function newAuthority(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external returns (Authority);\\n\\n /// @notice Calculate the address of an authority to be deployed deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority address\\n /// @return The deterministic authority address\\n /// @dev Beware that only the `newAuthority` function with the `_salt` parameter\\n /// is able to deterministically deploy an authority.\\n function calculateAuthorityAddress(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x149bcdf9641b337836263196aabb655e69902212ede21becedd9c08b5b304717\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/history/IHistory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @title History interface\\ninterface IHistory {\\n // Permissioned functions\\n\\n /// @notice Submit a claim.\\n /// The encoding of `_claimData` might vary\\n /// depending on the history implementation.\\n /// @param _claimData Data for submitting a claim\\n /// @dev Should have access control.\\n function submitClaim(bytes calldata _claimData) external;\\n\\n /// @notice Transfer ownership to another consensus.\\n /// @param _consensus The new consensus\\n /// @dev Should have access control.\\n function migrateToConsensus(address _consensus) external;\\n\\n // Permissionless functions\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// The encoding of `_proofContext` might vary\\n /// depending on the history implementation.\\n /// @param _dapp The DApp address\\n /// @param _proofContext Data for retrieving the desired claim\\n /// @return epochHash_ The claimed epoch hash\\n /// @return firstInputIndex_ The index of the first input of the epoch in the input box\\n /// @return lastInputIndex_ The index of the last input of the epoch in the input box\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n )\\n external\\n view\\n returns (\\n bytes32 epochHash_,\\n uint256 firstInputIndex_,\\n uint256 lastInputIndex_\\n );\\n}\\n\",\"keccak256\":\"0x1378cbc831833abae8e2a565b88899d6416ea1208aa9724bd4df28e74848ffcf\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50610cb5806100206000396000f3fe608060405234801561001057600080fd5b50600436106100405760003560e01c80629c5784146100455780635a3f27d314610074578063b3a51b8414610087575b600080fd5b610058610053366004610288565b61009a565b6040516001600160a01b03909116815260200160405180910390f35b610058610082366004610288565b610115565b6100586100953660046102b2565b6101a4565b600061010e82604051806020016100b09061025f565b601f1982820381018352601f9091011660408181526001600160a01b03881660208301520160408051601f19818403018152908290526100f392916020016102fd565b6040516020818303038152906040528051906020012061022d565b9392505050565b60008082846040516101269061025f565b6001600160a01b0390911681526020018190604051809103906000f5905080158015610156573d6000803e3d6000fd5b50604080516001600160a01b038088168252831660208201529192507f0fb2d916aa6a78060ff9e89d89d62797c6668818dec04969013c5098754380ec910160405180910390a19392505050565b600080826040516101b49061025f565b6001600160a01b039091168152602001604051809103906000f0801580156101e0573d6000803e3d6000fd5b50604080516001600160a01b038087168252831660208201529192507f0fb2d916aa6a78060ff9e89d89d62797c6668818dec04969013c5098754380ec910160405180910390a192915050565b600061010e8383306000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b6109658061031b83390190565b80356001600160a01b038116811461028357600080fd5b919050565b6000806040838503121561029b57600080fd5b6102a48361026c565b946020939093013593505050565b6000602082840312156102c457600080fd5b61010e8261026c565b6000815160005b818110156102ee57602081850181015186830152016102d4565b50600093019283525090919050565b600061031261030c83866102cd565b846102cd565b94935050505056fe608060405234801561001057600080fd5b5060405161096538038061096583398101604081905261002f91610181565b61003833610057565b336001600160a01b0382161461005157610051816100a7565b506101b1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6100af610125565b6001600160a01b0381166101195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61012281610057565b50565b6000546001600160a01b0316331461017f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610110565b565b60006020828403121561019357600080fd5b81516001600160a01b03811681146101aa57600080fd5b9392505050565b6107a5806101c06000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063b688a36311610066578063b688a3631461010e578063bcdd1e1314610116578063d79a824014610129578063ddfdfbb014610157578063f2fde38b1461016a57600080fd5b8063159c5ea1146100a3578063715018a6146100b85780638da5cb5b146100c05780639368a3d3146100ea578063aa15efc8146100fd575b600080fd5b6100b66100b1366004610567565b61017d565b005b6100b66101d9565b6000546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b6100b66100f8366004610567565b6101ed565b6001546001600160a01b03166100cd565b6100b6610257565b6100b661012436600461058b565b61028c565b61013c610137366004610615565b610331565b604080519384526020840192909252908201526060016100e1565b6100b661016536600461066a565b6103ba565b6100b6610178366004610567565b61042a565b6101856104a8565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f2bcd43869347a1d42f97ac6042f3d129817abd05a6125f9750fe3724e321d23e9060200160405180910390a150565b6101e16104a8565b6101eb6000610502565b565b6101f56104a8565b60015460405163fc41168360e01b81526001600160a01b0383811660048301529091169063fc41168390602401600060405180830381600087803b15801561023c57600080fd5b505af1158015610250573d6000803e3d6000fd5b5050505050565b6040513381527f27c2b702d3bff195a18baca2daf00b20a986177c5f1449af4e2d46a3c3e02ce59060200160405180910390a1565b6102946104a8565b60405163a9059cbb60e01b81526001600160a01b038381166004830152602482018390526000919085169063a9059cbb906044016020604051808303816000875af11580156102e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030b91906106ac565b90508061032b5760405163099e1ca760e11b815260040160405180910390fd5b50505050565b60015460405163035e6a0960e61b8152600091829182916001600160a01b03169063d79a82409061036a908990899089906004016106f7565b606060405180830381865afa158015610387573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ab9190610725565b92509250925093509350939050565b6103c26104a8565b600154604051630ddfdfbb60e41b81526001600160a01b039091169063ddfdfbb0906103f49085908590600401610753565b600060405180830381600087803b15801561040e57600080fd5b505af1158015610422573d6000803e3d6000fd5b505050505050565b6104326104a8565b6001600160a01b03811661049c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6104a581610502565b50565b6000546001600160a01b031633146101eb5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610493565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146104a557600080fd5b60006020828403121561057957600080fd5b813561058481610552565b9392505050565b6000806000606084860312156105a057600080fd5b83356105ab81610552565b925060208401356105bb81610552565b929592945050506040919091013590565b60008083601f8401126105de57600080fd5b50813567ffffffffffffffff8111156105f657600080fd5b60208301915083602082850101111561060e57600080fd5b9250929050565b60008060006040848603121561062a57600080fd5b833561063581610552565b9250602084013567ffffffffffffffff81111561065157600080fd5b61065d868287016105cc565b9497909650939450505050565b6000806020838503121561067d57600080fd5b823567ffffffffffffffff81111561069457600080fd5b6106a0858286016105cc565b90969095509350505050565b6000602082840312156106be57600080fd5b8151801515811461058457600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038416815260406020820181905260009061071c90830184866106ce565b95945050505050565b60008060006060848603121561073a57600080fd5b8351925060208401519150604084015190509250925092565b6020815260006107676020830184866106ce565b94935050505056fea2646970667358221220c0785a1cc37ffa8f096145bce62f62d9cae719c200dba5e33a279c7f0894965164736f6c63430008130033a26469706673582212202de7e9a1b007ca2f3a7a6c53b2972dc3f889e83efde5ce289389b45306e1fe7864736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100405760003560e01c80629c5784146100455780635a3f27d314610074578063b3a51b8414610087575b600080fd5b610058610053366004610288565b61009a565b6040516001600160a01b03909116815260200160405180910390f35b610058610082366004610288565b610115565b6100586100953660046102b2565b6101a4565b600061010e82604051806020016100b09061025f565b601f1982820381018352601f9091011660408181526001600160a01b03881660208301520160408051601f19818403018152908290526100f392916020016102fd565b6040516020818303038152906040528051906020012061022d565b9392505050565b60008082846040516101269061025f565b6001600160a01b0390911681526020018190604051809103906000f5905080158015610156573d6000803e3d6000fd5b50604080516001600160a01b038088168252831660208201529192507f0fb2d916aa6a78060ff9e89d89d62797c6668818dec04969013c5098754380ec910160405180910390a19392505050565b600080826040516101b49061025f565b6001600160a01b039091168152602001604051809103906000f0801580156101e0573d6000803e3d6000fd5b50604080516001600160a01b038087168252831660208201529192507f0fb2d916aa6a78060ff9e89d89d62797c6668818dec04969013c5098754380ec910160405180910390a192915050565b600061010e8383306000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b6109658061031b83390190565b80356001600160a01b038116811461028357600080fd5b919050565b6000806040838503121561029b57600080fd5b6102a48361026c565b946020939093013593505050565b6000602082840312156102c457600080fd5b61010e8261026c565b6000815160005b818110156102ee57602081850181015186830152016102d4565b50600093019283525090919050565b600061031261030c83866102cd565b846102cd565b94935050505056fe608060405234801561001057600080fd5b5060405161096538038061096583398101604081905261002f91610181565b61003833610057565b336001600160a01b0382161461005157610051816100a7565b506101b1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6100af610125565b6001600160a01b0381166101195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61012281610057565b50565b6000546001600160a01b0316331461017f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610110565b565b60006020828403121561019357600080fd5b81516001600160a01b03811681146101aa57600080fd5b9392505050565b6107a5806101c06000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063b688a36311610066578063b688a3631461010e578063bcdd1e1314610116578063d79a824014610129578063ddfdfbb014610157578063f2fde38b1461016a57600080fd5b8063159c5ea1146100a3578063715018a6146100b85780638da5cb5b146100c05780639368a3d3146100ea578063aa15efc8146100fd575b600080fd5b6100b66100b1366004610567565b61017d565b005b6100b66101d9565b6000546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b6100b66100f8366004610567565b6101ed565b6001546001600160a01b03166100cd565b6100b6610257565b6100b661012436600461058b565b61028c565b61013c610137366004610615565b610331565b604080519384526020840192909252908201526060016100e1565b6100b661016536600461066a565b6103ba565b6100b6610178366004610567565b61042a565b6101856104a8565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f2bcd43869347a1d42f97ac6042f3d129817abd05a6125f9750fe3724e321d23e9060200160405180910390a150565b6101e16104a8565b6101eb6000610502565b565b6101f56104a8565b60015460405163fc41168360e01b81526001600160a01b0383811660048301529091169063fc41168390602401600060405180830381600087803b15801561023c57600080fd5b505af1158015610250573d6000803e3d6000fd5b5050505050565b6040513381527f27c2b702d3bff195a18baca2daf00b20a986177c5f1449af4e2d46a3c3e02ce59060200160405180910390a1565b6102946104a8565b60405163a9059cbb60e01b81526001600160a01b038381166004830152602482018390526000919085169063a9059cbb906044016020604051808303816000875af11580156102e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030b91906106ac565b90508061032b5760405163099e1ca760e11b815260040160405180910390fd5b50505050565b60015460405163035e6a0960e61b8152600091829182916001600160a01b03169063d79a82409061036a908990899089906004016106f7565b606060405180830381865afa158015610387573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ab9190610725565b92509250925093509350939050565b6103c26104a8565b600154604051630ddfdfbb60e41b81526001600160a01b039091169063ddfdfbb0906103f49085908590600401610753565b600060405180830381600087803b15801561040e57600080fd5b505af1158015610422573d6000803e3d6000fd5b505050505050565b6104326104a8565b6001600160a01b03811661049c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6104a581610502565b50565b6000546001600160a01b031633146101eb5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610493565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146104a557600080fd5b60006020828403121561057957600080fd5b813561058481610552565b9392505050565b6000806000606084860312156105a057600080fd5b83356105ab81610552565b925060208401356105bb81610552565b929592945050506040919091013590565b60008083601f8401126105de57600080fd5b50813567ffffffffffffffff8111156105f657600080fd5b60208301915083602082850101111561060e57600080fd5b9250929050565b60008060006040848603121561062a57600080fd5b833561063581610552565b9250602084013567ffffffffffffffff81111561065157600080fd5b61065d868287016105cc565b9497909650939450505050565b6000806020838503121561067d57600080fd5b823567ffffffffffffffff81111561069457600080fd5b6106a0858286016105cc565b90969095509350505050565b6000602082840312156106be57600080fd5b8151801515811461058457600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038416815260406020820181905260009061071c90830184866106ce565b95945050505050565b60008060006060848603121561073a57600080fd5b8351925060208401519150604084015190509250925092565b6020815260006107676020830184866106ce565b94935050505056fea2646970667358221220c0785a1cc37ffa8f096145bce62f62d9cae719c200dba5e33a279c7f0894965164736f6c63430008130033a26469706673582212202de7e9a1b007ca2f3a7a6c53b2972dc3f889e83efde5ce289389b45306e1fe7864736f6c63430008130033", - "devdoc": { - "events": { - "AuthorityCreated(address,address)": { - "details": "MUST be triggered on a successful call to `newAuthority`.", - "params": { - "authority": "The authority", - "authorityOwner": "The initial authority owner" - } - } - }, - "kind": "dev", - "methods": { - "calculateAuthorityAddress(address,bytes32)": { - "details": "Beware that only the `newAuthority` function with the `_salt` parameter is able to deterministically deploy an authority.", - "params": { - "_authorityOwner": "The initial authority owner", - "_salt": "The salt used to deterministically generate the authority address" - }, - "returns": { - "_0": "The deterministic authority address" - } - }, - "newAuthority(address)": { - "details": "On success, MUST emit an `AuthorityCreated` event.", - "params": { - "_authorityOwner": "The initial authority owner" - }, - "returns": { - "_0": "The authority" - } - }, - "newAuthority(address,bytes32)": { - "details": "On success, MUST emit an `AuthorityCreated` event.", - "params": { - "_authorityOwner": "The initial authority owner", - "_salt": "The salt used to deterministically generate the authority address" - }, - "returns": { - "_0": "The authority" - } - } - }, - "title": "Authority Factory", - "version": 1 - }, - "userdoc": { - "events": { - "AuthorityCreated(address,address)": { - "notice": "A new authority was deployed." - } - }, - "kind": "user", - "methods": { - "calculateAuthorityAddress(address,bytes32)": { - "notice": "Calculate the address of an authority to be deployed deterministically." - }, - "newAuthority(address)": { - "notice": "Deploy a new authority." - }, - "newAuthority(address,bytes32)": { - "notice": "Deploy a new authority deterministically." - } - }, - "notice": "Allows anyone to reliably deploy a new `Authority` contract.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/deployments/arbitrum_sepolia/CartesiDAppFactory.json b/deployments/arbitrum_sepolia/CartesiDAppFactory.json deleted file mode 100644 index b94dc7428..000000000 --- a/deployments/arbitrum_sepolia/CartesiDAppFactory.json +++ /dev/null @@ -1,237 +0,0 @@ -{ - "address": "0x7122cd1221C20892234186facfE8615e6743Ab02", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "contract IConsensus", - "name": "consensus", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "dappOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "templateHash", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "contract CartesiDApp", - "name": "application", - "type": "address" - } - ], - "name": "ApplicationCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "contract IConsensus", - "name": "_consensus", - "type": "address" - }, - { - "internalType": "address", - "name": "_dappOwner", - "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": "_dappOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_templateHash", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newApplication", - "outputs": [ - { - "internalType": "contract CartesiDApp", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IConsensus", - "name": "_consensus", - "type": "address" - }, - { - "internalType": "address", - "name": "_dappOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_templateHash", - "type": "bytes32" - } - ], - "name": "newApplication", - "outputs": [ - { - "internalType": "contract CartesiDApp", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0x83b4132ec58b2ffb880a86bfb356ad3a328e3ffefd30bef1e9117f89f3ab987b", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", - "contractAddress": null, - "transactionIndex": 1, - "gasUsed": "1545878", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xfb857d220d62ff7edf5339d167871d3e411126aa99a16d449f93cb212dd67bbb", - "transactionHash": "0x83b4132ec58b2ffb880a86bfb356ad3a328e3ffefd30bef1e9117f89f3ab987b", - "logs": [], - "blockNumber": 2838823, - "cumulativeGasUsed": "1545878", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 1, - "solcInputHash": "54ee33aea592269e6046663615f287b6", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IConsensus\",\"name\":\"consensus\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"dappOwner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"templateHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"contract CartesiDApp\",\"name\":\"application\",\"type\":\"address\"}],\"name\":\"ApplicationCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"contract IConsensus\",\"name\":\"_consensus\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_dappOwner\",\"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\":\"_dappOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_templateHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"newApplication\",\"outputs\":[{\"internalType\":\"contract CartesiDApp\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IConsensus\",\"name\":\"_consensus\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_dappOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_templateHash\",\"type\":\"bytes32\"}],\"name\":\"newApplication\",\"outputs\":[{\"internalType\":\"contract CartesiDApp\",\"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\":{\"application\":\"The application\",\"consensus\":\"The initial consensus contract\",\"dappOwner\":\"The initial DApp owner\",\"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\":{\"_consensus\":\"The initial consensus contract\",\"_dappOwner\":\"The initial DApp owner\",\"_salt\":\"The salt used to deterministically generate the DApp address\",\"_templateHash\":\"The initial machine state hash\"},\"returns\":{\"_0\":\"The deterministic application address\"}},\"newApplication(address,address,bytes32)\":{\"details\":\"On success, MUST emit an `ApplicationCreated` event.\",\"params\":{\"_consensus\":\"The initial consensus contract\",\"_dappOwner\":\"The initial DApp owner\",\"_templateHash\":\"The initial machine state hash\"},\"returns\":{\"_0\":\"The application\"}},\"newApplication(address,address,bytes32,bytes32)\":{\"details\":\"On success, MUST emit an `ApplicationCreated` event.\",\"params\":{\"_consensus\":\"The initial consensus contract\",\"_dappOwner\":\"The initial DApp owner\",\"_salt\":\"The salt used to deterministically generate the DApp address\",\"_templateHash\":\"The initial machine state hash\"},\"returns\":{\"_0\":\"The application\"}}},\"title\":\"Cartesi DApp 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 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 `CartesiDApp` contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dapp/CartesiDAppFactory.sol\":\"CartesiDAppFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@cartesi/util/contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"},\"@cartesi/util/contracts/CartesiMathV2.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\n/// @title CartesiMath\\n/// @author Felipe Argento\\npragma solidity ^0.8.0;\\n\\nlibrary CartesiMathV2 {\\n // mapping values are packed as bytes3 each\\n // see test/TestCartesiMath.ts for decimal values\\n bytes constant log2tableTimes1M =\\n hex\\\"0000000F4240182F421E8480236E082771822AD63A2DC6C0305E8532B04834C96736B3C23876D73A187A3B9D4A3D09003E5EA63FA0C540D17741F28843057D440BA745062945F60246DC1047B917488DC7495ABA4A207C4ADF8A4B98544C4B404CF8AA4DA0E64E44434EE3054F7D6D5013B750A61A5134C851BFF05247BD52CC58534DE753CC8D54486954C19C55384255AC75561E50568DE956FB575766B057D00758376F589CFA5900BA5962BC59C3135A21CA5A7EF15ADA945B34BF5B8D805BE4DF5C3AEA5C8FA95CE3265D356C5D86835DD6735E25455E73005EBFAD5F0B525F55F75F9FA25FE85A60302460770860BD0A61023061467F6189FD61CCAE620E98624FBF62902762CFD5630ECD634D12638AA963C7966403DC643F7F647A8264B4E864EEB56527EC6560906598A365D029660724663D9766738566A8F066DDDA6712476746386779AF67ACAF67DF3A6811526842FA68743268A4FC68D55C6905536934E169640A6992CF69C13169EF326A1CD46A4A186A76FF6AA38C6ACFC0\\\";\\n\\n /// @notice Approximates log2 * 1M\\n /// @param _num number to take log2 * 1M of\\n /// @return approximate log2 times 1M\\n function log2ApproxTimes1M(uint256 _num) public pure returns (uint256) {\\n require(_num > 0, \\\"Number cannot be zero\\\");\\n uint256 leading = 0;\\n\\n if (_num == 1) return 0;\\n\\n while (_num > 128) {\\n _num = _num >> 1;\\n leading += 1;\\n }\\n return (leading * uint256(1000000)) + (getLog2TableTimes1M(_num));\\n }\\n\\n /// @notice navigates log2tableTimes1M\\n /// @param _num number to take log2 of\\n /// @return result after table look-up\\n function getLog2TableTimes1M(uint256 _num) public pure returns (uint256) {\\n bytes3 result = 0;\\n for (uint8 i = 0; i < 3; i++) {\\n bytes3 tempResult = log2tableTimes1M[(_num - 1) * 3 + i];\\n result = result | (tempResult >> (i * 8));\\n }\\n\\n return uint256(uint24(result));\\n }\\n\\n /// @notice get floor of log2 of number\\n /// @param _num number to take floor(log2) of\\n /// @return floor(log2) of _num\\n function getLog2Floor(uint256 _num) public pure returns (uint8) {\\n require(_num != 0, \\\"log of zero is undefined\\\");\\n\\n return uint8(255 - clz(_num));\\n }\\n\\n /// @notice checks if a number is Power of 2\\n /// @param _num number to check\\n /// @return true if number is power of 2, false if not\\n function isPowerOf2(uint256 _num) public pure returns (bool) {\\n if (_num == 0) return false;\\n\\n return _num & (_num - 1) == 0;\\n }\\n\\n /// @notice count trailing zeros\\n /// @param _num number you want the ctz of\\n /// @dev this a binary search implementation\\n function ctz(uint256 _num) public pure returns (uint256) {\\n if (_num == 0) return 256;\\n\\n uint256 n = 0;\\n if (_num & 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF == 0) {\\n n = n + 128;\\n _num = _num >> 128;\\n }\\n if (_num & 0x000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFF == 0) {\\n n = n + 64;\\n _num = _num >> 64;\\n }\\n if (_num & 0x00000000000000000000000000000000000000000000000000000000FFFFFFFF == 0) {\\n n = n + 32;\\n _num = _num >> 32;\\n }\\n if (_num & 0x000000000000000000000000000000000000000000000000000000000000FFFF == 0) {\\n n = n + 16;\\n _num = _num >> 16;\\n }\\n if (_num & 0x00000000000000000000000000000000000000000000000000000000000000FF == 0) {\\n n = n + 8;\\n _num = _num >> 8;\\n }\\n if (_num & 0x000000000000000000000000000000000000000000000000000000000000000F == 0) {\\n n = n + 4;\\n _num = _num >> 4;\\n }\\n if (_num & 0x0000000000000000000000000000000000000000000000000000000000000003 == 0) {\\n n = n + 2;\\n _num = _num >> 2;\\n }\\n if (_num & 0x0000000000000000000000000000000000000000000000000000000000000001 == 0) {\\n n = n + 1;\\n }\\n\\n return n;\\n }\\n\\n /// @notice count leading zeros\\n /// @param _num number you want the clz of\\n /// @dev this a binary search implementation\\n function clz(uint256 _num) public pure returns (uint256) {\\n if (_num == 0) return 256;\\n\\n uint256 n = 0;\\n if (_num & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000 == 0) {\\n n = n + 128;\\n _num = _num << 128;\\n }\\n if (_num & 0xFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 64;\\n _num = _num << 64;\\n }\\n if (_num & 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 32;\\n _num = _num << 32;\\n }\\n if (_num & 0xFFFF000000000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 16;\\n _num = _num << 16;\\n }\\n if (_num & 0xFF00000000000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 8;\\n _num = _num << 8;\\n }\\n if (_num & 0xF000000000000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 4;\\n _num = _num << 4;\\n }\\n if (_num & 0xC000000000000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 2;\\n _num = _num << 2;\\n }\\n if (_num & 0x8000000000000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 1;\\n }\\n\\n return n;\\n }\\n}\\n\",\"keccak256\":\"0x98fb8d20c05b7c39c44171b6c524cf023da646749eb90157463538da8b2e13d3\",\"license\":\"Apache-2.0\"},\"@cartesi/util/contracts/MerkleV2.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\n/// @title Library for Merkle proofs\\npragma solidity ^0.8.0;\\n\\nimport \\\"./CartesiMathV2.sol\\\";\\n\\nlibrary MerkleV2 {\\n using CartesiMathV2 for uint256;\\n\\n uint128 constant L_WORD_SIZE = 3; // word = 8 bytes, log = 3\\n // number of hashes in EMPTY_TREE_HASHES\\n uint128 constant EMPTY_TREE_SIZE = 1952; // 61*32=1952. 32 bytes per 61 indexes (64 words)\\n\\n // merkle root hashes of trees of zero concatenated\\n // 32 bytes for each root, first one is keccak(0), second one is\\n // keccak(keccack(0), keccak(0)) and so on\\n\\n bytes constant EMPTY_TREE_HASHES =\\n hex\\\"011b4d03dd8c01f1049143cf9c4c817e4b167f1d1b83e5c6f0f10d89ba1e7bce4d9470a821fbe90117ec357e30bad9305732fb19ddf54a07dd3e29f440619254ae39ce8537aca75e2eff3e38c98011dfe934e700a0967732fc07b430dd656a233fc9a15f5b4869c872f81087bb6104b7d63e6f9ab47f2c43f3535eae7172aa7f17d2dd614cddaa4d879276b11e0672c9560033d3e8453a1d045339d34ba601b9c37b8b13ca95166fb7af16988a70fcc90f38bf9126fd833da710a47fb37a55e68e7a427fa943d9966b389f4f257173676090c6e95f43e2cb6d65f8758111e30930b0b9deb73e155c59740bacf14a6ff04b64bb8e201a506409c3fe381ca4ea90cd5deac729d0fdaccc441d09d7325f41586ba13c801b7eccae0f95d8f3933efed8b96e5b7f6f459e9cb6a2f41bf276c7b85c10cd4662c04cbbb365434726c0a0c9695393027fb106a8153109ac516288a88b28a93817899460d6310b71cf1e6163e8806fa0d4b197a259e8c3ac28864268159d0ac85f8581ca28fa7d2c0c03eb91e3eee5ca7a3da2b3053c9770db73599fb149f620e3facef95e947c0ee860b72122e31e4bbd2b7c783d79cc30f60c6238651da7f0726f767d22747264fdb046f7549f26cc70ed5e18baeb6c81bb0625cb95bb4019aeecd40774ee87ae29ec517a71f6ee264c5d761379b3d7d617ca83677374b49d10aec50505ac087408ca892b573c267a712a52e1d06421fe276a03efb1889f337201110fdc32a81f8e152499af665835aabfdc6740c7e2c3791a31c3cdc9f5ab962f681b12fc092816a62f27d86025599a41233848702f0cfc0437b445682df51147a632a0a083d2d38b5e13e466a8935afff58bb533b3ef5d27fba63ee6b0fd9e67ff20af9d50deee3f8bf065ec220c1fd4ba57e341261d55997f85d66d32152526736872693d2b437a233e2337b715f6ac9a6a272622fdc2d67fcfe1da3459f8dab4ed7e40a657a54c36766c5e8ac9a88b35b05c34747e6507f6b044ab66180dc76ac1a696de03189593fedc0d0dbbd855c8ead673544899b0960e4a5a7ca43b4ef90afe607de7698caefdc242788f654b57a4fb32a71b335ef6ff9a4cc118b282b53bdd6d6192b7a82c3c5126b9c7e33c8e5a5ac9738b8bd31247fb7402054f97b573e8abb9faad219f4fd085aceaa7f542d787ee4196d365f3cc566e7bbcfbfd451230c48d804c017d21e2d8fa914e2559bb72bf0ab78c8ab92f00ef0d0d576eccdd486b64138a4172674857e543d1d5b639058dd908186597e366ad5f3d9c7ceaff44d04d1550b8d33abc751df07437834ba5acb32328a396994aebb3c40f759c2d6d7a3cb5377e55d5d218ef5a296dda8ddc355f3f50c3d0b660a51dfa4d98a6a5a33564556cf83c1373a814641d6a1dcef97b883fee61bb84fe60a3409340217e629cc7e4dcc93b85d8820921ff5826148b60e6939acd7838e1d7f20562bff8ee4b5ec4a05ad997a57b9796fdcb2eda87883c2640b072b140b946bfdf6575cacc066fdae04f6951e63624cbd316a677cad529bbe4e97b9144e4bc06c4afd1de55dd3e1175f90423847a230d34dfb71ed56f2965a7f6c72e6aa33c24c303fd67745d632656c5ef90bec80f4f5d1daa251988826cef375c81c36bf457e09687056f924677cb0bccf98dff81e014ce25f2d132497923e267363963cdf4302c5049d63131dc03fd95f65d8b6aa5934f817252c028c90f56d413b9d5d10d89790707dae2fabb249f649929927c21dd71e3f656826de5451c5da375aadecbd59d5ebf3a31fae65ac1b316a1611f1b276b26530f58d7247df459ce1f86db1d734f6f811932f042cee45d0e455306d01081bc3384f82c5fb2aacaa19d89cdfa46cc916eac61121475ba2e6191b4feecbe1789717021a158ace5d06744b40f551076b67cd63af60007f8c99876e1424883a45ec49d497ddaf808a5521ca74a999ab0b3c7aa9c80f85e93977ec61ce68b20307a1a81f71ca645b568fcd319ccbb5f651e87b707d37c39e15f945ea69e2f7c7d2ccc85b7e654c07e96f0636ae4044fe0e38590b431795ad0f8647bdd613713ada493cc17efd313206380e6a685b8198475bbd021c6e9d94daab2214947127506073e44d5408ba166c512a0b86805d07f5a44d3c41706be2bc15e712e55805248b92e8677d90f6d284d1d6ffaff2c430657042a0e82624fa3717b06cc0a6fd12230ea586dae83019fb9e06034ed2803c98d554b93c9a52348cafff75c40174a91f9ae6b8647854a156029f0b88b83316663ce574a4978277bb6bb27a31085634b6ec78864b6d8201c7e93903d75815067e378289a3d072ae172dafa6a452470f8d645bebfad9779594fc0784bb764a22e3a8181d93db7bf97893c414217a618ccb14caa9e92e8c61673afc9583662e812adba1f87a9c68202d60e909efab43c42c0cb00695fc7f1ffe67c75ca894c3c51e1e5e731360199e600f6ced9a87b2a6a87e70bf251bb5075ab222138288164b2eda727515ea7de12e2496d4fe42ea8d1a120c03cf9c50622c2afe4acb0dad98fd62d07ab4e828a94495f6d1ab973982c7ccbe6c1fae02788e4422ae22282fa49cbdb04ba54a7a238c6fc41187451383460762c06d1c8a72b9cd718866ad4b689e10c9a8c38fe5ef045bd785b01e980fc82c7e3532ce81876b778dd9f1ceeba4478e86411fb6fdd790683916ca832592485093644e8760cd7b4c01dba1ccc82b661bf13f0e3f34acd6b88\\\";\\n\\n /// @notice Gets merkle root hash of drive with a replacement\\n /// @param _position position of _drive\\n /// @param _logSizeOfReplacement log2 of size the replacement\\n /// @param _logSizeOfFullDrive log2 of size the full drive, which can be the entire machine\\n /// @param _replacement hash of the replacement\\n /// @param siblings of replacement that merkle root can be calculated\\n function getRootAfterReplacementInDrive(\\n uint256 _position,\\n uint256 _logSizeOfReplacement,\\n uint256 _logSizeOfFullDrive,\\n bytes32 _replacement,\\n bytes32[] calldata siblings\\n ) public pure returns (bytes32) {\\n require(\\n _logSizeOfFullDrive >= _logSizeOfReplacement && _logSizeOfReplacement >= 3 && _logSizeOfFullDrive <= 64,\\n \\\"3 <= logSizeOfReplacement <= logSizeOfFullDrive <= 64\\\"\\n );\\n\\n uint256 size = 1 << _logSizeOfReplacement;\\n\\n require(((size - 1) & _position) == 0, \\\"Position is not aligned\\\");\\n require(siblings.length == _logSizeOfFullDrive - _logSizeOfReplacement, \\\"Proof length does not match\\\");\\n\\n for (uint256 i; i < siblings.length; i++) {\\n if ((_position & (size << i)) == 0) {\\n _replacement = keccak256(abi.encodePacked(_replacement, siblings[i]));\\n } else {\\n _replacement = keccak256(abi.encodePacked(siblings[i], _replacement));\\n }\\n }\\n\\n return _replacement;\\n }\\n\\n /// @notice Gets precomputed hash of zero in empty tree hashes\\n /// @param _index of hash wanted\\n /// @dev first index is keccak(0), second index is keccak(keccak(0), keccak(0))\\n function getEmptyTreeHashAtIndex(uint256 _index) public pure returns (bytes32) {\\n uint256 start = _index * 32;\\n require(EMPTY_TREE_SIZE >= start + 32, \\\"index out of bounds\\\");\\n bytes32 hashedZeros;\\n bytes memory zeroTree = EMPTY_TREE_HASHES;\\n\\n // first word is length, then skip index words\\n assembly {\\n hashedZeros := mload(add(add(zeroTree, 0x20), start))\\n }\\n return hashedZeros;\\n }\\n\\n /// @notice get merkle root of generic array of bytes\\n /// @param _data array of bytes to be merklelized\\n /// @param _log2Size log2 of total size of the drive\\n /// @dev _data is padded with zeroes until is multiple of 8\\n /// @dev root is completed with zero tree until log2size is complete\\n /// @dev hashes are taken word by word (8 bytes by 8 bytes)\\n function getMerkleRootFromBytes(bytes calldata _data, uint256 _log2Size) public pure returns (bytes32) {\\n require(_log2Size >= 3 && _log2Size <= 64, \\\"range of log2Size: [3,64]\\\");\\n\\n // if _data is empty return pristine drive of size log2size\\n if (_data.length == 0) return getEmptyTreeHashAtIndex(_log2Size - 3);\\n\\n // total size of the drive in words\\n uint256 size = 1 << (_log2Size - 3);\\n require(size << L_WORD_SIZE >= _data.length, \\\"data is bigger than drive\\\");\\n // the stack depth is log2(_data.length / 8) + 2\\n uint256 stack_depth = 2 + ((_data.length) >> L_WORD_SIZE).getLog2Floor();\\n bytes32[] memory stack = new bytes32[](stack_depth);\\n\\n uint256 numOfHashes; // total number of hashes on stack (counting levels)\\n uint256 stackLength; // total length of stack\\n uint256 numOfJoins; // number of hashes of the same level on stack\\n uint256 topStackLevel; // hash level of the top of the stack\\n\\n while (numOfHashes < size) {\\n if ((numOfHashes << L_WORD_SIZE) < _data.length) {\\n // we still have words to hash\\n stack[stackLength] = getHashOfWordAtIndex(_data, numOfHashes);\\n numOfHashes++;\\n\\n numOfJoins = numOfHashes;\\n } else {\\n // since padding happens in hashOfWordAtIndex function\\n // we only need to complete the stack with pre-computed\\n // hash(0), hash(hash(0),hash(0)) and so on\\n topStackLevel = numOfHashes.ctz();\\n\\n stack[stackLength] = getEmptyTreeHashAtIndex(topStackLevel);\\n\\n //Empty Tree Hash summarizes many hashes\\n numOfHashes = numOfHashes + (1 << topStackLevel);\\n numOfJoins = numOfHashes >> topStackLevel;\\n }\\n\\n stackLength++;\\n\\n // while there are joins, hash top of stack together\\n while (numOfJoins & 1 == 0) {\\n bytes32 h2 = stack[stackLength - 1];\\n bytes32 h1 = stack[stackLength - 2];\\n\\n stack[stackLength - 2] = keccak256(abi.encodePacked(h1, h2));\\n stackLength = stackLength - 1; // remove hashes from stack\\n\\n numOfJoins = numOfJoins >> 1;\\n }\\n }\\n require(stackLength == 1, \\\"stack error\\\");\\n\\n return stack[0];\\n }\\n\\n /// @notice Get the hash of a word in an array of bytes\\n /// @param _data array of bytes\\n /// @param _wordIndex index of word inside the bytes to get the hash of\\n /// @dev if word is incomplete (< 8 bytes) it gets padded with zeroes\\n function getHashOfWordAtIndex(bytes calldata _data, uint256 _wordIndex) public pure returns (bytes32) {\\n uint256 start = _wordIndex << L_WORD_SIZE;\\n uint256 end = start + (1 << L_WORD_SIZE);\\n\\n // TODO: in .lua this just returns zero, but this might be more consistent\\n require(start <= _data.length, \\\"word out of bounds\\\");\\n\\n if (end <= _data.length) {\\n return keccak256(abi.encodePacked(_data[start:end]));\\n }\\n\\n // word is incomplete\\n // fill paddedSlice with incomplete words - the rest is going to be bytes(0)\\n bytes memory paddedSlice = new bytes(8);\\n uint256 remaining = _data.length - start;\\n\\n for (uint256 i; i < remaining; i++) {\\n paddedSlice[i] = _data[start + i];\\n }\\n\\n return keccak256(paddedSlice);\\n }\\n\\n /// @notice Calculate the root of Merkle tree from an array of power of 2 elements\\n /// @param hashes The array containing power of 2 elements\\n /// @return byte32 the root hash being calculated\\n function calculateRootFromPowerOfTwo(bytes32[] memory hashes) public pure returns (bytes32) {\\n // revert when the input is not of power of 2\\n require((hashes.length).isPowerOf2(), \\\"array len not power of 2\\\");\\n\\n if (hashes.length == 1) {\\n return hashes[0];\\n } else {\\n bytes32[] memory newHashes = new bytes32[](hashes.length >> 1);\\n\\n for (uint256 i; i < hashes.length; i += 2) {\\n newHashes[i >> 1] = keccak256(abi.encodePacked(hashes[i], hashes[i + 1]));\\n }\\n\\n return calculateRootFromPowerOfTwo(newHashes);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x73d86cb2dfa2ca887987c6da8d193d523c6a65ea89e296d1f47f190ebda7fa9b\",\"license\":\"Apache-2.0\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\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 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 require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\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\":\"0xa535a5df777d44e945dd24aa43a11e44b024140fc340ad0dfe42acf4002aade1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev _Available since v3.1._\\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\":\"0xeb373f1fdc7b755c6a750123a9b9e3a8a02c1470042fd6505d875000a80bde0b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/utils/ERC1155Holder.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./ERC1155Receiver.sol\\\";\\n\\n/**\\n * Simple implementation of `ERC1155Receiver` 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 *\\n * @dev _Available since v3.1._\\n */\\ncontract ERC1155Holder is ERC1155Receiver {\\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\":\"0x2e024ca51ce5abe16c0d34e6992a1104f356e2244eb4ccbec970435e8b3405e3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC1155Receiver.sol\\\";\\nimport \\\"../../../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev _Available since v3.1._\\n */\\nabstract contract ERC1155Receiver 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\",\"keccak256\":\"0x3dd5e1a66a56f30302108a1da97d677a42b1daa60e503696b2bcbbf3e4c95bcb\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\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 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\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/utils/ERC721Holder.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../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 {IERC721-setApprovalForAll}.\\n */\\ncontract 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 override returns (bytes4) {\\n return this.onERC721Received.selector;\\n }\\n}\\n\",\"keccak256\":\"0x67ef46fef257faae47adb630aad49694dda0334e5f7a7c5fb386243b974886b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\\n require(address(this).balance >= amount, \\\"Create2: insufficient balance\\\");\\n require(bytecode.length != 0, \\\"Create2: bytecode length is zero\\\");\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n require(addr != address(0), \\\"Create2: Failed on deploy\\\");\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6e00f269073ffc4350e56b7e8153c9092d5f70bfba423299990514183101ef89\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./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 *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/common/CanonicalMachine.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @title Canonical Machine Constants Library\\n///\\n/// @notice Defines several constants related to the reference implementation\\n/// of the RISC-V machine that runs Linux, also known as the \\\"Cartesi Machine\\\".\\nlibrary CanonicalMachine {\\n /// @notice Base-2 logarithm of number of bytes.\\n type Log2Size is uint64;\\n\\n /// @notice Machine word size (8 bytes).\\n Log2Size constant WORD_LOG2_SIZE = Log2Size.wrap(3);\\n\\n /// @notice Machine address space size (2^64 bytes).\\n Log2Size constant MACHINE_LOG2_SIZE = Log2Size.wrap(64);\\n\\n /// @notice Keccak-256 output size (32 bytes).\\n Log2Size constant KECCAK_LOG2_SIZE = Log2Size.wrap(5);\\n\\n /// @notice Maximum input size (~2 megabytes).\\n /// @dev The offset and size fields use up the extra 64 bytes.\\n uint256 constant INPUT_MAX_SIZE = (1 << 21) - 64;\\n\\n /// @notice Maximum voucher metadata memory range (2 megabytes).\\n Log2Size constant VOUCHER_METADATA_LOG2_SIZE = Log2Size.wrap(21);\\n\\n /// @notice Maximum notice metadata memory range (2 megabytes).\\n Log2Size constant NOTICE_METADATA_LOG2_SIZE = Log2Size.wrap(21);\\n\\n /// @notice Maximum epoch voucher memory range (128 megabytes).\\n Log2Size constant EPOCH_VOUCHER_LOG2_SIZE = Log2Size.wrap(37);\\n\\n /// @notice Maximum epoch notice memory range (128 megabytes).\\n Log2Size constant EPOCH_NOTICE_LOG2_SIZE = Log2Size.wrap(37);\\n\\n /// @notice Unwrap `s` into its underlying uint64 value.\\n /// @param s Base-2 logarithm of some number of bytes\\n function uint64OfSize(Log2Size s) internal pure returns (uint64) {\\n return Log2Size.unwrap(s);\\n }\\n\\n /// @notice Return the position of an intra memory range on a memory range\\n /// with contents with the same size.\\n /// @param index Index of intra memory range\\n /// @param log2Size Base-2 logarithm of intra memory range size\\n function getIntraMemoryRangePosition(\\n uint64 index,\\n Log2Size log2Size\\n ) internal pure returns (uint64) {\\n return index << Log2Size.unwrap(log2Size);\\n }\\n}\\n\",\"keccak256\":\"0x97cdce56cdb4f0b4164e6be3a72e50469a3124e4716e753a1792aa70eac614f5\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/common/OutputEncoding.sol\":{\"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 Output Encoding Library\\n///\\n/// @notice Defines the encoding of outputs generated by the off-chain machine.\\nlibrary OutputEncoding {\\n /// @notice Encode a notice.\\n /// @param notice The notice\\n /// @return The encoded output\\n function encodeNotice(\\n bytes calldata notice\\n ) internal pure returns (bytes memory) {\\n return abi.encode(notice);\\n }\\n\\n /// @notice Encode a voucher.\\n /// @param destination The address that will receive the payload through a message call\\n /// @param payload The payload, which\\u2014in the case of Solidity contracts\\u2014encodes a function call\\n /// @return The encoded output\\n function encodeVoucher(\\n address destination,\\n bytes calldata payload\\n ) internal pure returns (bytes memory) {\\n return abi.encode(destination, payload);\\n }\\n}\\n\",\"keccak256\":\"0xfbf8bd40a11aeb380c77910ef7a8c3a4b358dddbd8bc795529de39c955dd6f60\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/IConsensus.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @title Consensus interface\\n///\\n/// @notice This contract defines a generic interface for consensuses.\\n/// We use the word \\\"consensus\\\" to designate a contract that provides claims\\n/// in the base layer regarding the state of off-chain machines running in\\n/// the execution layer. How this contract is able to reach consensus, who is\\n/// able to submit claims, and how are claims stored in the base layer are\\n/// some of the implementation details left unspecified by this interface.\\n///\\n/// From the point of view of a DApp, these claims are necessary to validate\\n/// on-chain action allowed by the off-chain machine in the form of vouchers\\n/// and notices. Each claim is composed of three parts: an epoch hash, a first\\n/// index, and a last index. We'll explain each of these parts below.\\n///\\n/// First, let us define the word \\\"epoch\\\". For finality reasons, we need to\\n/// divide the stream of inputs being fed into the off-chain machine into\\n/// batches of inputs, which we call \\\"epoches\\\". At the end of every epoch,\\n/// we summarize the state of the off-chain machine in a single hash, called\\n/// \\\"epoch hash\\\". Please note that this interface does not define how this\\n/// stream of inputs is being chopped up into epoches.\\n///\\n/// The other two parts are simply the indices of the first and last inputs\\n/// accepted during the epoch. Logically, the first index MUST BE less than\\n/// or equal to the last index. As a result, every epoch MUST accept at least\\n/// one input. This assumption stems from the fact that the state of a machine\\n/// can only change after an input is fed into it.\\n///\\n/// Examples of possible implementations of this interface include:\\n///\\n/// * An authority consensus, controlled by a single address who has full\\n/// control over epoch boundaries, claim submission, asset management, etc.\\n///\\n/// * A quorum consensus, controlled by a limited set of validators, that\\n/// vote on the state of the machine at the end of every epoch. Also, epoch\\n/// boundaries are determined by the timestamp in the base layer, and assets\\n/// are split equally amongst the validators.\\n///\\n/// * An NxN consensus, which allows anyone to submit and dispute claims\\n/// in the base layer. Epoch boundaries are determined in the same fashion\\n/// as in the quorum example.\\n///\\ninterface IConsensus {\\n /// @notice An application has joined the consensus' validation set.\\n /// @param application The application\\n /// @dev MUST be triggered on a successful call to `join`.\\n event ApplicationJoined(address application);\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// The encoding of `_proofContext` might vary\\n /// depending on the implementation.\\n /// @param _dapp The DApp address\\n /// @param _proofContext Data for retrieving the desired claim\\n /// @return epochHash_ The claimed epoch hash\\n /// @return firstInputIndex_ The index of the first input of the epoch in the input box\\n /// @return lastInputIndex_ The index of the last input of the epoch in the input box\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n )\\n external\\n view\\n returns (\\n bytes32 epochHash_,\\n uint256 firstInputIndex_,\\n uint256 lastInputIndex_\\n );\\n\\n /// @notice Signal the consensus that the message sender wants to join its validation set.\\n /// @dev MUST fire an `ApplicationJoined` event with the message sender as argument.\\n function join() external;\\n}\\n\",\"keccak256\":\"0xc9d295fada66eb0602e0f1e2e236708e52f959927abb4ab6b04173a98b92ac16\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/CartesiDApp.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {ICartesiDApp, Proof} from \\\"./ICartesiDApp.sol\\\";\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\nimport {LibOutputValidation, OutputValidityProof} from \\\"../library/LibOutputValidation.sol\\\";\\nimport {Bitmask} from \\\"@cartesi/util/contracts/Bitmask.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/security/ReentrancyGuard.sol\\\";\\n\\n/// @title Cartesi DApp\\n///\\n/// @notice This contract acts as the base layer incarnation of a DApp running on the execution layer.\\n/// The DApp is hereby able to interact with other smart contracts through the execution of vouchers\\n/// and the validation of notices. These outputs are generated by the DApp backend on the execution\\n/// layer and can be proven in the base layer thanks to claims submitted by a consensus contract.\\n///\\n/// A voucher is a one-time message call to another contract. It can encode asset transfers, approvals,\\n/// or any other message call that doesn't require Ether to be sent along. A voucher will only be consumed\\n/// if the underlying message call succeeds (that is, it doesn't revert). Furthermore, the return data of\\n/// the message call is discarded entirely. As a protective measure against reentrancy attacks, nested\\n/// voucher executions are prohibited.\\n///\\n/// A notice, on the other hand, constitutes an arbitrary piece of data that can be proven any number of times.\\n/// On their own, they do not trigger any type of contract-to-contract interaction.\\n/// Rather, they merely serve to attest off-chain results, e.g. which player won a particular chess match.\\n///\\n/// Every DApp is subscribed to a consensus contract, and governed by a single address, the owner.\\n/// The consensus has the power of submitting claims, which, in turn, are used to validate vouchers and notices.\\n/// Meanwhile, the owner has complete power over the DApp, as it can replace the consensus at any time.\\n/// Therefore, the users of a DApp must trust both the consensus and the DApp owner.\\n///\\n/// The DApp developer can choose whichever ownership and consensus models it wants.\\n///\\n/// Examples of DApp ownership models include:\\n///\\n/// * no owner (address zero)\\n/// * individual signer (externally-owned account)\\n/// * multiple signers (multi-sig)\\n/// * DAO (decentralized autonomous organization)\\n/// * self-owned DApp (off-chain governance logic)\\n///\\n/// See `IConsensus` for examples of consensus models.\\n///\\n/// This contract inherits the following OpenZeppelin contracts.\\n/// For more information, please consult OpenZeppelin's official documentation.\\n///\\n/// * `Ownable`\\n/// * `ERC721Holder`\\n/// * `ERC1155Holder`\\n/// * `ReentrancyGuard`\\n///\\ncontract CartesiDApp is\\n ICartesiDApp,\\n Ownable,\\n ERC721Holder,\\n ERC1155Holder,\\n ReentrancyGuard\\n{\\n using Bitmask for mapping(uint256 => uint256);\\n using LibOutputValidation for OutputValidityProof;\\n\\n /// @notice Raised when executing an already executed voucher.\\n error VoucherReexecutionNotAllowed();\\n\\n /// @notice Raised when the transfer fails.\\n error EtherTransferFailed();\\n\\n /// @notice Raised when a mehtod is not called by DApp itself.\\n error OnlyDApp();\\n\\n /// @notice The initial machine state hash.\\n /// @dev See the `getTemplateHash` function.\\n bytes32 internal immutable templateHash;\\n\\n /// @notice The executed voucher bitmask, which keeps track of which vouchers\\n /// were executed already in order to avoid re-execution.\\n /// @dev See the `wasVoucherExecuted` function.\\n mapping(uint256 => uint256) internal voucherBitmask;\\n\\n /// @notice The current consensus contract.\\n /// @dev See the `getConsensus` and `migrateToConsensus` functions.\\n IConsensus internal consensus;\\n\\n /// @notice Creates a `CartesiDApp` contract.\\n /// @param _consensus The initial consensus contract\\n /// @param _owner The initial DApp owner\\n /// @param _templateHash The initial machine state hash\\n /// @dev Calls the `join` function on `_consensus`.\\n constructor(IConsensus _consensus, address _owner, bytes32 _templateHash) {\\n transferOwnership(_owner);\\n templateHash = _templateHash;\\n consensus = _consensus;\\n\\n _consensus.join();\\n }\\n\\n function executeVoucher(\\n address _destination,\\n bytes calldata _payload,\\n Proof calldata _proof\\n ) external override nonReentrant returns (bool) {\\n bytes32 epochHash;\\n uint256 firstInputIndex;\\n uint256 lastInputIndex;\\n uint256 inputIndex;\\n\\n // query the current consensus for the desired claim\\n (epochHash, firstInputIndex, lastInputIndex) = getClaim(_proof.context);\\n\\n // validate input index range and calculate the input index\\n // based on the input index range provided by the consensus\\n inputIndex = _proof.validity.validateInputIndexRange(\\n firstInputIndex,\\n lastInputIndex\\n );\\n\\n // reverts if proof isn't valid\\n _proof.validity.validateVoucher(_destination, _payload, epochHash);\\n\\n uint256 voucherPosition = LibOutputValidation.getBitMaskPosition(\\n _proof.validity.outputIndexWithinInput,\\n inputIndex\\n );\\n\\n // check if voucher has been executed\\n if (_wasVoucherExecuted(voucherPosition)) {\\n revert VoucherReexecutionNotAllowed();\\n }\\n\\n // execute voucher\\n (bool succ, ) = _destination.call(_payload);\\n\\n // if properly executed, mark it as executed and emit event\\n if (succ) {\\n voucherBitmask.setBit(voucherPosition, true);\\n emit VoucherExecuted(voucherPosition);\\n }\\n\\n return succ;\\n }\\n\\n function wasVoucherExecuted(\\n uint256 _inputIndex,\\n uint256 _outputIndexWithinInput\\n ) external view override returns (bool) {\\n uint256 voucherPosition = LibOutputValidation.getBitMaskPosition(\\n _outputIndexWithinInput,\\n _inputIndex\\n );\\n return _wasVoucherExecuted(voucherPosition);\\n }\\n\\n function _wasVoucherExecuted(\\n uint256 _voucherPosition\\n ) internal view returns (bool) {\\n return voucherBitmask.getBit(_voucherPosition);\\n }\\n\\n function validateNotice(\\n bytes calldata _notice,\\n Proof calldata _proof\\n ) external view override returns (bool) {\\n bytes32 epochHash;\\n uint256 firstInputIndex;\\n uint256 lastInputIndex;\\n\\n // query the current consensus for the desired claim\\n (epochHash, firstInputIndex, lastInputIndex) = getClaim(_proof.context);\\n\\n // validate the epoch input index based on the input index range\\n // provided by the consensus\\n _proof.validity.validateInputIndexRange(\\n firstInputIndex,\\n lastInputIndex\\n );\\n\\n // reverts if proof isn't valid\\n _proof.validity.validateNotice(_notice, epochHash);\\n\\n return true;\\n }\\n\\n /// @notice Retrieve a claim about the DApp from the current consensus.\\n /// The encoding of `_proofContext` might vary depending on the implementation.\\n /// @param _proofContext Data for retrieving the desired claim\\n /// @return The claimed epoch hash\\n /// @return The index of the first input of the epoch in the input box\\n /// @return The index of the last input of the epoch in the input box\\n function getClaim(\\n bytes calldata _proofContext\\n ) internal view returns (bytes32, uint256, uint256) {\\n return consensus.getClaim(address(this), _proofContext);\\n }\\n\\n function migrateToConsensus(\\n IConsensus _newConsensus\\n ) external override onlyOwner {\\n consensus = _newConsensus;\\n\\n _newConsensus.join();\\n\\n emit NewConsensus(_newConsensus);\\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 /// @notice Accept Ether transfers.\\n /// @dev If you wish to transfer Ether to a DApp while informing\\n /// the DApp backend of it, then please do so through the Ether portal contract.\\n receive() external payable {}\\n\\n /// @notice Transfer some amount of Ether to some recipient.\\n /// @param _receiver The address which will receive the amount of Ether\\n /// @param _value The amount of Ether to be transferred in Wei\\n /// @dev This function can only be called by the DApp itself through vouchers.\\n /// If this method is not called by DApp itself, `OnlyDApp` error is raised.\\n /// If the transfer fails, `EtherTransferFailed` error is raised.\\n function withdrawEther(address _receiver, uint256 _value) external {\\n if (msg.sender != address(this)) {\\n revert OnlyDApp();\\n }\\n\\n (bool sent, ) = _receiver.call{value: _value}(\\\"\\\");\\n\\n if (!sent) {\\n revert EtherTransferFailed();\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe54766db1afcbb9578fffc1a87927d95673f1a630d88a7889941878a89761128\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/CartesiDAppFactory.sol\":{\"content\":\"// (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 {ICartesiDAppFactory} from \\\"./ICartesiDAppFactory.sol\\\";\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\nimport {CartesiDApp} from \\\"./CartesiDApp.sol\\\";\\n\\n/// @title Cartesi DApp Factory\\n/// @notice Allows anyone to reliably deploy a new `CartesiDApp` contract.\\ncontract CartesiDAppFactory is ICartesiDAppFactory {\\n function newApplication(\\n IConsensus _consensus,\\n address _dappOwner,\\n bytes32 _templateHash\\n ) external override returns (CartesiDApp) {\\n CartesiDApp application = new CartesiDApp(\\n _consensus,\\n _dappOwner,\\n _templateHash\\n );\\n\\n emit ApplicationCreated(\\n _consensus,\\n _dappOwner,\\n _templateHash,\\n application\\n );\\n\\n return application;\\n }\\n\\n function newApplication(\\n IConsensus _consensus,\\n address _dappOwner,\\n bytes32 _templateHash,\\n bytes32 _salt\\n ) external override returns (CartesiDApp) {\\n CartesiDApp application = new CartesiDApp{salt: _salt}(\\n _consensus,\\n _dappOwner,\\n _templateHash\\n );\\n\\n emit ApplicationCreated(\\n _consensus,\\n _dappOwner,\\n _templateHash,\\n application\\n );\\n\\n return application;\\n }\\n\\n function calculateApplicationAddress(\\n IConsensus _consensus,\\n address _dappOwner,\\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(CartesiDApp).creationCode,\\n abi.encode(_consensus, _dappOwner, _templateHash)\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0xd5f93d28a69df7dc63205026dc5a1865ee989a683f3e648812ded6cefb35f10d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/ICartesiDApp.sol\":{\"content\":\"// (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 \\\"../consensus/IConsensus.sol\\\";\\nimport {OutputValidityProof} from \\\"../library/LibOutputValidation.sol\\\";\\n\\n/// @notice Data for validating outputs.\\n/// @param validity A validity proof for the output\\n/// @param context Data for querying the right claim from the current consensus contract\\n/// @dev The encoding of `context` might vary depending on the implementation of the consensus contract.\\nstruct Proof {\\n OutputValidityProof validity;\\n bytes context;\\n}\\n\\n/// @title Cartesi DApp interface\\ninterface ICartesiDApp {\\n // Events\\n\\n /// @notice The DApp has migrated to another consensus contract.\\n /// @param newConsensus The new consensus contract\\n /// @dev MUST be triggered on a successful call to `migrateToConsensus`.\\n event NewConsensus(IConsensus newConsensus);\\n\\n /// @notice A voucher was executed from the DApp.\\n /// @param voucherId A number that uniquely identifies the voucher\\n /// amongst all vouchers emitted by this DApp\\n event VoucherExecuted(uint256 voucherId);\\n\\n // Permissioned functions\\n\\n /// @notice Migrate the DApp to a new consensus.\\n /// @param _newConsensus The new consensus\\n /// @dev Can only be called by the DApp owner.\\n function migrateToConsensus(IConsensus _newConsensus) external;\\n\\n // Permissionless functions\\n\\n /// @notice Try to execute a voucher.\\n ///\\n /// Reverts if voucher was already successfully executed.\\n ///\\n /// @param _destination The address that will receive the payload through a message call\\n /// @param _payload The payload, which\\u2014in the case of Solidity contracts\\u2014encodes a function call\\n /// @param _proof The proof used to validate the voucher against\\n /// a claim submitted by the current consensus contract\\n /// @return Whether the execution was successful or not\\n /// @dev On a successful execution, emits a `VoucherExecuted` event.\\n /// Execution of already executed voucher will raise a `VoucherReexecutionNotAllowed` error.\\n function executeVoucher(\\n address _destination,\\n bytes calldata _payload,\\n Proof calldata _proof\\n ) external returns (bool);\\n\\n /// @notice Check whether a voucher has been executed.\\n /// @param _inputIndex The index of the input in the input box\\n /// @param _outputIndexWithinInput The index of output emitted by the input\\n /// @return Whether the voucher has been executed before\\n function wasVoucherExecuted(\\n uint256 _inputIndex,\\n uint256 _outputIndexWithinInput\\n ) external view returns (bool);\\n\\n /// @notice Validate a notice.\\n /// @param _notice The notice\\n /// @param _proof Data for validating outputs\\n /// @return Whether the notice is valid or not\\n function validateNotice(\\n bytes calldata _notice,\\n Proof calldata _proof\\n ) external view returns (bool);\\n\\n /// @notice Get the DApp's template hash.\\n /// @return The DApp'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\":\"0x7bb375a4deb593af06955bbf1d88e096f4288f25fa032349796f93705d29386f\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/ICartesiDAppFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {CartesiDApp} from \\\"./CartesiDApp.sol\\\";\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\n\\n/// @title Cartesi DApp Factory interface\\ninterface ICartesiDAppFactory {\\n // Events\\n\\n /// @notice A new application was deployed.\\n /// @param consensus The initial consensus contract\\n /// @param dappOwner The initial DApp owner\\n /// @param templateHash The initial machine state hash\\n /// @param application The application\\n /// @dev MUST be triggered on a successful call to `newApplication`.\\n event ApplicationCreated(\\n IConsensus indexed consensus,\\n address dappOwner,\\n bytes32 templateHash,\\n CartesiDApp application\\n );\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new application.\\n /// @param _consensus The initial consensus contract\\n /// @param _dappOwner The initial DApp owner\\n /// @param _templateHash The initial machine state hash\\n /// @return The application\\n /// @dev On success, MUST emit an `ApplicationCreated` event.\\n function newApplication(\\n IConsensus _consensus,\\n address _dappOwner,\\n bytes32 _templateHash\\n ) external returns (CartesiDApp);\\n\\n /// @notice Deploy a new application deterministically.\\n /// @param _consensus The initial consensus contract\\n /// @param _dappOwner The initial DApp owner\\n /// @param _templateHash The initial machine state hash\\n /// @param _salt The salt used to deterministically generate the DApp address\\n /// @return The application\\n /// @dev On success, MUST emit an `ApplicationCreated` event.\\n function newApplication(\\n IConsensus _consensus,\\n address _dappOwner,\\n bytes32 _templateHash,\\n bytes32 _salt\\n ) external returns (CartesiDApp);\\n\\n /// @notice Calculate the address of an application to be deployed deterministically.\\n /// @param _consensus The initial consensus contract\\n /// @param _dappOwner The initial DApp owner\\n /// @param _templateHash The initial machine state hash\\n /// @param _salt The salt used to deterministically generate the DApp address\\n /// @return The deterministic application 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 _dappOwner,\\n bytes32 _templateHash,\\n bytes32 _salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0xb6d6ae44b2195f54a5c5ac85dc1c33801036878982c6b9aafe8fb66a3103517b\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/library/LibOutputValidation.sol\":{\"content\":\"// (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 {MerkleV2} from \\\"@cartesi/util/contracts/MerkleV2.sol\\\";\\nimport {OutputEncoding} from \\\"../common/OutputEncoding.sol\\\";\\n\\n/// @param inputIndexWithinEpoch Which input, inside the epoch, the output belongs to\\n/// @param outputIndexWithinInput Index of output emitted by the input\\n/// @param outputHashesRootHash Merkle root of hashes of outputs emitted by the input\\n/// @param vouchersEpochRootHash Merkle root of all epoch's voucher metadata hashes\\n/// @param noticesEpochRootHash Merkle root of all epoch's notice metadata hashes\\n/// @param machineStateHash Hash of the machine state claimed this epoch\\n/// @param outputHashInOutputHashesSiblings Proof that this output metadata is in metadata memory range\\n/// @param outputHashesInEpochSiblings Proof that this output metadata is in epoch's output memory range\\nstruct OutputValidityProof {\\n uint64 inputIndexWithinEpoch;\\n uint64 outputIndexWithinInput;\\n bytes32 outputHashesRootHash;\\n bytes32 vouchersEpochRootHash;\\n bytes32 noticesEpochRootHash;\\n bytes32 machineStateHash;\\n bytes32[] outputHashInOutputHashesSiblings;\\n bytes32[] outputHashesInEpochSiblings;\\n}\\n\\n/// @title Output Validation Library\\nlibrary LibOutputValidation {\\n using CanonicalMachine for CanonicalMachine.Log2Size;\\n\\n /// @notice Raised when some `OutputValidityProof` variables does not match\\n /// the presented finalized epoch.\\n error IncorrectEpochHash();\\n\\n /// @notice Raised when `OutputValidityProof` metadata memory range is NOT\\n /// contained in epoch's output memory range.\\n error IncorrectOutputsEpochRootHash();\\n\\n /// @notice Raised when Merkle root of output hash is NOT contained\\n /// in the output metadata array memory range.\\n error IncorrectOutputHashesRootHash();\\n\\n /// @notice Raised when epoch input index is NOT compatible with the\\n /// provided input index range.\\n error InputIndexOutOfClaimBounds();\\n\\n /// @notice Make sure the output proof is valid, otherwise revert.\\n /// @param v The output validity proof\\n /// @param encodedOutput The encoded output\\n /// @param epochHash The hash of the epoch in which the output was generated\\n /// @param outputsEpochRootHash Either `v.vouchersEpochRootHash` (for vouchers)\\n /// or `v.noticesEpochRootHash` (for notices)\\n /// @param outputEpochLog2Size Either `EPOCH_VOUCHER_LOG2_SIZE` (for vouchers)\\n /// or `EPOCH_NOTICE_LOG2_SIZE` (for notices)\\n /// @param outputHashesLog2Size Either `VOUCHER_METADATA_LOG2_SIZE` (for vouchers)\\n /// or `NOTICE_METADATA_LOG2_SIZE` (for notices)\\n function validateEncodedOutput(\\n OutputValidityProof calldata v,\\n bytes memory encodedOutput,\\n bytes32 epochHash,\\n bytes32 outputsEpochRootHash,\\n uint256 outputEpochLog2Size,\\n uint256 outputHashesLog2Size\\n ) internal pure {\\n // prove that outputs hash is represented in a finalized epoch\\n if (\\n keccak256(\\n abi.encodePacked(\\n v.vouchersEpochRootHash,\\n v.noticesEpochRootHash,\\n v.machineStateHash\\n )\\n ) != epochHash\\n ) {\\n revert IncorrectEpochHash();\\n }\\n\\n // prove that output metadata memory range is contained in epoch's output memory range\\n if (\\n MerkleV2.getRootAfterReplacementInDrive(\\n CanonicalMachine.getIntraMemoryRangePosition(\\n v.inputIndexWithinEpoch,\\n CanonicalMachine.KECCAK_LOG2_SIZE\\n ),\\n CanonicalMachine.KECCAK_LOG2_SIZE.uint64OfSize(),\\n outputEpochLog2Size,\\n v.outputHashesRootHash,\\n v.outputHashesInEpochSiblings\\n ) != outputsEpochRootHash\\n ) {\\n revert IncorrectOutputsEpochRootHash();\\n }\\n\\n // The hash of the output is converted to bytes (abi.encode) and\\n // treated as data. The metadata output memory range stores that data while\\n // being indifferent to its contents. To prove that the received\\n // output is contained in the metadata output memory range we need to\\n // prove that x, where:\\n // x = keccak(\\n // keccak(\\n // keccak(hashOfOutput[0:7]),\\n // keccak(hashOfOutput[8:15])\\n // ),\\n // keccak(\\n // keccak(hashOfOutput[16:23]),\\n // keccak(hashOfOutput[24:31])\\n // )\\n // )\\n // is contained in it. We can't simply use hashOfOutput because the\\n // log2size of the leaf is three (8 bytes) not five (32 bytes)\\n bytes32 merkleRootOfHashOfOutput = MerkleV2.getMerkleRootFromBytes(\\n abi.encodePacked(keccak256(encodedOutput)),\\n CanonicalMachine.KECCAK_LOG2_SIZE.uint64OfSize()\\n );\\n\\n // prove that Merkle root of bytes(hashOfOutput) is contained\\n // in the output metadata array memory range\\n if (\\n MerkleV2.getRootAfterReplacementInDrive(\\n CanonicalMachine.getIntraMemoryRangePosition(\\n v.outputIndexWithinInput,\\n CanonicalMachine.KECCAK_LOG2_SIZE\\n ),\\n CanonicalMachine.KECCAK_LOG2_SIZE.uint64OfSize(),\\n outputHashesLog2Size,\\n merkleRootOfHashOfOutput,\\n v.outputHashInOutputHashesSiblings\\n ) != v.outputHashesRootHash\\n ) {\\n revert IncorrectOutputHashesRootHash();\\n }\\n }\\n\\n /// @notice Make sure the output proof is valid, otherwise revert.\\n /// @param v The output validity proof\\n /// @param destination The address that will receive the payload through a message call\\n /// @param payload The payload, which\\u2014in the case of Solidity contracts\\u2014encodes a function call\\n /// @param epochHash The hash of the epoch in which the output was generated\\n function validateVoucher(\\n OutputValidityProof calldata v,\\n address destination,\\n bytes calldata payload,\\n bytes32 epochHash\\n ) internal pure {\\n bytes memory encodedVoucher = OutputEncoding.encodeVoucher(\\n destination,\\n payload\\n );\\n validateEncodedOutput(\\n v,\\n encodedVoucher,\\n epochHash,\\n v.vouchersEpochRootHash,\\n CanonicalMachine.EPOCH_VOUCHER_LOG2_SIZE.uint64OfSize(),\\n CanonicalMachine.VOUCHER_METADATA_LOG2_SIZE.uint64OfSize()\\n );\\n }\\n\\n /// @notice Make sure the output proof is valid, otherwise revert.\\n /// @param v The output validity proof\\n /// @param notice The notice\\n /// @param epochHash The hash of the epoch in which the output was generated\\n function validateNotice(\\n OutputValidityProof calldata v,\\n bytes calldata notice,\\n bytes32 epochHash\\n ) internal pure {\\n bytes memory encodedNotice = OutputEncoding.encodeNotice(notice);\\n validateEncodedOutput(\\n v,\\n encodedNotice,\\n epochHash,\\n v.noticesEpochRootHash,\\n CanonicalMachine.EPOCH_NOTICE_LOG2_SIZE.uint64OfSize(),\\n CanonicalMachine.NOTICE_METADATA_LOG2_SIZE.uint64OfSize()\\n );\\n }\\n\\n /// @notice Get the position of a voucher on the bit mask.\\n /// @param voucher The index of voucher from those generated by such input\\n /// @param input The index of the input in the DApp's input box\\n /// @return Position of the voucher on the bit mask\\n function getBitMaskPosition(\\n uint256 voucher,\\n uint256 input\\n ) internal pure returns (uint256) {\\n // voucher * 2 ** 128 + input\\n // this shouldn't overflow because it is impossible to have > 2**128 vouchers\\n // and because we are assuming there will be < 2 ** 128 inputs on the input box\\n return (((voucher << 128) | input));\\n }\\n\\n /// @notice Validate input index range and get the input index.\\n /// @param v The output validity proof\\n /// @param firstInputIndex The index of the first input of the epoch in the input box\\n /// @param lastInputIndex The index of the last input of the epoch in the input box\\n /// @return The index of the input in the DApp's input box\\n /// @dev Reverts if epoch input index is not compatible with the provided input index range.\\n function validateInputIndexRange(\\n OutputValidityProof calldata v,\\n uint256 firstInputIndex,\\n uint256 lastInputIndex\\n ) internal pure returns (uint256) {\\n uint256 inputIndex = firstInputIndex + v.inputIndexWithinEpoch;\\n\\n if (inputIndex > lastInputIndex) {\\n revert InputIndexOutOfClaimBounds();\\n }\\n\\n return inputIndex;\\n }\\n}\\n\",\"keccak256\":\"0x874ef478bd265acc94f2480a97191da907f05c6b46dc9e901c534b6acab14e03\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50611af9806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80630e1a07f5146100465780633648bfb514610075578063bd4f121914610088575b600080fd5b6100596100543660046102df565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b610059610083366004610325565b610148565b6100596100963660046102df565b6101ef565b600080828686866040516100ae906102ba565b6001600160a01b03938416815292909116602083015260408201526060018190604051809103906000f59050801580156100ec573d6000803e3d6000fd5b50604080516001600160a01b03888116825260208201889052838116828401529151929350908816917fe73165c2d277daf8713fd08b40845cb6bb7a20b2b543f3d35324a475660fcebd9181900360600190a295945050505050565b60008084848460405161015a906102ba565b6001600160a01b0393841681529290911660208301526040820152606001604051809103906000f080158015610194573d6000803e3d6000fd5b50604080516001600160a01b03878116825260208201879052838116828401529151929350908716917fe73165c2d277daf8713fd08b40845cb6bb7a20b2b543f3d35324a475660fcebd9181900360600190a2949350505050565b60006102738260405180602001610205906102ba565b601f1982820381018352601f9091011660408181526001600160a01b038a811660208401528916908201526060810187905260800160408051601f19818403018152908290526102589291602001610396565b6040516020818303038152906040528051906020012061027c565b95945050505050565b6000610289838330610290565b9392505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b611710806103b483390190565b6001600160a01b03811681146102dc57600080fd5b50565b600080600080608085870312156102f557600080fd5b8435610300816102c7565b93506020850135610310816102c7565b93969395505050506040820135916060013590565b60008060006060848603121561033a57600080fd5b8335610345816102c7565b92506020840135610355816102c7565b929592945050506040919091013590565b6000815160005b81811015610387576020818501810151868301520161036d565b50600093019283525090919050565b60006103ab6103a58386610366565b84610366565b94935050505056fe60a06040523480156200001157600080fd5b506040516200171038038062001710833981016040819052620000349162000212565b6200003f33620000cb565b600180556200004e826200011b565b6080819052600380546001600160a01b0319166001600160a01b0385169081179091556040805163b688a36360e01b8152905163b688a3639160048082019260009290919082900301818387803b158015620000a957600080fd5b505af1158015620000be573d6000803e3d6000fd5b505050505050506200025a565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b620001256200019e565b6001600160a01b038116620001905760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6200019b81620000cb565b50565b6000546001600160a01b03163314620001fa5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000187565b565b6001600160a01b03811681146200019b57600080fd5b6000806000606084860312156200022857600080fd5b83516200023581620001fc565b60208501519093506200024881620001fc565b80925050604084015190509250925092565b60805161149a6200027660003960006101ec015261149a6000f3fe6080604052600436106100e15760003560e01c80638da5cb5b1161007f578063bc197c8111610059578063bc197c8114610288578063f23a6e61146102b4578063f2fde38b146102e0578063fc4116831461030057600080fd5b80638da5cb5b1461022a57806396487d46146102485780639d9b11451461026857600080fd5b8063179e740b116100bb578063179e740b14610186578063522f6815146101b857806361b12c66146101da578063715018a61461021557600080fd5b806301ffc9a7146100ed5780631250482f14610122578063150b7a021461014257600080fd5b366100e857005b600080fd5b3480156100f957600080fd5b5061010d610108366004610d2a565b610320565b60405190151581526020015b60405180910390f35b34801561012e57600080fd5b5061010d61013d366004610dd0565b610357565b34801561014e57600080fd5b5061016d61015d366004610f00565b630a85bd0160e11b949350505050565b6040516001600160e01b03199091168152602001610119565b34801561019257600080fd5b506003546001600160a01b03165b6040516001600160a01b039091168152602001610119565b3480156101c457600080fd5b506101d86101d3366004610f5f565b61053c565b005b3480156101e657600080fd5b506040517f00000000000000000000000000000000000000000000000000000000000000008152602001610119565b34801561022157600080fd5b506101d86105d5565b34801561023657600080fd5b506000546001600160a01b03166101a0565b34801561025457600080fd5b5061010d610263366004610f8b565b6105e9565b34801561027457600080fd5b5061010d610283366004610ff3565b61063a565b34801561029457600080fd5b5061016d6102a3366004611094565b63bc197c8160e01b95945050505050565b3480156102c057600080fd5b5061016d6102cf366004611141565b63f23a6e6160e01b95945050505050565b3480156102ec57600080fd5b506101d86102fb3660046111a9565b61064c565b34801561030c57600080fd5b506101d861031b3660046111a9565b6106ca565b60006001600160e01b03198216630271189760e51b148061035157506301ffc9a760e01b6001600160e01b03198316145b92915050565b600061036161077f565b600080808061037b61037660208801886111c6565b6107d8565b919550935091506103988383610391898061120c565b919061085f565b90506103b4898989876103ab8b8061120c565b939291906108a5565b60006103e86103c3888061120c565b6103d490604081019060200161122c565b6001600160401b03168360809190911b1790565b90506103f3816108da565b15610411576040516370de22b760e01b815260040160405180910390fd5b60008a6001600160a01b03168a8a60405161042d929190611255565b6000604051808303816000865af19150503d806000811461046a576040519150601f19603f3d011682016040523d82523d6000602084013e61046f565b606091505b505090508015610524576040516306449da160e41b815260026004820152602481018390526001604482015273F5B2d8c81cDE4D6238bBf20D3D77DB37df13f73590636449da109060640160006040518083038186803b1580156104d257600080fd5b505af41580156104e6573d6000803e3d6000fd5b505050507f0eb7ee080f865f1cadc4f54daf58cc3b8879e888832867d13351edcec0fbdc548260405161051b91815260200190565b60405180910390a15b9550505050505061053460018055565b949350505050565b33301461055c5760405163a08d601d60e01b815260040160405180910390fd5b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146105a9576040519150601f19603f3d011682016040523d82523d6000602084013e6105ae565b606091505b50509050806105d057604051630ce8f45160e31b815260040160405180910390fd5b505050565b6105dd610958565b6105e760006109b2565b565b60008080806105fe61037660208701876111c6565b919450925090506106148282610391888061120c565b5061062d878785610625898061120c565b929190610a02565b5060019695505050505050565b6000608082901b8317610534816108da565b610654610958565b6001600160a01b0381166106be5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6106c7816109b2565b50565b6106d2610958565b600380546001600160a01b0319166001600160a01b0383169081179091556040805163b688a36360e01b8152905163b688a3639160048082019260009290919082900301818387803b15801561072757600080fd5b505af115801561073b573d6000803e3d6000fd5b50506040516001600160a01b03841681527f4991c6f37185659e276ff918a96f3e20e6c5abcd8c9aab450dc19c2f7ad35cb59250602001905060405180910390a150565b6002600154036107d15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016106b5565b6002600155565b60035460405163035e6a0960e61b8152600091829182916001600160a01b03169063d79a8240906108119030908990899060040161128e565b606060405180830381865afa15801561082e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085291906112bc565b9250925092509250925092565b60008061086f602086018661122c565b610882906001600160401b0316856112ea565b9050828111156105345760405163fd9ae91f60e01b815260040160405180910390fd5b60006108b2858585610a29565b90506108d2868284606083013560255b6001600160401b03166015610a58565b505050505050565b6040516303fbaf7360e01b8152600260048201526024810182905260009073F5B2d8c81cDE4D6238bBf20D3D77DB37df13f735906303fbaf7390604401602060405180830381865af4158015610934573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610351919061130b565b6000546001600160a01b031633146105e75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106b5565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610a0e8484610cfe565b9050610a22858284608083013560256108c2565b5050505050565b6060838383604051602001610a409392919061128e565b60405160208183030381529060405290509392505050565b6040805160608089013560208301526080808a01359383019390935260a0890135908201528591016040516020818303038152906040528051906020012014610ab457604051636fbd3b7160e11b815260040160405180910390fd5b827333436035441927Df1a73FE3AAC5906854632e53d6379de4601610af0610adf60208b018b61122c565b60051b681fffffffffffffffe01690565b60058660408c0135610b0560e08e018e61132d565b6040518763ffffffff1660e01b8152600401610b2696959493929190611376565b602060405180830381865af4158015610b43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6791906113d9565b14610b8557604051634371daa160e11b815260040160405180910390fd5b60007333436035441927Df1a73FE3AAC5906854632e53d63c84583a18780519060200120604051602001610bbb91815260200190565b60408051601f19818403018152908290526001600160e01b031960e084901b168252610bec916005906004016113f2565b602060405180830381865af4158015610c09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2d91906113d9565b905086604001357333436035441927Df1a73FE3AAC5906854632e53d6379de4601610c648a6020016020810190610adf919061122c565b60058686610c7560c08f018f61132d565b6040518763ffffffff1660e01b8152600401610c9696959493929190611376565b602060405180830381865af4158015610cb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd791906113d9565b14610cf55760405163017c689560e61b815260040160405180910390fd5b50505050505050565b60608282604051602001610d13929190611450565b604051602081830303815290604052905092915050565b600060208284031215610d3c57600080fd5b81356001600160e01b031981168114610d5457600080fd5b9392505050565b6001600160a01b03811681146106c757600080fd5b60008083601f840112610d8257600080fd5b5081356001600160401b03811115610d9957600080fd5b602083019150836020828501011115610db157600080fd5b9250929050565b600060408284031215610dca57600080fd5b50919050565b60008060008060608587031215610de657600080fd5b8435610df181610d5b565b935060208501356001600160401b0380821115610e0d57600080fd5b610e1988838901610d70565b90955093506040870135915080821115610e3257600080fd5b50610e3f87828801610db8565b91505092959194509250565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715610e8957610e89610e4b565b604052919050565b600082601f830112610ea257600080fd5b81356001600160401b03811115610ebb57610ebb610e4b565b610ece601f8201601f1916602001610e61565b818152846020838601011115610ee357600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215610f1657600080fd5b8435610f2181610d5b565b93506020850135610f3181610d5b565b92506040850135915060608501356001600160401b03811115610f5357600080fd5b610e3f87828801610e91565b60008060408385031215610f7257600080fd5b8235610f7d81610d5b565b946020939093013593505050565b600080600060408486031215610fa057600080fd5b83356001600160401b0380821115610fb757600080fd5b610fc387838801610d70565b90955093506020860135915080821115610fdc57600080fd5b50610fe986828701610db8565b9150509250925092565b6000806040838503121561100657600080fd5b50508035926020909101359150565b600082601f83011261102657600080fd5b813560206001600160401b0382111561104157611041610e4b565b8160051b611050828201610e61565b928352848101820192828101908785111561106a57600080fd5b83870192505b8483101561108957823582529183019190830190611070565b979650505050505050565b600080600080600060a086880312156110ac57600080fd5b85356110b781610d5b565b945060208601356110c781610d5b565b935060408601356001600160401b03808211156110e357600080fd5b6110ef89838a01611015565b9450606088013591508082111561110557600080fd5b61111189838a01611015565b9350608088013591508082111561112757600080fd5b5061113488828901610e91565b9150509295509295909350565b600080600080600060a0868803121561115957600080fd5b853561116481610d5b565b9450602086013561117481610d5b565b9350604086013592506060860135915060808601356001600160401b0381111561119d57600080fd5b61113488828901610e91565b6000602082840312156111bb57600080fd5b8135610d5481610d5b565b6000808335601e198436030181126111dd57600080fd5b8301803591506001600160401b038211156111f757600080fd5b602001915036819003821315610db157600080fd5b6000823560fe1983360301811261122257600080fd5b9190910192915050565b60006020828403121561123e57600080fd5b81356001600160401b0381168114610d5457600080fd5b8183823760009101908152919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03841681526040602082018190526000906112b39083018486611265565b95945050505050565b6000806000606084860312156112d157600080fd5b8351925060208401519150604084015190509250925092565b8082018082111561035157634e487b7160e01b600052601160045260246000fd5b60006020828403121561131d57600080fd5b81518015158114610d5457600080fd5b6000808335601e1984360301811261134457600080fd5b8301803591506001600160401b0382111561135e57600080fd5b6020019150600581901b3603821315610db157600080fd5b6001600160401b03878116825286166020820152604081018590526060810184905260a060808201819052810182905260006001600160fb1b038311156113bc57600080fd5b8260051b808560c08501379190910160c001979650505050505050565b6000602082840312156113eb57600080fd5b5051919050565b604081526000835180604084015260005b818110156114205760208187018101516060868401015201611403565b506000606082850101526060601f19601f8301168401019150506001600160401b03831660208301529392505050565b60208152600061053460208301848661126556fea2646970667358221220981835fbbf44aedaeb41e0c0c9001ffe55187a0b5606db0cdbf7500fc7c5e30e64736f6c63430008130033a2646970667358221220a12c770ef21751c306949fd9ed57ed453446a67f2dfb1d63d08c918461eca99764736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80630e1a07f5146100465780633648bfb514610075578063bd4f121914610088575b600080fd5b6100596100543660046102df565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b610059610083366004610325565b610148565b6100596100963660046102df565b6101ef565b600080828686866040516100ae906102ba565b6001600160a01b03938416815292909116602083015260408201526060018190604051809103906000f59050801580156100ec573d6000803e3d6000fd5b50604080516001600160a01b03888116825260208201889052838116828401529151929350908816917fe73165c2d277daf8713fd08b40845cb6bb7a20b2b543f3d35324a475660fcebd9181900360600190a295945050505050565b60008084848460405161015a906102ba565b6001600160a01b0393841681529290911660208301526040820152606001604051809103906000f080158015610194573d6000803e3d6000fd5b50604080516001600160a01b03878116825260208201879052838116828401529151929350908716917fe73165c2d277daf8713fd08b40845cb6bb7a20b2b543f3d35324a475660fcebd9181900360600190a2949350505050565b60006102738260405180602001610205906102ba565b601f1982820381018352601f9091011660408181526001600160a01b038a811660208401528916908201526060810187905260800160408051601f19818403018152908290526102589291602001610396565b6040516020818303038152906040528051906020012061027c565b95945050505050565b6000610289838330610290565b9392505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b611710806103b483390190565b6001600160a01b03811681146102dc57600080fd5b50565b600080600080608085870312156102f557600080fd5b8435610300816102c7565b93506020850135610310816102c7565b93969395505050506040820135916060013590565b60008060006060848603121561033a57600080fd5b8335610345816102c7565b92506020840135610355816102c7565b929592945050506040919091013590565b6000815160005b81811015610387576020818501810151868301520161036d565b50600093019283525090919050565b60006103ab6103a58386610366565b84610366565b94935050505056fe60a06040523480156200001157600080fd5b506040516200171038038062001710833981016040819052620000349162000212565b6200003f33620000cb565b600180556200004e826200011b565b6080819052600380546001600160a01b0319166001600160a01b0385169081179091556040805163b688a36360e01b8152905163b688a3639160048082019260009290919082900301818387803b158015620000a957600080fd5b505af1158015620000be573d6000803e3d6000fd5b505050505050506200025a565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b620001256200019e565b6001600160a01b038116620001905760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6200019b81620000cb565b50565b6000546001600160a01b03163314620001fa5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000187565b565b6001600160a01b03811681146200019b57600080fd5b6000806000606084860312156200022857600080fd5b83516200023581620001fc565b60208501519093506200024881620001fc565b80925050604084015190509250925092565b60805161149a6200027660003960006101ec015261149a6000f3fe6080604052600436106100e15760003560e01c80638da5cb5b1161007f578063bc197c8111610059578063bc197c8114610288578063f23a6e61146102b4578063f2fde38b146102e0578063fc4116831461030057600080fd5b80638da5cb5b1461022a57806396487d46146102485780639d9b11451461026857600080fd5b8063179e740b116100bb578063179e740b14610186578063522f6815146101b857806361b12c66146101da578063715018a61461021557600080fd5b806301ffc9a7146100ed5780631250482f14610122578063150b7a021461014257600080fd5b366100e857005b600080fd5b3480156100f957600080fd5b5061010d610108366004610d2a565b610320565b60405190151581526020015b60405180910390f35b34801561012e57600080fd5b5061010d61013d366004610dd0565b610357565b34801561014e57600080fd5b5061016d61015d366004610f00565b630a85bd0160e11b949350505050565b6040516001600160e01b03199091168152602001610119565b34801561019257600080fd5b506003546001600160a01b03165b6040516001600160a01b039091168152602001610119565b3480156101c457600080fd5b506101d86101d3366004610f5f565b61053c565b005b3480156101e657600080fd5b506040517f00000000000000000000000000000000000000000000000000000000000000008152602001610119565b34801561022157600080fd5b506101d86105d5565b34801561023657600080fd5b506000546001600160a01b03166101a0565b34801561025457600080fd5b5061010d610263366004610f8b565b6105e9565b34801561027457600080fd5b5061010d610283366004610ff3565b61063a565b34801561029457600080fd5b5061016d6102a3366004611094565b63bc197c8160e01b95945050505050565b3480156102c057600080fd5b5061016d6102cf366004611141565b63f23a6e6160e01b95945050505050565b3480156102ec57600080fd5b506101d86102fb3660046111a9565b61064c565b34801561030c57600080fd5b506101d861031b3660046111a9565b6106ca565b60006001600160e01b03198216630271189760e51b148061035157506301ffc9a760e01b6001600160e01b03198316145b92915050565b600061036161077f565b600080808061037b61037660208801886111c6565b6107d8565b919550935091506103988383610391898061120c565b919061085f565b90506103b4898989876103ab8b8061120c565b939291906108a5565b60006103e86103c3888061120c565b6103d490604081019060200161122c565b6001600160401b03168360809190911b1790565b90506103f3816108da565b15610411576040516370de22b760e01b815260040160405180910390fd5b60008a6001600160a01b03168a8a60405161042d929190611255565b6000604051808303816000865af19150503d806000811461046a576040519150601f19603f3d011682016040523d82523d6000602084013e61046f565b606091505b505090508015610524576040516306449da160e41b815260026004820152602481018390526001604482015273__$f57eb21c11c6dae369da3ca36f4f48eb77$__90636449da109060640160006040518083038186803b1580156104d257600080fd5b505af41580156104e6573d6000803e3d6000fd5b505050507f0eb7ee080f865f1cadc4f54daf58cc3b8879e888832867d13351edcec0fbdc548260405161051b91815260200190565b60405180910390a15b9550505050505061053460018055565b949350505050565b33301461055c5760405163a08d601d60e01b815260040160405180910390fd5b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146105a9576040519150601f19603f3d011682016040523d82523d6000602084013e6105ae565b606091505b50509050806105d057604051630ce8f45160e31b815260040160405180910390fd5b505050565b6105dd610958565b6105e760006109b2565b565b60008080806105fe61037660208701876111c6565b919450925090506106148282610391888061120c565b5061062d878785610625898061120c565b929190610a02565b5060019695505050505050565b6000608082901b8317610534816108da565b610654610958565b6001600160a01b0381166106be5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6106c7816109b2565b50565b6106d2610958565b600380546001600160a01b0319166001600160a01b0383169081179091556040805163b688a36360e01b8152905163b688a3639160048082019260009290919082900301818387803b15801561072757600080fd5b505af115801561073b573d6000803e3d6000fd5b50506040516001600160a01b03841681527f4991c6f37185659e276ff918a96f3e20e6c5abcd8c9aab450dc19c2f7ad35cb59250602001905060405180910390a150565b6002600154036107d15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016106b5565b6002600155565b60035460405163035e6a0960e61b8152600091829182916001600160a01b03169063d79a8240906108119030908990899060040161128e565b606060405180830381865afa15801561082e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085291906112bc565b9250925092509250925092565b60008061086f602086018661122c565b610882906001600160401b0316856112ea565b9050828111156105345760405163fd9ae91f60e01b815260040160405180910390fd5b60006108b2858585610a29565b90506108d2868284606083013560255b6001600160401b03166015610a58565b505050505050565b6040516303fbaf7360e01b8152600260048201526024810182905260009073__$f57eb21c11c6dae369da3ca36f4f48eb77$__906303fbaf7390604401602060405180830381865af4158015610934573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610351919061130b565b6000546001600160a01b031633146105e75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106b5565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610a0e8484610cfe565b9050610a22858284608083013560256108c2565b5050505050565b6060838383604051602001610a409392919061128e565b60405160208183030381529060405290509392505050565b6040805160608089013560208301526080808a01359383019390935260a0890135908201528591016040516020818303038152906040528051906020012014610ab457604051636fbd3b7160e11b815260040160405180910390fd5b8273__$2a7ef22e717e9afc55afc95d018bf1a85b$__6379de4601610af0610adf60208b018b61122c565b60051b681fffffffffffffffe01690565b60058660408c0135610b0560e08e018e61132d565b6040518763ffffffff1660e01b8152600401610b2696959493929190611376565b602060405180830381865af4158015610b43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6791906113d9565b14610b8557604051634371daa160e11b815260040160405180910390fd5b600073__$2a7ef22e717e9afc55afc95d018bf1a85b$__63c84583a18780519060200120604051602001610bbb91815260200190565b60408051601f19818403018152908290526001600160e01b031960e084901b168252610bec916005906004016113f2565b602060405180830381865af4158015610c09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2d91906113d9565b9050866040013573__$2a7ef22e717e9afc55afc95d018bf1a85b$__6379de4601610c648a6020016020810190610adf919061122c565b60058686610c7560c08f018f61132d565b6040518763ffffffff1660e01b8152600401610c9696959493929190611376565b602060405180830381865af4158015610cb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd791906113d9565b14610cf55760405163017c689560e61b815260040160405180910390fd5b50505050505050565b60608282604051602001610d13929190611450565b604051602081830303815290604052905092915050565b600060208284031215610d3c57600080fd5b81356001600160e01b031981168114610d5457600080fd5b9392505050565b6001600160a01b03811681146106c757600080fd5b60008083601f840112610d8257600080fd5b5081356001600160401b03811115610d9957600080fd5b602083019150836020828501011115610db157600080fd5b9250929050565b600060408284031215610dca57600080fd5b50919050565b60008060008060608587031215610de657600080fd5b8435610df181610d5b565b935060208501356001600160401b0380821115610e0d57600080fd5b610e1988838901610d70565b90955093506040870135915080821115610e3257600080fd5b50610e3f87828801610db8565b91505092959194509250565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715610e8957610e89610e4b565b604052919050565b600082601f830112610ea257600080fd5b81356001600160401b03811115610ebb57610ebb610e4b565b610ece601f8201601f1916602001610e61565b818152846020838601011115610ee357600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215610f1657600080fd5b8435610f2181610d5b565b93506020850135610f3181610d5b565b92506040850135915060608501356001600160401b03811115610f5357600080fd5b610e3f87828801610e91565b60008060408385031215610f7257600080fd5b8235610f7d81610d5b565b946020939093013593505050565b600080600060408486031215610fa057600080fd5b83356001600160401b0380821115610fb757600080fd5b610fc387838801610d70565b90955093506020860135915080821115610fdc57600080fd5b50610fe986828701610db8565b9150509250925092565b6000806040838503121561100657600080fd5b50508035926020909101359150565b600082601f83011261102657600080fd5b813560206001600160401b0382111561104157611041610e4b565b8160051b611050828201610e61565b928352848101820192828101908785111561106a57600080fd5b83870192505b8483101561108957823582529183019190830190611070565b979650505050505050565b600080600080600060a086880312156110ac57600080fd5b85356110b781610d5b565b945060208601356110c781610d5b565b935060408601356001600160401b03808211156110e357600080fd5b6110ef89838a01611015565b9450606088013591508082111561110557600080fd5b61111189838a01611015565b9350608088013591508082111561112757600080fd5b5061113488828901610e91565b9150509295509295909350565b600080600080600060a0868803121561115957600080fd5b853561116481610d5b565b9450602086013561117481610d5b565b9350604086013592506060860135915060808601356001600160401b0381111561119d57600080fd5b61113488828901610e91565b6000602082840312156111bb57600080fd5b8135610d5481610d5b565b6000808335601e198436030181126111dd57600080fd5b8301803591506001600160401b038211156111f757600080fd5b602001915036819003821315610db157600080fd5b6000823560fe1983360301811261122257600080fd5b9190910192915050565b60006020828403121561123e57600080fd5b81356001600160401b0381168114610d5457600080fd5b8183823760009101908152919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03841681526040602082018190526000906112b39083018486611265565b95945050505050565b6000806000606084860312156112d157600080fd5b8351925060208401519150604084015190509250925092565b8082018082111561035157634e487b7160e01b600052601160045260246000fd5b60006020828403121561131d57600080fd5b81518015158114610d5457600080fd5b6000808335601e1984360301811261134457600080fd5b8301803591506001600160401b0382111561135e57600080fd5b6020019150600581901b3603821315610db157600080fd5b6001600160401b03878116825286166020820152604081018590526060810184905260a060808201819052810182905260006001600160fb1b038311156113bc57600080fd5b8260051b808560c08501379190910160c001979650505050505050565b6000602082840312156113eb57600080fd5b5051919050565b604081526000835180604084015260005b818110156114205760208187018101516060868401015201611403565b506000606082850101526060601f19601f8301168401019150506001600160401b03831660208301529392505050565b60208152600061053460208301848661126556fea2646970667358221220981835fbbf44aedaeb41e0c0c9001ffe55187a0b5606db0cdbf7500fc7c5e30e64736f6c63430008130033a2646970667358221220a12c770ef21751c306949fd9ed57ed453446a67f2dfb1d63d08c918461eca99764736f6c63430008130033", - "libraries": { - "Bitmask": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", - "MerkleV2": "0x33436035441927Df1a73FE3AAC5906854632e53d" - }, - "devdoc": { - "events": { - "ApplicationCreated(address,address,bytes32,address)": { - "details": "MUST be triggered on a successful call to `newApplication`.", - "params": { - "application": "The application", - "consensus": "The initial consensus contract", - "dappOwner": "The initial DApp owner", - "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": { - "_consensus": "The initial consensus contract", - "_dappOwner": "The initial DApp owner", - "_salt": "The salt used to deterministically generate the DApp address", - "_templateHash": "The initial machine state hash" - }, - "returns": { - "_0": "The deterministic application address" - } - }, - "newApplication(address,address,bytes32)": { - "details": "On success, MUST emit an `ApplicationCreated` event.", - "params": { - "_consensus": "The initial consensus contract", - "_dappOwner": "The initial DApp owner", - "_templateHash": "The initial machine state hash" - }, - "returns": { - "_0": "The application" - } - }, - "newApplication(address,address,bytes32,bytes32)": { - "details": "On success, MUST emit an `ApplicationCreated` event.", - "params": { - "_consensus": "The initial consensus contract", - "_dappOwner": "The initial DApp owner", - "_salt": "The salt used to deterministically generate the DApp address", - "_templateHash": "The initial machine state hash" - }, - "returns": { - "_0": "The application" - } - } - }, - "title": "Cartesi DApp 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 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 `CartesiDApp` 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 deleted file mode 100644 index f2446b7a9..000000000 --- a/deployments/arbitrum_sepolia/ERC1155BatchPortal.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "address": "0xedB53860A6B52bbb7561Ad596416ee9965B055Aa", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC1155", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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": "0xad57029be5e35599a1e0a9a4a1aa8c3e58bc455c8664c95f51e486627f445fec", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", - "contractAddress": null, - "transactionIndex": 1, - "gasUsed": "370846", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xc6ea1146d843379f91cc15911ab8b69f6cc010886410fc2f91442f859f187b22", - "transactionHash": "0xad57029be5e35599a1e0a9a4a1aa8c3e58bc455c8664c95f51e486627f445fec", - "logs": [], - "blockNumber": 2838761, - "cumulativeGasUsed": "370846", - "status": 1, - "byzantium": true - }, - "args": [ - "0x59b22D57D4f067708AB0c00552767405926dc768" - ], - "numDeployments": 1, - "solcInputHash": "54ee33aea592269e6046663615f287b6", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"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\":\"_dapp\",\"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 `_tokenIds` and `_values` have the same length.\",\"params\":{\"_baseLayerData\":\"Additional data to be interpreted by the base layer\",\"_dapp\":\"The address of the DApp\",\"_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 to a DApp and add an input to the DApp'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 input relay.\"}},\"notice\":\"This contract allows anyone to perform batch transfers of ERC-1155 tokens to a DApp 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 v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token 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 amount 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 `amount` tokens of token type `id` from `from` to `to`.\\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 `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 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` 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 amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon 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 caller.\\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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"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 and relays.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Ether being sent in Wei\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\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 ret The return value of `transferFrom`\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param amount The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\n function encodeERC20Deposit(\\n bool ret,\\n IERC20 token,\\n address sender,\\n uint256 amount,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n ret, // 1B\\n token, // 20B\\n sender, // 20B\\n amount, // 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\\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\\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\\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 /// @notice Encode a DApp address relay.\\n /// @param dapp The DApp address\\n /// @return The encoded input\\n function encodeDAppAddressRelay(\\n address dapp\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n dapp // 20B\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5dce266a7b70ba86adf6a728c7667255d3e2b20f1789a951150a1d05439b7019\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputRelay.sol\":{\"content\":\"// (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 \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay interface\\ninterface IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this input relay.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x8c9316c43cc2c7754fbd5abccfcdbc5ed09a2f1228d993240eac6c41ea531521\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/InputRelay.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputRelay} from \\\"./IInputRelay.sol\\\";\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay\\n/// @notice This contract serves as a base for all the other input relays.\\ncontract InputRelay is IInputRelay {\\n /// @notice The input box used by the input relay.\\n IInputBox internal immutable inputBox;\\n\\n /// @notice Constructs the input relay.\\n /// @param _inputBox The input box used by the input relay\\n constructor(IInputBox _inputBox) {\\n inputBox = _inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return inputBox;\\n }\\n}\\n\",\"keccak256\":\"0xbb489f157a0bd7a9da29b0bf3c47c4b4051d90ccd252abc3f81c8e897329e590\",\"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 {InputRelay} from \\\"../inputs/InputRelay.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 a DApp while informing the off-chain machine.\\ncontract ERC1155BatchPortal is InputRelay, IERC1155BatchPortal {\\n /// @notice Constructs the portal.\\n /// @param _inputBox The input box used by the portal\\n constructor(IInputBox _inputBox) InputRelay(_inputBox) {}\\n\\n function depositBatchERC1155Token(\\n IERC1155 _token,\\n address _dapp,\\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 _dapp,\\n _tokenIds,\\n _values,\\n _baseLayerData\\n );\\n\\n bytes memory input = InputEncoding.encodeBatchERC1155Deposit(\\n _token,\\n msg.sender,\\n _tokenIds,\\n _values,\\n _baseLayerData,\\n _execLayerData\\n );\\n\\n inputBox.addInput(_dapp, input);\\n }\\n}\\n\",\"keccak256\":\"0x8aab3384ab673cf9dd34da33b2a1c9efbbfb4960acaee44c7d50c63344237d86\",\"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 {IInputRelay} from \\\"../inputs/IInputRelay.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title ERC-1155 Batch Transfer Portal interface\\ninterface IERC1155BatchPortal is IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Transfer a batch of ERC-1155 tokens to a DApp and add an input to\\n /// the DApp'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 _dapp The address of the DApp\\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 `_tokenIds` and `_values` have the same length.\\n function depositBatchERC1155Token(\\n IERC1155 _token,\\n address _dapp,\\n uint256[] calldata _tokenIds,\\n uint256[] calldata _values,\\n bytes calldata _baseLayerData,\\n bytes calldata _execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0xfd76007f27ca0b4886d477eabdbda517e6a4a139c2b044cd8b59debf4894016d\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b5060405161064538038061064583398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516105b461009160003960008181603c015261012601526105b46000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806324d15c6714610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a6100853660046102c1565b61008c565b005b604051631759616b60e11b81526001600160a01b038b1690632eb2c2d6906100c69033908d908d908d908d908d908d908d90600401610404565b600060405180830381600087803b1580156100e057600080fd5b505af11580156100f4573d6000803e3d6000fd5b50505050600061010c8b338b8b8b8b8b8b8b8b6101ae565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061015d908d90859060040161048c565b6020604051808303816000875af115801561017c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a091906104ce565b505050505050505050505050565b6060600089898989898989896040516020016101d19897969594939291906104e7565b60405160208183030381529060405290508b8b826040516020016101f793929190610538565b6040516020818303038152906040529150509a9950505050505050505050565b80356001600160a01b038116811461022e57600080fd5b919050565b60008083601f84011261024557600080fd5b50813567ffffffffffffffff81111561025d57600080fd5b6020830191508360208260051b850101111561027857600080fd5b9250929050565b60008083601f84011261029157600080fd5b50813567ffffffffffffffff8111156102a957600080fd5b60208301915083602082850101111561027857600080fd5b60008060008060008060008060008060c08b8d0312156102e057600080fd5b6102e98b610217565b99506102f760208c01610217565b985060408b013567ffffffffffffffff8082111561031457600080fd5b6103208e838f01610233565b909a50985060608d013591508082111561033957600080fd5b6103458e838f01610233565b909850965060808d013591508082111561035e57600080fd5b61036a8e838f0161027f565b909650945060a08d013591508082111561038357600080fd5b506103908d828e0161027f565b915080935050809150509295989b9194979a5092959850565b81835260006001600160fb1b038311156103c257600080fd5b8260051b80836020870137939093016020019392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0389811682528816602082015260a060408201819052600090610431908301888a6103a9565b82810360608401526104448187896103a9565b905082810360808401526104598185876103db565b9b9a5050505050505050505050565b60005b8381101561048357818101518382015260200161046b565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526104b9816060850160208701610468565b601f01601f1916919091016060019392505050565b6000602082840312156104e057600080fd5b5051919050565b6080815260006104fb608083018a8c6103a9565b828103602084015261050e81898b6103a9565b905082810360408401526105238187896103db565b905082810360608401526104598185876103db565b60006bffffffffffffffffffffffff19808660601b168352808560601b16601484015250825161056f816028850160208701610468565b9190910160280194935050505056fea2646970667358221220b1261ceaf7c0f69c5d0d611864ae36802a7987738f02b3c9f93c1843357f32eb64736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806324d15c6714610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a6100853660046102c1565b61008c565b005b604051631759616b60e11b81526001600160a01b038b1690632eb2c2d6906100c69033908d908d908d908d908d908d908d90600401610404565b600060405180830381600087803b1580156100e057600080fd5b505af11580156100f4573d6000803e3d6000fd5b50505050600061010c8b338b8b8b8b8b8b8b8b6101ae565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061015d908d90859060040161048c565b6020604051808303816000875af115801561017c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a091906104ce565b505050505050505050505050565b6060600089898989898989896040516020016101d19897969594939291906104e7565b60405160208183030381529060405290508b8b826040516020016101f793929190610538565b6040516020818303038152906040529150509a9950505050505050505050565b80356001600160a01b038116811461022e57600080fd5b919050565b60008083601f84011261024557600080fd5b50813567ffffffffffffffff81111561025d57600080fd5b6020830191508360208260051b850101111561027857600080fd5b9250929050565b60008083601f84011261029157600080fd5b50813567ffffffffffffffff8111156102a957600080fd5b60208301915083602082850101111561027857600080fd5b60008060008060008060008060008060c08b8d0312156102e057600080fd5b6102e98b610217565b99506102f760208c01610217565b985060408b013567ffffffffffffffff8082111561031457600080fd5b6103208e838f01610233565b909a50985060608d013591508082111561033957600080fd5b6103458e838f01610233565b909850965060808d013591508082111561035e57600080fd5b61036a8e838f0161027f565b909650945060a08d013591508082111561038357600080fd5b506103908d828e0161027f565b915080935050809150509295989b9194979a5092959850565b81835260006001600160fb1b038311156103c257600080fd5b8260051b80836020870137939093016020019392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0389811682528816602082015260a060408201819052600090610431908301888a6103a9565b82810360608401526104448187896103a9565b905082810360808401526104598185876103db565b9b9a5050505050505050505050565b60005b8381101561048357818101518382015260200161046b565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526104b9816060850160208701610468565b601f01601f1916919091016060019392505050565b6000602082840312156104e057600080fd5b5051919050565b6080815260006104fb608083018a8c6103a9565b828103602084015261050e81898b6103a9565b905082810360408401526105238187896103db565b905082810360608401526104598185876103db565b60006bffffffffffffffffffffffff19808660601b168352808560601b16601484015250825161056f816028850160208701610468565b9190910160280194935050505056fea2646970667358221220b1261ceaf7c0f69c5d0d611864ae36802a7987738f02b3c9f93c1843357f32eb64736f6c63430008130033", - "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 `_tokenIds` and `_values` have the same length.", - "params": { - "_baseLayerData": "Additional data to be interpreted by the base layer", - "_dapp": "The address of the DApp", - "_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 to a DApp and add an input to the DApp'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 input relay." - } - }, - "notice": "This contract allows anyone to perform batch transfers of ERC-1155 tokens to a DApp 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 deleted file mode 100644 index df2d93daa..000000000 --- a/deployments/arbitrum_sepolia/ERC1155SinglePortal.json +++ /dev/null @@ -1,122 +0,0 @@ -{ - "address": "0x7CFB0193Ca87eB6e48056885E026552c3A941FC4", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC1155", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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": [ - "0x59b22D57D4f067708AB0c00552767405926dc768" - ], - "numDeployments": 1, - "solcInputHash": "54ee33aea592269e6046663615f287b6", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"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\":\"_dapp\",\"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\":{\"_baseLayerData\":\"Additional data to be interpreted by the base layer\",\"_dapp\":\"The address of the DApp\",\"_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 an ERC-1155 token to a DApp and add an input to the DApp'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 input relay.\"}},\"notice\":\"This contract allows anyone to perform single transfers of ERC-1155 tokens to a DApp 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 v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token 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 amount 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 `amount` tokens of token type `id` from `from` to `to`.\\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 `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 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` 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 amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon 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 caller.\\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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"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 and relays.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Ether being sent in Wei\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\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 ret The return value of `transferFrom`\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param amount The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\n function encodeERC20Deposit(\\n bool ret,\\n IERC20 token,\\n address sender,\\n uint256 amount,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n ret, // 1B\\n token, // 20B\\n sender, // 20B\\n amount, // 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\\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\\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\\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 /// @notice Encode a DApp address relay.\\n /// @param dapp The DApp address\\n /// @return The encoded input\\n function encodeDAppAddressRelay(\\n address dapp\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n dapp // 20B\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5dce266a7b70ba86adf6a728c7667255d3e2b20f1789a951150a1d05439b7019\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputRelay.sol\":{\"content\":\"// (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 \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay interface\\ninterface IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this input relay.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x8c9316c43cc2c7754fbd5abccfcdbc5ed09a2f1228d993240eac6c41ea531521\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/InputRelay.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputRelay} from \\\"./IInputRelay.sol\\\";\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay\\n/// @notice This contract serves as a base for all the other input relays.\\ncontract InputRelay is IInputRelay {\\n /// @notice The input box used by the input relay.\\n IInputBox internal immutable inputBox;\\n\\n /// @notice Constructs the input relay.\\n /// @param _inputBox The input box used by the input relay\\n constructor(IInputBox _inputBox) {\\n inputBox = _inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return inputBox;\\n }\\n}\\n\",\"keccak256\":\"0xbb489f157a0bd7a9da29b0bf3c47c4b4051d90ccd252abc3f81c8e897329e590\",\"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 {InputRelay} from \\\"../inputs/InputRelay.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 a DApp while informing the off-chain machine.\\ncontract ERC1155SinglePortal is InputRelay, IERC1155SinglePortal {\\n /// @notice Constructs the portal.\\n /// @param _inputBox The input box used by the portal\\n constructor(IInputBox _inputBox) InputRelay(_inputBox) {}\\n\\n function depositSingleERC1155Token(\\n IERC1155 _token,\\n address _dapp,\\n uint256 _tokenId,\\n uint256 _value,\\n bytes calldata _baseLayerData,\\n bytes calldata _execLayerData\\n ) external override {\\n _token.safeTransferFrom(\\n msg.sender,\\n _dapp,\\n _tokenId,\\n _value,\\n _baseLayerData\\n );\\n\\n bytes memory input = InputEncoding.encodeSingleERC1155Deposit(\\n _token,\\n msg.sender,\\n _tokenId,\\n _value,\\n _baseLayerData,\\n _execLayerData\\n );\\n\\n inputBox.addInput(_dapp, input);\\n }\\n}\\n\",\"keccak256\":\"0x1647752c6abb80e283258cc863425845d31f3b2a53f85bc4d1db91853416b434\",\"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 {IInputRelay} from \\\"../inputs/IInputRelay.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title ERC-1155 Single Transfer Portal interface\\ninterface IERC1155SinglePortal is IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Transfer an ERC-1155 token to a DApp and add an input to\\n /// the DApp'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 _dapp The address of the DApp\\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 _dapp,\\n uint256 _tokenId,\\n uint256 _value,\\n bytes calldata _baseLayerData,\\n bytes calldata _execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0x1d3c93c70d81ede71436b43dfecbfa9f644010ca08f4197bfb966831451dab6d\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b5060405161054e38038061054e83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516104bd61009160003960008181603c015261012001526104bd6000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a578063dec07dca14610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a61008536600461026a565b61008c565b005b604051637921219560e11b81526001600160a01b0389169063f242432a906100c29033908b908b908b908b908b9060040161033b565b600060405180830381600087803b1580156100dc57600080fd5b505af11580156100f0573d6000803e3d6000fd5b50505050600061010689338989898989896101a6565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd6390610157908b9085906004016103a6565b6020604051808303816000875af1158015610176573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019a91906103e8565b50505050505050505050565b60606000858585856040516020016101c19493929190610401565b604051602081830303815290604052905089898989846040516020016101eb959493929190610433565b60405160208183030381529060405291505098975050505050505050565b6001600160a01b038116811461021e57600080fd5b50565b60008083601f84011261023357600080fd5b50813567ffffffffffffffff81111561024b57600080fd5b60208301915083602082850101111561026357600080fd5b9250929050565b60008060008060008060008060c0898b03121561028657600080fd5b883561029181610209565b975060208901356102a181610209565b96506040890135955060608901359450608089013567ffffffffffffffff808211156102cc57600080fd5b6102d88c838d01610221565b909650945060a08b01359150808211156102f157600080fd5b506102fe8b828c01610221565b999c989b5096995094979396929594505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03878116825286166020820152604081018590526060810184905260a0608082018190526000906103769083018486610312565b98975050505050505050565b60005b8381101561039d578181015183820152602001610385565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526103d3816060850160208701610382565b601f01601f1916919091016060019392505050565b6000602082840312156103fa57600080fd5b5051919050565b604081526000610415604083018688610312565b8281036020840152610428818587610312565b979650505050505050565b60006bffffffffffffffffffffffff19808860601b168352808760601b166014840152508460288301528360488301528251610476816068850160208701610382565b91909101606801969550505050505056fea26469706673582212208a2be17b506fdeea2c29cef703e184884f695e71e9147dce06da5055620ed53364736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a578063dec07dca14610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a61008536600461026a565b61008c565b005b604051637921219560e11b81526001600160a01b0389169063f242432a906100c29033908b908b908b908b908b9060040161033b565b600060405180830381600087803b1580156100dc57600080fd5b505af11580156100f0573d6000803e3d6000fd5b50505050600061010689338989898989896101a6565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd6390610157908b9085906004016103a6565b6020604051808303816000875af1158015610176573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019a91906103e8565b50505050505050505050565b60606000858585856040516020016101c19493929190610401565b604051602081830303815290604052905089898989846040516020016101eb959493929190610433565b60405160208183030381529060405291505098975050505050505050565b6001600160a01b038116811461021e57600080fd5b50565b60008083601f84011261023357600080fd5b50813567ffffffffffffffff81111561024b57600080fd5b60208301915083602082850101111561026357600080fd5b9250929050565b60008060008060008060008060c0898b03121561028657600080fd5b883561029181610209565b975060208901356102a181610209565b96506040890135955060608901359450608089013567ffffffffffffffff808211156102cc57600080fd5b6102d88c838d01610221565b909650945060a08b01359150808211156102f157600080fd5b506102fe8b828c01610221565b999c989b5096995094979396929594505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03878116825286166020820152604081018590526060810184905260a0608082018190526000906103769083018486610312565b98975050505050505050565b60005b8381101561039d578181015183820152602001610385565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526103d3816060850160208701610382565b601f01601f1916919091016060019392505050565b6000602082840312156103fa57600080fd5b5051919050565b604081526000610415604083018688610312565b8281036020840152610428818587610312565b979650505050505050565b60006bffffffffffffffffffffffff19808860601b168352808760601b166014840152508460288301528360488301528251610476816068850160208701610382565b91909101606801969550505050505056fea26469706673582212208a2be17b506fdeea2c29cef703e184884f695e71e9147dce06da5055620ed53364736f6c63430008130033", - "devdoc": { - "kind": "dev", - "methods": { - "constructor": { - "params": { - "_inputBox": "The input box used by the portal" - } - }, - "depositSingleERC1155Token(address,address,uint256,uint256,bytes,bytes)": { - "params": { - "_baseLayerData": "Additional data to be interpreted by the base layer", - "_dapp": "The address of the DApp", - "_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 an ERC-1155 token to a DApp and add an input to the DApp'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 input relay." - } - }, - "notice": "This contract allows anyone to perform single transfers of ERC-1155 tokens to a DApp 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 deleted file mode 100644 index f17df1828..000000000 --- a/deployments/arbitrum_sepolia/ERC20Portal.json +++ /dev/null @@ -1,126 +0,0 @@ -{ - "address": "0x9C21AEb2093C32DDbC53eEF24B873BDCd1aDa1DB", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC20", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "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": "0x8d4b84b40d62957a757b4d4f2aa700f3b1d613eb3ad885b9f4d8e7de4f05d1cc", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", - "contractAddress": null, - "transactionIndex": 1, - "gasUsed": "265762", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x3b73cfe54416cf8a89126687ff182595cf78190ca0fb53f1cbb5ebd5e97b0c8e", - "transactionHash": "0x8d4b84b40d62957a757b4d4f2aa700f3b1d613eb3ad885b9f4d8e7de4f05d1cc", - "logs": [], - "blockNumber": 2838444, - "cumulativeGasUsed": "265762", - "status": 1, - "byzantium": true - }, - "args": [ - "0x59b22D57D4f067708AB0c00552767405926dc768" - ], - "numDeployments": 1, - "solcInputHash": "54ee33aea592269e6046663615f287b6", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"_inputBox\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_dapp\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"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\":{\"_amount\":\"The amount of tokens to be transferred\",\"_dapp\":\"The address of the DApp\",\"_execLayerData\":\"Additional data to be interpreted by the execution layer\",\"_token\":\"The ERC-20 token contract\"}},\"getInputBox()\":{\"returns\":{\"_0\":\"The input box\"}}},\"title\":\"ERC-20 Portal\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs the portal.\"},\"depositERC20Tokens(address,address,uint256,bytes)\":{\"notice\":\"Transfer ERC-20 tokens to a DApp and add an input to the DApp's input box to signal such operation. The caller must allow the portal to withdraw at least `_amount` tokens from their account beforehand, by calling the `approve` function in the token contract.\"},\"getInputBox()\":{\"notice\":\"Get the input box used by this input relay.\"}},\"notice\":\"This contract allows anyone to perform transfers of ERC-20 tokens to a DApp 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 v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token 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 amount 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 `amount` tokens of token type `id` from `from` to `to`.\\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 `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 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` 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 amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon 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 caller.\\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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"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 and relays.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Ether being sent in Wei\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\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 ret The return value of `transferFrom`\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param amount The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\n function encodeERC20Deposit(\\n bool ret,\\n IERC20 token,\\n address sender,\\n uint256 amount,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n ret, // 1B\\n token, // 20B\\n sender, // 20B\\n amount, // 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\\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\\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\\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 /// @notice Encode a DApp address relay.\\n /// @param dapp The DApp address\\n /// @return The encoded input\\n function encodeDAppAddressRelay(\\n address dapp\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n dapp // 20B\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5dce266a7b70ba86adf6a728c7667255d3e2b20f1789a951150a1d05439b7019\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputRelay.sol\":{\"content\":\"// (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 \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay interface\\ninterface IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this input relay.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x8c9316c43cc2c7754fbd5abccfcdbc5ed09a2f1228d993240eac6c41ea531521\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/InputRelay.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputRelay} from \\\"./IInputRelay.sol\\\";\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay\\n/// @notice This contract serves as a base for all the other input relays.\\ncontract InputRelay is IInputRelay {\\n /// @notice The input box used by the input relay.\\n IInputBox internal immutable inputBox;\\n\\n /// @notice Constructs the input relay.\\n /// @param _inputBox The input box used by the input relay\\n constructor(IInputBox _inputBox) {\\n inputBox = _inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return inputBox;\\n }\\n}\\n\",\"keccak256\":\"0xbb489f157a0bd7a9da29b0bf3c47c4b4051d90ccd252abc3f81c8e897329e590\",\"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 {InputRelay} from \\\"../inputs/InputRelay.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 a DApp while informing the off-chain machine.\\ncontract ERC20Portal is InputRelay, IERC20Portal {\\n /// @notice Constructs the portal.\\n /// @param _inputBox The input box used by the portal\\n constructor(IInputBox _inputBox) InputRelay(_inputBox) {}\\n\\n function depositERC20Tokens(\\n IERC20 _token,\\n address _dapp,\\n uint256 _amount,\\n bytes calldata _execLayerData\\n ) external override {\\n bool success = _token.transferFrom(msg.sender, _dapp, _amount);\\n\\n bytes memory input = InputEncoding.encodeERC20Deposit(\\n success,\\n _token,\\n msg.sender,\\n _amount,\\n _execLayerData\\n );\\n\\n inputBox.addInput(_dapp, input);\\n }\\n}\\n\",\"keccak256\":\"0x0de20df5988c4cda715ff1b1fbf30119822b850d2541d9a7119b8d44907da31f\",\"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 {IInputRelay} from \\\"../inputs/IInputRelay.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title ERC-20 Portal interface\\ninterface IERC20Portal is IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Transfer ERC-20 tokens to a DApp and add an input to\\n /// the DApp's input box to signal such operation.\\n ///\\n /// The caller must allow the portal to withdraw at least `_amount` 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 _dapp The address of the DApp\\n /// @param _amount 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 _dapp,\\n uint256 _amount,\\n bytes calldata _execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0xaeacb82606f1a687170c230eb169094cb3eea8ddc4838dc13f4830721fb5234b\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b5060405161045f38038061045f83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516103ce61009160003960008181603c015261013501526103ce6000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806395854b8114610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a610085366004610209565b61008c565b005b6040516323b872dd60e01b81523360048201526001600160a01b03858116602483015260448201859052600091908716906323b872dd906064016020604051808303816000875af11580156100e5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061010991906102a8565b9050600061011b8288338888886101b9565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061016c90899085906004016102d1565b6020604051808303816000875af115801561018b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101af919061032f565b5050505050505050565b60608686868686866040516020016101d696959493929190610348565b60405160208183030381529060405290509695505050505050565b6001600160a01b038116811461020657600080fd5b50565b60008060008060006080868803121561022157600080fd5b853561022c816101f1565b9450602086013561023c816101f1565b935060408601359250606086013567ffffffffffffffff8082111561026057600080fd5b818801915088601f83011261027457600080fd5b81358181111561028357600080fd5b89602082850101111561029557600080fd5b9699959850939650602001949392505050565b6000602082840312156102ba57600080fd5b815180151581146102ca57600080fd5b9392505050565b60018060a01b038316815260006020604081840152835180604085015260005b8181101561030d578581018301518582016060015282016102f1565b506000606082860101526060601f19601f830116850101925050509392505050565b60006020828403121561034157600080fd5b5051919050565b86151560f81b815260006bffffffffffffffffffffffff19808860601b166001840152808760601b166015840152508460298301528284604984013750600091016049019081529594505050505056fea26469706673582212205635c4a24e9e9f5e128a69b633d53f24838d8833b76e4fca1f3bf3b490e380c664736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806395854b8114610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a610085366004610209565b61008c565b005b6040516323b872dd60e01b81523360048201526001600160a01b03858116602483015260448201859052600091908716906323b872dd906064016020604051808303816000875af11580156100e5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061010991906102a8565b9050600061011b8288338888886101b9565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061016c90899085906004016102d1565b6020604051808303816000875af115801561018b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101af919061032f565b5050505050505050565b60608686868686866040516020016101d696959493929190610348565b60405160208183030381529060405290509695505050505050565b6001600160a01b038116811461020657600080fd5b50565b60008060008060006080868803121561022157600080fd5b853561022c816101f1565b9450602086013561023c816101f1565b935060408601359250606086013567ffffffffffffffff8082111561026057600080fd5b818801915088601f83011261027457600080fd5b81358181111561028357600080fd5b89602082850101111561029557600080fd5b9699959850939650602001949392505050565b6000602082840312156102ba57600080fd5b815180151581146102ca57600080fd5b9392505050565b60018060a01b038316815260006020604081840152835180604085015260005b8181101561030d578581018301518582016060015282016102f1565b506000606082860101526060601f19601f830116850101925050509392505050565b60006020828403121561034157600080fd5b5051919050565b86151560f81b815260006bffffffffffffffffffffffff19808860601b166001840152808760601b166015840152508460298301528284604984013750600091016049019081529594505050505056fea26469706673582212205635c4a24e9e9f5e128a69b633d53f24838d8833b76e4fca1f3bf3b490e380c664736f6c63430008130033", - "devdoc": { - "kind": "dev", - "methods": { - "constructor": { - "params": { - "_inputBox": "The input box used by the portal" - } - }, - "depositERC20Tokens(address,address,uint256,bytes)": { - "params": { - "_amount": "The amount of tokens to be transferred", - "_dapp": "The address of the DApp", - "_execLayerData": "Additional data to be interpreted by the execution layer", - "_token": "The ERC-20 token contract" - } - }, - "getInputBox()": { - "returns": { - "_0": "The input box" - } - } - }, - "title": "ERC-20 Portal", - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "constructor": { - "notice": "Constructs the portal." - }, - "depositERC20Tokens(address,address,uint256,bytes)": { - "notice": "Transfer ERC-20 tokens to a DApp and add an input to the DApp's input box to signal such operation. The caller must allow the portal to withdraw at least `_amount` tokens from their account beforehand, by calling the `approve` function in the token contract." - }, - "getInputBox()": { - "notice": "Get the input box used by this input relay." - } - }, - "notice": "This contract allows anyone to perform transfers of ERC-20 tokens to a DApp 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 deleted file mode 100644 index c625b7b1e..000000000 --- a/deployments/arbitrum_sepolia/ERC721Portal.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "address": "0x237F8DD094C0e47f4236f12b4Fa01d6Dae89fb87", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC721", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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": "0x10381e102c0e1094b7eb068b3b1c6ea1570565b42d909286e0b418e745484345", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", - "contractAddress": null, - "transactionIndex": 1, - "gasUsed": "308364", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x0628f12a547562a297645a44e92f6f9c6a99e0c5332162726a77de1368aa6351", - "transactionHash": "0x10381e102c0e1094b7eb068b3b1c6ea1570565b42d909286e0b418e745484345", - "logs": [], - "blockNumber": 2838458, - "cumulativeGasUsed": "308364", - "status": 1, - "byzantium": true - }, - "args": [ - "0x59b22D57D4f067708AB0c00552767405926dc768" - ], - "numDeployments": 1, - "solcInputHash": "54ee33aea592269e6046663615f287b6", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"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\":\"_dapp\",\"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\":{\"_baseLayerData\":\"Additional data to be interpreted by the base layer\",\"_dapp\":\"The address of the DApp\",\"_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 a DApp and add an input to the DApp'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 input relay.\"}},\"notice\":\"This contract allows anyone to perform transfers of ERC-721 tokens to a DApp 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 v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token 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 amount 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 `amount` tokens of token type `id` from `from` to `to`.\\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 `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 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` 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 amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon 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 caller.\\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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"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 and relays.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Ether being sent in Wei\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\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 ret The return value of `transferFrom`\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param amount The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\n function encodeERC20Deposit(\\n bool ret,\\n IERC20 token,\\n address sender,\\n uint256 amount,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n ret, // 1B\\n token, // 20B\\n sender, // 20B\\n amount, // 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\\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\\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\\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 /// @notice Encode a DApp address relay.\\n /// @param dapp The DApp address\\n /// @return The encoded input\\n function encodeDAppAddressRelay(\\n address dapp\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n dapp // 20B\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5dce266a7b70ba86adf6a728c7667255d3e2b20f1789a951150a1d05439b7019\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputRelay.sol\":{\"content\":\"// (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 \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay interface\\ninterface IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this input relay.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x8c9316c43cc2c7754fbd5abccfcdbc5ed09a2f1228d993240eac6c41ea531521\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/InputRelay.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputRelay} from \\\"./IInputRelay.sol\\\";\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay\\n/// @notice This contract serves as a base for all the other input relays.\\ncontract InputRelay is IInputRelay {\\n /// @notice The input box used by the input relay.\\n IInputBox internal immutable inputBox;\\n\\n /// @notice Constructs the input relay.\\n /// @param _inputBox The input box used by the input relay\\n constructor(IInputBox _inputBox) {\\n inputBox = _inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return inputBox;\\n }\\n}\\n\",\"keccak256\":\"0xbb489f157a0bd7a9da29b0bf3c47c4b4051d90ccd252abc3f81c8e897329e590\",\"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 {InputRelay} from \\\"../inputs/InputRelay.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 a DApp while informing the off-chain machine.\\ncontract ERC721Portal is InputRelay, IERC721Portal {\\n /// @notice Constructs the portal.\\n /// @param _inputBox The input box used by the portal\\n constructor(IInputBox _inputBox) InputRelay(_inputBox) {}\\n\\n function depositERC721Token(\\n IERC721 _token,\\n address _dapp,\\n uint256 _tokenId,\\n bytes calldata _baseLayerData,\\n bytes calldata _execLayerData\\n ) external override {\\n _token.safeTransferFrom(msg.sender, _dapp, _tokenId, _baseLayerData);\\n\\n bytes memory input = InputEncoding.encodeERC721Deposit(\\n _token,\\n msg.sender,\\n _tokenId,\\n _baseLayerData,\\n _execLayerData\\n );\\n\\n inputBox.addInput(_dapp, input);\\n }\\n}\\n\",\"keccak256\":\"0xe402b9ad4394ceb4e6bc0a0fe9df7fa0f9ee46709b8046ed50fe2f83ab259a9e\",\"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 {IInputRelay} from \\\"../inputs/IInputRelay.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title ERC-721 Portal interface\\ninterface IERC721Portal is IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Transfer an ERC-721 token to a DApp and add an input to\\n /// the DApp'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 _dapp The address of the DApp\\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 _dapp,\\n uint256 _tokenId,\\n bytes calldata _baseLayerData,\\n bytes calldata _execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0x9da43aa0b2c19659dd96c244ce260760d7c1c675aaec85feacd322d35b8e1844\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b5060405161052438038061052483398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b60805161049361009160003960008181603c015261011d01526104936000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806328911e8314610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a610085366004610263565b61008c565b005b604051635c46a7ef60e11b81526001600160a01b0388169063b88d4fde906100c09033908a908a908a908a9060040161032b565b600060405180830381600087803b1580156100da57600080fd5b505af11580156100ee573d6000803e3d6000fd5b505050506000610103883388888888886101a2565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd6390610154908a90859060040161038e565b6020604051808303816000875af1158015610173573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019791906103d0565b505050505050505050565b60606000858585856040516020016101bd94939291906103e9565b6040516020818303038152906040529050888888836040516020016101e59493929190610410565b604051602081830303815290604052915050979650505050505050565b6001600160a01b038116811461021757600080fd5b50565b60008083601f84011261022c57600080fd5b50813567ffffffffffffffff81111561024457600080fd5b60208301915083602082850101111561025c57600080fd5b9250929050565b600080600080600080600060a0888a03121561027e57600080fd5b873561028981610202565b9650602088013561029981610202565b955060408801359450606088013567ffffffffffffffff808211156102bd57600080fd5b6102c98b838c0161021a565b909650945060808a01359150808211156102e257600080fd5b506102ef8a828b0161021a565b989b979a50959850939692959293505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038681168252851660208201526040810184905260806060820181905260009061035f9083018486610302565b979650505050505050565b60005b8381101561038557818101518382015260200161036d565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526103bb81606085016020870161036a565b601f01601f1916919091016060019392505050565b6000602082840312156103e257600080fd5b5051919050565b6040815260006103fd604083018688610302565b828103602084015261035f818587610302565b60006bffffffffffffffffffffffff19808760601b168352808660601b16601484015250836028830152825161044d81604885016020870161036a565b919091016048019594505050505056fea2646970667358221220c2c237b79e46918de25850a3a3944f2f3cce2d65223f9c2c4e6fefb21e70609864736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806328911e8314610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a610085366004610263565b61008c565b005b604051635c46a7ef60e11b81526001600160a01b0388169063b88d4fde906100c09033908a908a908a908a9060040161032b565b600060405180830381600087803b1580156100da57600080fd5b505af11580156100ee573d6000803e3d6000fd5b505050506000610103883388888888886101a2565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd6390610154908a90859060040161038e565b6020604051808303816000875af1158015610173573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019791906103d0565b505050505050505050565b60606000858585856040516020016101bd94939291906103e9565b6040516020818303038152906040529050888888836040516020016101e59493929190610410565b604051602081830303815290604052915050979650505050505050565b6001600160a01b038116811461021757600080fd5b50565b60008083601f84011261022c57600080fd5b50813567ffffffffffffffff81111561024457600080fd5b60208301915083602082850101111561025c57600080fd5b9250929050565b600080600080600080600060a0888a03121561027e57600080fd5b873561028981610202565b9650602088013561029981610202565b955060408801359450606088013567ffffffffffffffff808211156102bd57600080fd5b6102c98b838c0161021a565b909650945060808a01359150808211156102e257600080fd5b506102ef8a828b0161021a565b989b979a50959850939692959293505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038681168252851660208201526040810184905260806060820181905260009061035f9083018486610302565b979650505050505050565b60005b8381101561038557818101518382015260200161036d565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526103bb81606085016020870161036a565b601f01601f1916919091016060019392505050565b6000602082840312156103e257600080fd5b5051919050565b6040815260006103fd604083018688610302565b828103602084015261035f818587610302565b60006bffffffffffffffffffffffff19808760601b168352808660601b16601484015250836028830152825161044d81604885016020870161036a565b919091016048019594505050505056fea2646970667358221220c2c237b79e46918de25850a3a3944f2f3cce2d65223f9c2c4e6fefb21e70609864736f6c63430008130033", - "devdoc": { - "kind": "dev", - "methods": { - "constructor": { - "params": { - "_inputBox": "The input box used by the portal" - } - }, - "depositERC721Token(address,address,uint256,bytes,bytes)": { - "params": { - "_baseLayerData": "Additional data to be interpreted by the base layer", - "_dapp": "The address of the DApp", - "_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 a DApp and add an input to the DApp'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 input relay." - } - }, - "notice": "This contract allows anyone to perform transfers of ERC-721 tokens to a DApp 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 deleted file mode 100644 index 32d4c92fa..000000000 --- a/deployments/arbitrum_sepolia/EtherPortal.json +++ /dev/null @@ -1,127 +0,0 @@ -{ - "address": "0xFfdbe43d4c855BF7e0f105c400A50857f53AB044", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "EtherTransferFailed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "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": "0x70093c4163589be1428eab9768bf8dcb7cb944fffcd20f9f78e253df42f5c1ff", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", - "contractAddress": null, - "transactionIndex": 1, - "gasUsed": "237862", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x3d14a04925807b8d4aefcaad980a685fe316a7017320c9e9d170a1d618b0f462", - "transactionHash": "0x70093c4163589be1428eab9768bf8dcb7cb944fffcd20f9f78e253df42f5c1ff", - "logs": [], - "blockNumber": 2838425, - "cumulativeGasUsed": "237862", - "status": 1, - "byzantium": true - }, - "args": [ - "0x59b22D57D4f067708AB0c00552767405926dc768" - ], - "numDeployments": 1, - "solcInputHash": "54ee33aea592269e6046663615f287b6", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"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\":\"_dapp\",\"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\":\"All the value sent through this function is forwarded to the DApp. If the transfer fails, `EtherTransferFailed` error is raised.\",\"params\":{\"_dapp\":\"The address of the DApp\",\"_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\":\"Raised when the Ether transfer fails.\"}]},\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs the portal.\"},\"depositEther(address,bytes)\":{\"notice\":\"Transfer Ether to a DApp and add an input to the DApp's input box to signal such operation. All the value sent through this function is forwarded to the DApp.\"},\"getInputBox()\":{\"notice\":\"Get the input box used by this input relay.\"}},\"notice\":\"This contract allows anyone to perform transfers of Ether to a DApp 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 v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token 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 amount 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 `amount` tokens of token type `id` from `from` to `to`.\\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 `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 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` 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 amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon 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 caller.\\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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"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 and relays.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Ether being sent in Wei\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\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 ret The return value of `transferFrom`\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param amount The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\n function encodeERC20Deposit(\\n bool ret,\\n IERC20 token,\\n address sender,\\n uint256 amount,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n ret, // 1B\\n token, // 20B\\n sender, // 20B\\n amount, // 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\\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\\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\\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 /// @notice Encode a DApp address relay.\\n /// @param dapp The DApp address\\n /// @return The encoded input\\n function encodeDAppAddressRelay(\\n address dapp\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n dapp // 20B\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5dce266a7b70ba86adf6a728c7667255d3e2b20f1789a951150a1d05439b7019\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputRelay.sol\":{\"content\":\"// (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 \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay interface\\ninterface IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this input relay.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x8c9316c43cc2c7754fbd5abccfcdbc5ed09a2f1228d993240eac6c41ea531521\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/InputRelay.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputRelay} from \\\"./IInputRelay.sol\\\";\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay\\n/// @notice This contract serves as a base for all the other input relays.\\ncontract InputRelay is IInputRelay {\\n /// @notice The input box used by the input relay.\\n IInputBox internal immutable inputBox;\\n\\n /// @notice Constructs the input relay.\\n /// @param _inputBox The input box used by the input relay\\n constructor(IInputBox _inputBox) {\\n inputBox = _inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return inputBox;\\n }\\n}\\n\",\"keccak256\":\"0xbb489f157a0bd7a9da29b0bf3c47c4b4051d90ccd252abc3f81c8e897329e590\",\"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 {InputRelay} from \\\"../inputs/InputRelay.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 a DApp while informing the off-chain machine.\\ncontract EtherPortal is InputRelay, IEtherPortal {\\n /// @notice Raised when the Ether transfer fails.\\n error EtherTransferFailed();\\n\\n /// @notice Constructs the portal.\\n /// @param _inputBox The input box used by the portal\\n constructor(IInputBox _inputBox) InputRelay(_inputBox) {}\\n\\n function depositEther(\\n address _dapp,\\n bytes calldata _execLayerData\\n ) external payable override {\\n // We used to call `transfer()` but it's not considered safe,\\n // as it assumes gas costs are immutable (they are not).\\n (bool success, ) = _dapp.call{value: msg.value}(\\\"\\\");\\n\\n if (!success) {\\n revert EtherTransferFailed();\\n }\\n\\n bytes memory input = InputEncoding.encodeEtherDeposit(\\n msg.sender,\\n msg.value,\\n _execLayerData\\n );\\n\\n inputBox.addInput(_dapp, input);\\n }\\n}\\n\",\"keccak256\":\"0x47950c335ae2d0dd03b680d6fcd9cb26aa1333ecf6772b1f3a71a80100b8b34c\",\"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 {IInputRelay} from \\\"../inputs/IInputRelay.sol\\\";\\n\\n/// @title Ether Portal interface\\ninterface IEtherPortal is IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Transfer Ether to a DApp and add an input to\\n /// the DApp's input box to signal such operation.\\n ///\\n /// All the value sent through this function is forwarded to the DApp.\\n ///\\n /// @param _dapp The address of the DApp\\n /// @param _execLayerData Additional data to be interpreted by the execution layer\\n /// @dev All the value sent through this function is forwarded to the DApp.\\n /// If the transfer fails, `EtherTransferFailed` error is raised.\\n function depositEther(\\n address _dapp,\\n bytes calldata _execLayerData\\n ) external payable;\\n}\\n\",\"keccak256\":\"0xa8bdb1f91935db3d7ba158935164e61f042da26a9abe872edccbff28614d9143\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b506040516103de3803806103de83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b60805161034d61009160003960008181603c0152610128015261034d6000f3fe6080604052600436106100285760003560e01c8062aace9a1461002d578063938c054f14610077575b600080fd5b34801561003957600080fd5b507f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a6100853660046101dc565b61008c565b005b6000836001600160a01b03163460405160006040518083038185875af1925050503d80600081146100d9576040519150601f19603f3d011682016040523d82523d6000602084013e6100de565b606091505b505090508061010057604051630ce8f45160e31b815260040160405180910390fd5b600061010e333486866101aa565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061015f908890859060040161026d565b6020604051808303816000875af115801561017e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a291906102cb565b505050505050565b6060848484846040516020016101c394939291906102e4565b6040516020818303038152906040529050949350505050565b6000806000604084860312156101f157600080fd5b83356001600160a01b038116811461020857600080fd5b9250602084013567ffffffffffffffff8082111561022557600080fd5b818601915086601f83011261023957600080fd5b81358181111561024857600080fd5b87602082850101111561025a57600080fd5b6020830194508093505050509250925092565b60018060a01b038316815260006020604081840152835180604085015260005b818110156102a95785810183015185820160600152820161028d565b506000606082860101526060601f19601f830116850101925050509392505050565b6000602082840312156102dd57600080fd5b5051919050565b6bffffffffffffffffffffffff198560601b1681528360148201528183603483013760009101603401908152939250505056fea26469706673582212203555bb6cf9b2020729bb19c561673a225f367cd3219906075930d8b9f3fb219864736f6c63430008130033", - "deployedBytecode": "0x6080604052600436106100285760003560e01c8062aace9a1461002d578063938c054f14610077575b600080fd5b34801561003957600080fd5b507f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a6100853660046101dc565b61008c565b005b6000836001600160a01b03163460405160006040518083038185875af1925050503d80600081146100d9576040519150601f19603f3d011682016040523d82523d6000602084013e6100de565b606091505b505090508061010057604051630ce8f45160e31b815260040160405180910390fd5b600061010e333486866101aa565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061015f908890859060040161026d565b6020604051808303816000875af115801561017e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a291906102cb565b505050505050565b6060848484846040516020016101c394939291906102e4565b6040516020818303038152906040529050949350505050565b6000806000604084860312156101f157600080fd5b83356001600160a01b038116811461020857600080fd5b9250602084013567ffffffffffffffff8082111561022557600080fd5b818601915086601f83011261023957600080fd5b81358181111561024857600080fd5b87602082850101111561025a57600080fd5b6020830194508093505050509250925092565b60018060a01b038316815260006020604081840152835180604085015260005b818110156102a95785810183015185820160600152820161028d565b506000606082860101526060601f19601f830116850101925050509392505050565b6000602082840312156102dd57600080fd5b5051919050565b6bffffffffffffffffffffffff198560601b1681528360148201528183603483013760009101603401908152939250505056fea26469706673582212203555bb6cf9b2020729bb19c561673a225f367cd3219906075930d8b9f3fb219864736f6c63430008130033", - "devdoc": { - "kind": "dev", - "methods": { - "constructor": { - "params": { - "_inputBox": "The input box used by the portal" - } - }, - "depositEther(address,bytes)": { - "details": "All the value sent through this function is forwarded to the DApp. If the transfer fails, `EtherTransferFailed` error is raised.", - "params": { - "_dapp": "The address of the DApp", - "_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": "Raised when the Ether transfer fails." - } - ] - }, - "kind": "user", - "methods": { - "constructor": { - "notice": "Constructs the portal." - }, - "depositEther(address,bytes)": { - "notice": "Transfer Ether to a DApp and add an input to the DApp's input box to signal such operation. All the value sent through this function is forwarded to the DApp." - }, - "getInputBox()": { - "notice": "Get the input box used by this input relay." - } - }, - "notice": "This contract allows anyone to perform transfers of Ether to a DApp 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 deleted file mode 100644 index d185c2dd9..000000000 --- a/deployments/arbitrum_sepolia/InputBox.json +++ /dev/null @@ -1,246 +0,0 @@ -{ - "address": "0x59b22D57D4f067708AB0c00552767405926dc768", - "abi": [ - { - "inputs": [], - "name": "InputSizeExceedsLimit", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "dapp", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "inputIndex", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "input", - "type": "bytes" - } - ], - "name": "InputAdded", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_input", - "type": "bytes" - } - ], - "name": "addInput", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "getInputHash", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - } - ], - "name": "getNumberOfInputs", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "transactionHash": "0x5ac60adf9c76f7e62c021072cc3b38765b855d9416fc69c2a5d006f81e7ab6fb", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", - "contractAddress": null, - "transactionIndex": 1, - "gasUsed": "260666", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xb96c7c40981631a4c375fe53b6284823eb8d5048c8e4a9526811f546e007c4b0", - "transactionHash": "0x5ac60adf9c76f7e62c021072cc3b38765b855d9416fc69c2a5d006f81e7ab6fb", - "logs": [], - "blockNumber": 2838409, - "cumulativeGasUsed": "260666", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 1, - "solcInputHash": "8964a82607cc9a4fa86e2a225f50957d", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"InputSizeExceedsLimit\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"dapp\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"inputIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"input\",\"type\":\"bytes\"}],\"name\":\"InputAdded\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_dapp\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_input\",\"type\":\"bytes\"}],\"name\":\"addInput\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_dapp\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"getInputHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_dapp\",\"type\":\"address\"}],\"name\":\"getNumberOfInputs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"InputAdded(address,uint256,address,bytes)\":{\"details\":\"MUST be triggered on a successful call to `addInput`.\",\"params\":{\"dapp\":\"The address of the DApp\",\"input\":\"The contents of the input\",\"inputIndex\":\"The index of the input in the input box\",\"sender\":\"The address that sent the input\"}}},\"kind\":\"dev\",\"methods\":{\"addInput(address,bytes)\":{\"details\":\"MUST fire an `InputAdded` event accordingly. Input larger than machine limit will raise `InputSizeExceedsLimit` error.\",\"params\":{\"_dapp\":\"The address of the DApp\",\"_input\":\"The contents of the input\"},\"returns\":{\"_0\":\"The hash of the input plus some extra metadata\"}},\"getInputHash(address,uint256)\":{\"details\":\"`_index` MUST be in the interval `[0,n)` where `n` is the number of inputs in the DApp's input box. See the `getNumberOfInputs` function.\",\"params\":{\"_dapp\":\"The address of the DApp\",\"_index\":\"The index of the input in the DApp's input box\"},\"returns\":{\"_0\":\"The hash of the input at the provided index in the DApp's input box\"}},\"getNumberOfInputs(address)\":{\"params\":{\"_dapp\":\"The address of the DApp\"},\"returns\":{\"_0\":\"Number of inputs in the DApp's input box\"}}},\"stateVariables\":{\"inputBoxes\":{\"details\":\"See the `getNumberOfInputs`, `getInputHash` and `addInput` functions.\"}},\"title\":\"Input Box\",\"version\":1},\"userdoc\":{\"errors\":{\"InputSizeExceedsLimit()\":[{\"notice\":\"Raised when input is larger than the machine limit.\"}]},\"events\":{\"InputAdded(address,uint256,address,bytes)\":{\"notice\":\"Emitted when an input is added to a DApp's input box.\"}},\"kind\":\"user\",\"methods\":{\"addInput(address,bytes)\":{\"notice\":\"Add an input to a DApp's input box.\"},\"getInputHash(address,uint256)\":{\"notice\":\"Get the hash of an input in a DApp's input box.\"},\"getNumberOfInputs(address)\":{\"notice\":\"Get the number of inputs in a DApp's input box.\"}},\"notice\":\"Trustless and permissionless contract that receives arbitrary blobs (called \\\"inputs\\\") from anyone and adds a compound hash to an append-only list (called \\\"input box\\\"). Each DApp has its own input box. The hash that is stored on-chain is composed by the hash of the input blob, the block number and timestamp, the input sender address, and the input index. Data availability is guaranteed by the emission of `InputAdded` events on every successful call to `addInput`. This ensures that inputs can be retrieved by anyone at any time, without having to rely on centralized data providers. From the perspective of this contract, inputs are encoding-agnostic byte arrays. It is up to the DApp to interpret, validate and act upon inputs.\",\"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 Base-2 logarithm of number of bytes.\\n type Log2Size is uint64;\\n\\n /// @notice Machine word size (8 bytes).\\n Log2Size constant WORD_LOG2_SIZE = Log2Size.wrap(3);\\n\\n /// @notice Machine address space size (2^64 bytes).\\n Log2Size constant MACHINE_LOG2_SIZE = Log2Size.wrap(64);\\n\\n /// @notice Keccak-256 output size (32 bytes).\\n Log2Size constant KECCAK_LOG2_SIZE = Log2Size.wrap(5);\\n\\n /// @notice Maximum input size (~2 megabytes).\\n /// @dev The offset and size fields use up the extra 64 bytes.\\n uint256 constant INPUT_MAX_SIZE = (1 << 21) - 64;\\n\\n /// @notice Maximum voucher metadata memory range (2 megabytes).\\n Log2Size constant VOUCHER_METADATA_LOG2_SIZE = Log2Size.wrap(21);\\n\\n /// @notice Maximum notice metadata memory range (2 megabytes).\\n Log2Size constant NOTICE_METADATA_LOG2_SIZE = Log2Size.wrap(21);\\n\\n /// @notice Maximum epoch voucher memory range (128 megabytes).\\n Log2Size constant EPOCH_VOUCHER_LOG2_SIZE = Log2Size.wrap(37);\\n\\n /// @notice Maximum epoch notice memory range (128 megabytes).\\n Log2Size constant EPOCH_NOTICE_LOG2_SIZE = Log2Size.wrap(37);\\n\\n /// @notice Unwrap `s` into its underlying uint64 value.\\n /// @param s Base-2 logarithm of some number of bytes\\n function uint64OfSize(Log2Size s) internal pure returns (uint64) {\\n return Log2Size.unwrap(s);\\n }\\n\\n /// @notice Return the position of an intra memory range on a memory range\\n /// with contents with the same size.\\n /// @param index Index of intra memory range\\n /// @param log2Size Base-2 logarithm of intra memory range size\\n function getIntraMemoryRangePosition(\\n uint64 index,\\n Log2Size log2Size\\n ) internal pure returns (uint64) {\\n return index << Log2Size.unwrap(log2Size);\\n }\\n}\\n\",\"keccak256\":\"0x97cdce56cdb4f0b4164e6be3a72e50469a3124e4716e753a1792aa70eac614f5\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"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.8;\\n\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\nimport {LibInput} from \\\"../library/LibInput.sol\\\";\\n\\n/// @title Input Box\\n///\\n/// @notice Trustless and permissionless contract that receives arbitrary blobs\\n/// (called \\\"inputs\\\") from anyone and adds a compound hash to an append-only list\\n/// (called \\\"input box\\\"). Each DApp has its own input box.\\n///\\n/// The hash that is stored on-chain is composed by the hash of the input blob,\\n/// the block number and timestamp, the input sender address, and the input index.\\n///\\n/// Data availability is guaranteed by the emission of `InputAdded` events\\n/// on every successful call to `addInput`. This ensures that inputs can be\\n/// retrieved by anyone at any time, without having to rely on centralized data\\n/// providers.\\n///\\n/// From the perspective of this contract, inputs are encoding-agnostic byte\\n/// arrays. It is up to the DApp to interpret, validate and act upon inputs.\\ncontract InputBox is IInputBox {\\n /// @notice Mapping from DApp address to list of input hashes.\\n /// @dev See the `getNumberOfInputs`, `getInputHash` and `addInput` functions.\\n mapping(address => bytes32[]) internal inputBoxes;\\n\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external override returns (bytes32) {\\n bytes32[] storage inputBox = inputBoxes[_dapp];\\n uint256 inputIndex = inputBox.length;\\n\\n bytes32 inputHash = LibInput.computeInputHash(\\n msg.sender,\\n block.number,\\n block.timestamp,\\n _input,\\n inputIndex\\n );\\n\\n // add input to the input box\\n inputBox.push(inputHash);\\n\\n // block.number and timestamp can be retrieved by the event metadata itself\\n emit InputAdded(_dapp, inputIndex, msg.sender, _input);\\n\\n return inputHash;\\n }\\n\\n function getNumberOfInputs(\\n address _dapp\\n ) external view override returns (uint256) {\\n return inputBoxes[_dapp].length;\\n }\\n\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view override returns (bytes32) {\\n return inputBoxes[_dapp][_index];\\n }\\n}\\n\",\"keccak256\":\"0x83d36baf0bda5a63ea5eae7e021b80eabb30f9ace14fcdb5936f0e27b779fccb\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/library/LibInput.sol\":{\"content\":\"// (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\\\";\\n\\n/// @title Input Library\\nlibrary LibInput {\\n using CanonicalMachine for CanonicalMachine.Log2Size;\\n\\n /// @notice Raised when input is larger than the machine limit.\\n error InputSizeExceedsLimit();\\n\\n /// @notice Summarize input data in a single hash.\\n /// @param sender `msg.sender`\\n /// @param blockNumber `block.number`\\n /// @param blockTimestamp `block.timestamp`\\n /// @param input The input blob\\n /// @param inputIndex The index of the input in the input box\\n /// @return The input hash\\n function computeInputHash(\\n address sender,\\n uint256 blockNumber,\\n uint256 blockTimestamp,\\n bytes calldata input,\\n uint256 inputIndex\\n ) internal pure returns (bytes32) {\\n if (input.length > CanonicalMachine.INPUT_MAX_SIZE) {\\n revert InputSizeExceedsLimit();\\n }\\n\\n bytes32 keccakMetadata = keccak256(\\n abi.encode(\\n sender,\\n blockNumber,\\n blockTimestamp,\\n 0, //TODO decide how to deal with epoch index\\n inputIndex // input index in the input box\\n )\\n );\\n\\n bytes32 keccakInput = keccak256(input);\\n\\n return keccak256(abi.encode(keccakMetadata, keccakInput));\\n }\\n}\\n\",\"keccak256\":\"0x27f2fe9efc2f6fc85687ea78e5c79a090c46ece27e7bb26e0c184a3fef62317a\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506103be806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80631789cd631461004657806361a93c871461006b578063677087c914610094575b600080fd5b610059610054366004610253565b6100a7565b60405190815260200160405180910390f35b6100596100793660046102d6565b6001600160a01b031660009081526020819052604090205490565b6100596100a23660046102f8565b61013b565b6001600160a01b03831660009081526020819052604081208054826100d0334342898987610178565b83546001810185556000858152602090200181905560405190915082906001600160a01b038916907f6aaa400068bf4ca337265e2a1e1e841f66b8597fd5b452fdc52a44bed28a0784906101299033908b908b90610322565b60405180910390a39695505050505050565b6001600160a01b038216600090815260208190526040812080548390811061016557610165610362565b9060005260206000200154905092915050565b6000621fffc083111561019e57604051634273a49560e11b815260040160405180910390fd5b604080516001600160a01b03891660208201529081018790526060810186905260006080820181905260a082018490529060c001604051602081830303815290604052805190602001209050600085856040516101fc929190610378565b604080519182900382206020808401959095528282015280518083038201815260609092019052805192019190912098975050505050505050565b80356001600160a01b038116811461024e57600080fd5b919050565b60008060006040848603121561026857600080fd5b61027184610237565b9250602084013567ffffffffffffffff8082111561028e57600080fd5b818601915086601f8301126102a257600080fd5b8135818111156102b157600080fd5b8760208285010111156102c357600080fd5b6020830194508093505050509250925092565b6000602082840312156102e857600080fd5b6102f182610237565b9392505050565b6000806040838503121561030b57600080fd5b61031483610237565b946020939093013593505050565b6001600160a01b03841681526040602082018190528101829052818360608301376000818301606090810191909152601f909201601f1916010192915050565b634e487b7160e01b600052603260045260246000fd5b818382376000910190815291905056fea264697066735822122043b0a58952371efb5f75573ec65e82305da7154e6338f4e9c00f5cc07f92c4af64736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80631789cd631461004657806361a93c871461006b578063677087c914610094575b600080fd5b610059610054366004610253565b6100a7565b60405190815260200160405180910390f35b6100596100793660046102d6565b6001600160a01b031660009081526020819052604090205490565b6100596100a23660046102f8565b61013b565b6001600160a01b03831660009081526020819052604081208054826100d0334342898987610178565b83546001810185556000858152602090200181905560405190915082906001600160a01b038916907f6aaa400068bf4ca337265e2a1e1e841f66b8597fd5b452fdc52a44bed28a0784906101299033908b908b90610322565b60405180910390a39695505050505050565b6001600160a01b038216600090815260208190526040812080548390811061016557610165610362565b9060005260206000200154905092915050565b6000621fffc083111561019e57604051634273a49560e11b815260040160405180910390fd5b604080516001600160a01b03891660208201529081018790526060810186905260006080820181905260a082018490529060c001604051602081830303815290604052805190602001209050600085856040516101fc929190610378565b604080519182900382206020808401959095528282015280518083038201815260609092019052805192019190912098975050505050505050565b80356001600160a01b038116811461024e57600080fd5b919050565b60008060006040848603121561026857600080fd5b61027184610237565b9250602084013567ffffffffffffffff8082111561028e57600080fd5b818601915086601f8301126102a257600080fd5b8135818111156102b157600080fd5b8760208285010111156102c357600080fd5b6020830194508093505050509250925092565b6000602082840312156102e857600080fd5b6102f182610237565b9392505050565b6000806040838503121561030b57600080fd5b61031483610237565b946020939093013593505050565b6001600160a01b03841681526040602082018190528101829052818360608301376000818301606090810191909152601f909201601f1916010192915050565b634e487b7160e01b600052603260045260246000fd5b818382376000910190815291905056fea264697066735822122043b0a58952371efb5f75573ec65e82305da7154e6338f4e9c00f5cc07f92c4af64736f6c63430008130033", - "devdoc": { - "events": { - "InputAdded(address,uint256,address,bytes)": { - "details": "MUST be triggered on a successful call to `addInput`.", - "params": { - "dapp": "The address of the DApp", - "input": "The contents of the input", - "inputIndex": "The index of the input in the input box", - "sender": "The address that sent the input" - } - } - }, - "kind": "dev", - "methods": { - "addInput(address,bytes)": { - "details": "MUST fire an `InputAdded` event accordingly. Input larger than machine limit will raise `InputSizeExceedsLimit` error.", - "params": { - "_dapp": "The address of the DApp", - "_input": "The contents of the input" - }, - "returns": { - "_0": "The hash of the input plus some extra metadata" - } - }, - "getInputHash(address,uint256)": { - "details": "`_index` MUST be in the interval `[0,n)` where `n` is the number of inputs in the DApp's input box. See the `getNumberOfInputs` function.", - "params": { - "_dapp": "The address of the DApp", - "_index": "The index of the input in the DApp's input box" - }, - "returns": { - "_0": "The hash of the input at the provided index in the DApp's input box" - } - }, - "getNumberOfInputs(address)": { - "params": { - "_dapp": "The address of the DApp" - }, - "returns": { - "_0": "Number of inputs in the DApp's input box" - } - } - }, - "stateVariables": { - "inputBoxes": { - "details": "See the `getNumberOfInputs`, `getInputHash` and `addInput` functions." - } - }, - "title": "Input Box", - "version": 1 - }, - "userdoc": { - "errors": { - "InputSizeExceedsLimit()": [ - { - "notice": "Raised when input is larger than the machine limit." - } - ] - }, - "events": { - "InputAdded(address,uint256,address,bytes)": { - "notice": "Emitted when an input is added to a DApp's input box." - } - }, - "kind": "user", - "methods": { - "addInput(address,bytes)": { - "notice": "Add an input to a DApp's input box." - }, - "getInputHash(address,uint256)": { - "notice": "Get the hash of an input in a DApp's input box." - }, - "getNumberOfInputs(address)": { - "notice": "Get the number of inputs in a DApp's input box." - } - }, - "notice": "Trustless and permissionless contract that receives arbitrary blobs (called \"inputs\") from anyone and adds a compound hash to an append-only list (called \"input box\"). Each DApp has its own input box. The hash that is stored on-chain is composed by the hash of the input blob, the block number and timestamp, the input sender address, and the input index. Data availability is guaranteed by the emission of `InputAdded` events on every successful call to `addInput`. This ensures that inputs can be retrieved by anyone at any time, without having to rely on centralized data providers. From the perspective of this contract, inputs are encoding-agnostic byte arrays. It is up to the DApp to interpret, validate and act upon inputs.", - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 4121, - "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/mainnet/.chainId b/deployments/mainnet/.chainId deleted file mode 100644 index 56a6051ca..000000000 --- a/deployments/mainnet/.chainId +++ /dev/null @@ -1 +0,0 @@ -1 \ No newline at end of file diff --git a/deployments/mainnet/AuthorityFactory.json b/deployments/mainnet/AuthorityFactory.json deleted file mode 100644 index b721477b2..000000000 --- a/deployments/mainnet/AuthorityFactory.json +++ /dev/null @@ -1,183 +0,0 @@ -{ - "address": "0xf26a5b278C25D8D41A136d22Ad719EACEd9c3e63", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "authorityOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract Authority", - "name": "authority", - "type": "address" - } - ], - "name": "AuthorityCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateAuthorityAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newAuthority", - "outputs": [ - { - "internalType": "contract Authority", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - } - ], - "name": "newAuthority", - "outputs": [ - { - "internalType": "contract Authority", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0xaa6dbd2f59a8d3343f36430cc1d99aa7071d88f2a6a59ed0253b0fc6b8e37880", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 92, - "gasUsed": "756894", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5fee2e3568912865188fba9ce70ef10260045bdc702ac4e931467fe0ae93f0c8", - "transactionHash": "0xaa6dbd2f59a8d3343f36430cc1d99aa7071d88f2a6a59ed0253b0fc6b8e37880", - "logs": [], - "blockNumber": 18277837, - "cumulativeGasUsed": "7933035", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 1, - "solcInputHash": "b1bc2a879218740e83dfbb7046a3cc8c", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"authorityOwner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract Authority\",\"name\":\"authority\",\"type\":\"address\"}],\"name\":\"AuthorityCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"calculateAuthorityAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"newAuthority\",\"outputs\":[{\"internalType\":\"contract Authority\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"}],\"name\":\"newAuthority\",\"outputs\":[{\"internalType\":\"contract Authority\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"AuthorityCreated(address,address)\":{\"details\":\"MUST be triggered on a successful call to `newAuthority`.\",\"params\":{\"authority\":\"The authority\",\"authorityOwner\":\"The initial authority owner\"}}},\"kind\":\"dev\",\"methods\":{\"calculateAuthorityAddress(address,bytes32)\":{\"details\":\"Beware that only the `newAuthority` function with the `_salt` parameter is able to deterministically deploy an authority.\",\"params\":{\"_authorityOwner\":\"The initial authority owner\",\"_salt\":\"The salt used to deterministically generate the authority address\"},\"returns\":{\"_0\":\"The deterministic authority address\"}},\"newAuthority(address)\":{\"details\":\"On success, MUST emit an `AuthorityCreated` event.\",\"params\":{\"_authorityOwner\":\"The initial authority owner\"},\"returns\":{\"_0\":\"The authority\"}},\"newAuthority(address,bytes32)\":{\"details\":\"On success, MUST emit an `AuthorityCreated` event.\",\"params\":{\"_authorityOwner\":\"The initial authority owner\",\"_salt\":\"The salt used to deterministically generate the authority address\"},\"returns\":{\"_0\":\"The authority\"}}},\"title\":\"Authority Factory\",\"version\":1},\"userdoc\":{\"events\":{\"AuthorityCreated(address,address)\":{\"notice\":\"A new authority was deployed.\"}},\"kind\":\"user\",\"methods\":{\"calculateAuthorityAddress(address,bytes32)\":{\"notice\":\"Calculate the address of an authority to be deployed deterministically.\"},\"newAuthority(address)\":{\"notice\":\"Deploy a new authority.\"},\"newAuthority(address,bytes32)\":{\"notice\":\"Deploy a new authority deterministically.\"}},\"notice\":\"Allows anyone to reliably deploy a new `Authority` contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/consensus/authority/AuthorityFactory.sol\":\"AuthorityFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\\n require(address(this).balance >= amount, \\\"Create2: insufficient balance\\\");\\n require(bytecode.length != 0, \\\"Create2: bytecode length is zero\\\");\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n require(addr != address(0), \\\"Create2: Failed on deploy\\\");\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6e00f269073ffc4350e56b7e8153c9092d5f70bfba423299990514183101ef89\",\"license\":\"MIT\"},\"contracts/consensus/AbstractConsensus.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IConsensus} from \\\"./IConsensus.sol\\\";\\n\\n/// @title Abstract Consensus\\n/// @notice An abstract contract that partially implements `IConsensus`.\\nabstract contract AbstractConsensus is IConsensus {\\n /// @notice Emits an `ApplicationJoined` event with the message sender.\\n function join() external override {\\n emit ApplicationJoined(msg.sender);\\n }\\n}\\n\",\"keccak256\":\"0xced9c940ccbbe81fbfcf3bc087c04b9ae90325d6bba68a8cee9ebfa3dd9d231d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/IConsensus.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @title Consensus interface\\n///\\n/// @notice This contract defines a generic interface for consensuses.\\n/// We use the word \\\"consensus\\\" to designate a contract that provides claims\\n/// in the base layer regarding the state of off-chain machines running in\\n/// the execution layer. How this contract is able to reach consensus, who is\\n/// able to submit claims, and how are claims stored in the base layer are\\n/// some of the implementation details left unspecified by this interface.\\n///\\n/// From the point of view of a DApp, these claims are necessary to validate\\n/// on-chain action allowed by the off-chain machine in the form of vouchers\\n/// and notices. Each claim is composed of three parts: an epoch hash, a first\\n/// index, and a last index. We'll explain each of these parts below.\\n///\\n/// First, let us define the word \\\"epoch\\\". For finality reasons, we need to\\n/// divide the stream of inputs being fed into the off-chain machine into\\n/// batches of inputs, which we call \\\"epoches\\\". At the end of every epoch,\\n/// we summarize the state of the off-chain machine in a single hash, called\\n/// \\\"epoch hash\\\". Please note that this interface does not define how this\\n/// stream of inputs is being chopped up into epoches.\\n///\\n/// The other two parts are simply the indices of the first and last inputs\\n/// accepted during the epoch. Logically, the first index MUST BE less than\\n/// or equal to the last index. As a result, every epoch MUST accept at least\\n/// one input. This assumption stems from the fact that the state of a machine\\n/// can only change after an input is fed into it.\\n///\\n/// Examples of possible implementations of this interface include:\\n///\\n/// * An authority consensus, controlled by a single address who has full\\n/// control over epoch boundaries, claim submission, asset management, etc.\\n///\\n/// * A quorum consensus, controlled by a limited set of validators, that\\n/// vote on the state of the machine at the end of every epoch. Also, epoch\\n/// boundaries are determined by the timestamp in the base layer, and assets\\n/// are split equally amongst the validators.\\n///\\n/// * An NxN consensus, which allows anyone to submit and dispute claims\\n/// in the base layer. Epoch boundaries are determined in the same fashion\\n/// as in the quorum example.\\n///\\ninterface IConsensus {\\n /// @notice An application has joined the consensus' validation set.\\n /// @param application The application\\n /// @dev MUST be triggered on a successful call to `join`.\\n event ApplicationJoined(address application);\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// The encoding of `_proofContext` might vary\\n /// depending on the implementation.\\n /// @param _dapp The DApp address\\n /// @param _proofContext Data for retrieving the desired claim\\n /// @return epochHash_ The claimed epoch hash\\n /// @return firstInputIndex_ The index of the first input of the epoch in the input box\\n /// @return lastInputIndex_ The index of the last input of the epoch in the input box\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n )\\n external\\n view\\n returns (\\n bytes32 epochHash_,\\n uint256 firstInputIndex_,\\n uint256 lastInputIndex_\\n );\\n\\n /// @notice Signal the consensus that the message sender wants to join its validation set.\\n /// @dev MUST fire an `ApplicationJoined` event with the message sender as argument.\\n function join() external;\\n}\\n\",\"keccak256\":\"0xc9d295fada66eb0602e0f1e2e236708e52f959927abb4ab6b04173a98b92ac16\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/Authority.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {IConsensus} from \\\"../IConsensus.sol\\\";\\nimport {AbstractConsensus} from \\\"../AbstractConsensus.sol\\\";\\nimport {IHistory} from \\\"../../history/IHistory.sol\\\";\\n\\n/// @title Authority consensus\\n/// @notice A consensus model controlled by a single address, the owner.\\n/// Claims are stored in an auxiliary contract called `History`.\\n/// @dev This contract inherits `AbstractConsensus` and OpenZeppelin's `Ownable` contract.\\n/// For more information on `Ownable`, please consult OpenZeppelin's official documentation.\\ncontract Authority is AbstractConsensus, Ownable {\\n /// @notice The current history contract.\\n /// @dev See the `getHistory` and `setHistory` functions.\\n IHistory internal history;\\n\\n /// @notice A new history contract is used to store claims.\\n /// @param history The new history contract\\n /// @dev MUST be triggered on a successful call to `setHistory`.\\n event NewHistory(IHistory history);\\n\\n /// @notice Raised when a transfer of tokens from an authority to a recipient fails.\\n error AuthorityWithdrawalFailed();\\n\\n /// @notice Constructs an `Authority` contract.\\n /// @param _owner The initial contract owner\\n constructor(address _owner) {\\n // constructor in Ownable already called `transferOwnership(msg.sender)`, so\\n // we only need to call `transferOwnership(_owner)` if _owner != msg.sender\\n if (msg.sender != _owner) {\\n transferOwnership(_owner);\\n }\\n }\\n\\n /// @notice Submits a claim to the current history contract.\\n /// The encoding of `_claimData` might vary depending on the\\n /// implementation of the current history contract.\\n /// @param _claimData Data for submitting a claim\\n /// @dev Can only be called by the `Authority` owner,\\n /// and the `Authority` contract must have ownership over\\n /// its current history contract.\\n function submitClaim(bytes calldata _claimData) external onlyOwner {\\n history.submitClaim(_claimData);\\n }\\n\\n /// @notice Transfer ownership over the current history contract to `_consensus`.\\n /// @param _consensus The new owner of the current history contract\\n /// @dev Can only be called by the `Authority` owner,\\n /// and the `Authority` contract must have ownership over\\n /// its current history contract.\\n function migrateHistoryToConsensus(address _consensus) external onlyOwner {\\n history.migrateToConsensus(_consensus);\\n }\\n\\n /// @notice Make `Authority` point to another history contract.\\n /// @param _history The new history contract\\n /// @dev Emits a `NewHistory` event.\\n /// Can only be called by the `Authority` owner.\\n function setHistory(IHistory _history) external onlyOwner {\\n history = _history;\\n emit NewHistory(_history);\\n }\\n\\n /// @notice Get the current history contract.\\n /// @return The current history contract\\n function getHistory() external view returns (IHistory) {\\n return history;\\n }\\n\\n /// @notice Get a claim from the current history.\\n /// The encoding of `_proofContext` might vary depending on the\\n /// implementation of the current history contract.\\n /// @inheritdoc IConsensus\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n ) external view override returns (bytes32, uint256, uint256) {\\n return history.getClaim(_dapp, _proofContext);\\n }\\n\\n /// @notice Transfer some amount of ERC-20 tokens to a recipient.\\n /// @param _token The token contract\\n /// @param _recipient The recipient address\\n /// @param _amount The amount of tokens to be withdrawn\\n /// @dev Can only be called by the `Authority` owner.\\n function withdrawERC20Tokens(\\n IERC20 _token,\\n address _recipient,\\n uint256 _amount\\n ) external onlyOwner {\\n bool success = _token.transfer(_recipient, _amount);\\n\\n if (!success) {\\n revert AuthorityWithdrawalFailed();\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc71ea13163833684ce576861fbb19dc40e7096a022c6976b61a99dfc9e1c0903\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/AuthorityFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Create2} from \\\"@openzeppelin/contracts/utils/Create2.sol\\\";\\n\\nimport {IAuthorityFactory} from \\\"./IAuthorityFactory.sol\\\";\\nimport {Authority} from \\\"./Authority.sol\\\";\\n\\n/// @title Authority Factory\\n/// @notice Allows anyone to reliably deploy a new `Authority` contract.\\ncontract AuthorityFactory is IAuthorityFactory {\\n function newAuthority(\\n address _authorityOwner\\n ) external override returns (Authority) {\\n Authority authority = new Authority(_authorityOwner);\\n\\n emit AuthorityCreated(_authorityOwner, authority);\\n\\n return authority;\\n }\\n\\n function newAuthority(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external override returns (Authority) {\\n Authority authority = new Authority{salt: _salt}(_authorityOwner);\\n\\n emit AuthorityCreated(_authorityOwner, authority);\\n\\n return authority;\\n }\\n\\n function calculateAuthorityAddress(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external view override returns (address) {\\n return\\n Create2.computeAddress(\\n _salt,\\n keccak256(\\n abi.encodePacked(\\n type(Authority).creationCode,\\n abi.encode(_authorityOwner)\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x1b78c9693cfd7df3833c6ea1c18d767a10167f4bf6ac8ea883c74e7da281f418\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/IAuthorityFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Authority} from \\\"./Authority.sol\\\";\\n\\n/// @title Authority Factory interface\\ninterface IAuthorityFactory {\\n // Events\\n\\n /// @notice A new authority was deployed.\\n /// @param authorityOwner The initial authority owner\\n /// @param authority The authority\\n /// @dev MUST be triggered on a successful call to `newAuthority`.\\n event AuthorityCreated(address authorityOwner, Authority authority);\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new authority.\\n /// @param _authorityOwner The initial authority owner\\n /// @return The authority\\n /// @dev On success, MUST emit an `AuthorityCreated` event.\\n function newAuthority(address _authorityOwner) external returns (Authority);\\n\\n /// @notice Deploy a new authority deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority address\\n /// @return The authority\\n /// @dev On success, MUST emit an `AuthorityCreated` event.\\n function newAuthority(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external returns (Authority);\\n\\n /// @notice Calculate the address of an authority to be deployed deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority address\\n /// @return The deterministic authority address\\n /// @dev Beware that only the `newAuthority` function with the `_salt` parameter\\n /// is able to deterministically deploy an authority.\\n function calculateAuthorityAddress(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x149bcdf9641b337836263196aabb655e69902212ede21becedd9c08b5b304717\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/history/IHistory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @title History interface\\ninterface IHistory {\\n // Permissioned functions\\n\\n /// @notice Submit a claim.\\n /// The encoding of `_claimData` might vary\\n /// depending on the history implementation.\\n /// @param _claimData Data for submitting a claim\\n /// @dev Should have access control.\\n function submitClaim(bytes calldata _claimData) external;\\n\\n /// @notice Transfer ownership to another consensus.\\n /// @param _consensus The new consensus\\n /// @dev Should have access control.\\n function migrateToConsensus(address _consensus) external;\\n\\n // Permissionless functions\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// The encoding of `_proofContext` might vary\\n /// depending on the history implementation.\\n /// @param _dapp The DApp address\\n /// @param _proofContext Data for retrieving the desired claim\\n /// @return epochHash_ The claimed epoch hash\\n /// @return firstInputIndex_ The index of the first input of the epoch in the input box\\n /// @return lastInputIndex_ The index of the last input of the epoch in the input box\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n )\\n external\\n view\\n returns (\\n bytes32 epochHash_,\\n uint256 firstInputIndex_,\\n uint256 lastInputIndex_\\n );\\n}\\n\",\"keccak256\":\"0x1378cbc831833abae8e2a565b88899d6416ea1208aa9724bd4df28e74848ffcf\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50610cb5806100206000396000f3fe608060405234801561001057600080fd5b50600436106100405760003560e01c80629c5784146100455780635a3f27d314610074578063b3a51b8414610087575b600080fd5b610058610053366004610288565b61009a565b6040516001600160a01b03909116815260200160405180910390f35b610058610082366004610288565b610115565b6100586100953660046102b2565b6101a4565b600061010e82604051806020016100b09061025f565b601f1982820381018352601f9091011660408181526001600160a01b03881660208301520160408051601f19818403018152908290526100f392916020016102fd565b6040516020818303038152906040528051906020012061022d565b9392505050565b60008082846040516101269061025f565b6001600160a01b0390911681526020018190604051809103906000f5905080158015610156573d6000803e3d6000fd5b50604080516001600160a01b038088168252831660208201529192507f0fb2d916aa6a78060ff9e89d89d62797c6668818dec04969013c5098754380ec910160405180910390a19392505050565b600080826040516101b49061025f565b6001600160a01b039091168152602001604051809103906000f0801580156101e0573d6000803e3d6000fd5b50604080516001600160a01b038087168252831660208201529192507f0fb2d916aa6a78060ff9e89d89d62797c6668818dec04969013c5098754380ec910160405180910390a192915050565b600061010e8383306000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b6109658061031b83390190565b80356001600160a01b038116811461028357600080fd5b919050565b6000806040838503121561029b57600080fd5b6102a48361026c565b946020939093013593505050565b6000602082840312156102c457600080fd5b61010e8261026c565b6000815160005b818110156102ee57602081850181015186830152016102d4565b50600093019283525090919050565b600061031261030c83866102cd565b846102cd565b94935050505056fe608060405234801561001057600080fd5b5060405161096538038061096583398101604081905261002f91610181565b61003833610057565b336001600160a01b0382161461005157610051816100a7565b506101b1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6100af610125565b6001600160a01b0381166101195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61012281610057565b50565b6000546001600160a01b0316331461017f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610110565b565b60006020828403121561019357600080fd5b81516001600160a01b03811681146101aa57600080fd5b9392505050565b6107a5806101c06000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063b688a36311610066578063b688a3631461010e578063bcdd1e1314610116578063d79a824014610129578063ddfdfbb014610157578063f2fde38b1461016a57600080fd5b8063159c5ea1146100a3578063715018a6146100b85780638da5cb5b146100c05780639368a3d3146100ea578063aa15efc8146100fd575b600080fd5b6100b66100b1366004610567565b61017d565b005b6100b66101d9565b6000546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b6100b66100f8366004610567565b6101ed565b6001546001600160a01b03166100cd565b6100b6610257565b6100b661012436600461058b565b61028c565b61013c610137366004610615565b610331565b604080519384526020840192909252908201526060016100e1565b6100b661016536600461066a565b6103ba565b6100b6610178366004610567565b61042a565b6101856104a8565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f2bcd43869347a1d42f97ac6042f3d129817abd05a6125f9750fe3724e321d23e9060200160405180910390a150565b6101e16104a8565b6101eb6000610502565b565b6101f56104a8565b60015460405163fc41168360e01b81526001600160a01b0383811660048301529091169063fc41168390602401600060405180830381600087803b15801561023c57600080fd5b505af1158015610250573d6000803e3d6000fd5b5050505050565b6040513381527f27c2b702d3bff195a18baca2daf00b20a986177c5f1449af4e2d46a3c3e02ce59060200160405180910390a1565b6102946104a8565b60405163a9059cbb60e01b81526001600160a01b038381166004830152602482018390526000919085169063a9059cbb906044016020604051808303816000875af11580156102e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030b91906106ac565b90508061032b5760405163099e1ca760e11b815260040160405180910390fd5b50505050565b60015460405163035e6a0960e61b8152600091829182916001600160a01b03169063d79a82409061036a908990899089906004016106f7565b606060405180830381865afa158015610387573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ab9190610725565b92509250925093509350939050565b6103c26104a8565b600154604051630ddfdfbb60e41b81526001600160a01b039091169063ddfdfbb0906103f49085908590600401610753565b600060405180830381600087803b15801561040e57600080fd5b505af1158015610422573d6000803e3d6000fd5b505050505050565b6104326104a8565b6001600160a01b03811661049c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6104a581610502565b50565b6000546001600160a01b031633146101eb5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610493565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146104a557600080fd5b60006020828403121561057957600080fd5b813561058481610552565b9392505050565b6000806000606084860312156105a057600080fd5b83356105ab81610552565b925060208401356105bb81610552565b929592945050506040919091013590565b60008083601f8401126105de57600080fd5b50813567ffffffffffffffff8111156105f657600080fd5b60208301915083602082850101111561060e57600080fd5b9250929050565b60008060006040848603121561062a57600080fd5b833561063581610552565b9250602084013567ffffffffffffffff81111561065157600080fd5b61065d868287016105cc565b9497909650939450505050565b6000806020838503121561067d57600080fd5b823567ffffffffffffffff81111561069457600080fd5b6106a0858286016105cc565b90969095509350505050565b6000602082840312156106be57600080fd5b8151801515811461058457600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038416815260406020820181905260009061071c90830184866106ce565b95945050505050565b60008060006060848603121561073a57600080fd5b8351925060208401519150604084015190509250925092565b6020815260006107676020830184866106ce565b94935050505056fea2646970667358221220c0785a1cc37ffa8f096145bce62f62d9cae719c200dba5e33a279c7f0894965164736f6c63430008130033a26469706673582212202de7e9a1b007ca2f3a7a6c53b2972dc3f889e83efde5ce289389b45306e1fe7864736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100405760003560e01c80629c5784146100455780635a3f27d314610074578063b3a51b8414610087575b600080fd5b610058610053366004610288565b61009a565b6040516001600160a01b03909116815260200160405180910390f35b610058610082366004610288565b610115565b6100586100953660046102b2565b6101a4565b600061010e82604051806020016100b09061025f565b601f1982820381018352601f9091011660408181526001600160a01b03881660208301520160408051601f19818403018152908290526100f392916020016102fd565b6040516020818303038152906040528051906020012061022d565b9392505050565b60008082846040516101269061025f565b6001600160a01b0390911681526020018190604051809103906000f5905080158015610156573d6000803e3d6000fd5b50604080516001600160a01b038088168252831660208201529192507f0fb2d916aa6a78060ff9e89d89d62797c6668818dec04969013c5098754380ec910160405180910390a19392505050565b600080826040516101b49061025f565b6001600160a01b039091168152602001604051809103906000f0801580156101e0573d6000803e3d6000fd5b50604080516001600160a01b038087168252831660208201529192507f0fb2d916aa6a78060ff9e89d89d62797c6668818dec04969013c5098754380ec910160405180910390a192915050565b600061010e8383306000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b6109658061031b83390190565b80356001600160a01b038116811461028357600080fd5b919050565b6000806040838503121561029b57600080fd5b6102a48361026c565b946020939093013593505050565b6000602082840312156102c457600080fd5b61010e8261026c565b6000815160005b818110156102ee57602081850181015186830152016102d4565b50600093019283525090919050565b600061031261030c83866102cd565b846102cd565b94935050505056fe608060405234801561001057600080fd5b5060405161096538038061096583398101604081905261002f91610181565b61003833610057565b336001600160a01b0382161461005157610051816100a7565b506101b1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6100af610125565b6001600160a01b0381166101195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61012281610057565b50565b6000546001600160a01b0316331461017f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610110565b565b60006020828403121561019357600080fd5b81516001600160a01b03811681146101aa57600080fd5b9392505050565b6107a5806101c06000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063b688a36311610066578063b688a3631461010e578063bcdd1e1314610116578063d79a824014610129578063ddfdfbb014610157578063f2fde38b1461016a57600080fd5b8063159c5ea1146100a3578063715018a6146100b85780638da5cb5b146100c05780639368a3d3146100ea578063aa15efc8146100fd575b600080fd5b6100b66100b1366004610567565b61017d565b005b6100b66101d9565b6000546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b6100b66100f8366004610567565b6101ed565b6001546001600160a01b03166100cd565b6100b6610257565b6100b661012436600461058b565b61028c565b61013c610137366004610615565b610331565b604080519384526020840192909252908201526060016100e1565b6100b661016536600461066a565b6103ba565b6100b6610178366004610567565b61042a565b6101856104a8565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f2bcd43869347a1d42f97ac6042f3d129817abd05a6125f9750fe3724e321d23e9060200160405180910390a150565b6101e16104a8565b6101eb6000610502565b565b6101f56104a8565b60015460405163fc41168360e01b81526001600160a01b0383811660048301529091169063fc41168390602401600060405180830381600087803b15801561023c57600080fd5b505af1158015610250573d6000803e3d6000fd5b5050505050565b6040513381527f27c2b702d3bff195a18baca2daf00b20a986177c5f1449af4e2d46a3c3e02ce59060200160405180910390a1565b6102946104a8565b60405163a9059cbb60e01b81526001600160a01b038381166004830152602482018390526000919085169063a9059cbb906044016020604051808303816000875af11580156102e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030b91906106ac565b90508061032b5760405163099e1ca760e11b815260040160405180910390fd5b50505050565b60015460405163035e6a0960e61b8152600091829182916001600160a01b03169063d79a82409061036a908990899089906004016106f7565b606060405180830381865afa158015610387573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ab9190610725565b92509250925093509350939050565b6103c26104a8565b600154604051630ddfdfbb60e41b81526001600160a01b039091169063ddfdfbb0906103f49085908590600401610753565b600060405180830381600087803b15801561040e57600080fd5b505af1158015610422573d6000803e3d6000fd5b505050505050565b6104326104a8565b6001600160a01b03811661049c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6104a581610502565b50565b6000546001600160a01b031633146101eb5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610493565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146104a557600080fd5b60006020828403121561057957600080fd5b813561058481610552565b9392505050565b6000806000606084860312156105a057600080fd5b83356105ab81610552565b925060208401356105bb81610552565b929592945050506040919091013590565b60008083601f8401126105de57600080fd5b50813567ffffffffffffffff8111156105f657600080fd5b60208301915083602082850101111561060e57600080fd5b9250929050565b60008060006040848603121561062a57600080fd5b833561063581610552565b9250602084013567ffffffffffffffff81111561065157600080fd5b61065d868287016105cc565b9497909650939450505050565b6000806020838503121561067d57600080fd5b823567ffffffffffffffff81111561069457600080fd5b6106a0858286016105cc565b90969095509350505050565b6000602082840312156106be57600080fd5b8151801515811461058457600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038416815260406020820181905260009061071c90830184866106ce565b95945050505050565b60008060006060848603121561073a57600080fd5b8351925060208401519150604084015190509250925092565b6020815260006107676020830184866106ce565b94935050505056fea2646970667358221220c0785a1cc37ffa8f096145bce62f62d9cae719c200dba5e33a279c7f0894965164736f6c63430008130033a26469706673582212202de7e9a1b007ca2f3a7a6c53b2972dc3f889e83efde5ce289389b45306e1fe7864736f6c63430008130033", - "devdoc": { - "events": { - "AuthorityCreated(address,address)": { - "details": "MUST be triggered on a successful call to `newAuthority`.", - "params": { - "authority": "The authority", - "authorityOwner": "The initial authority owner" - } - } - }, - "kind": "dev", - "methods": { - "calculateAuthorityAddress(address,bytes32)": { - "details": "Beware that only the `newAuthority` function with the `_salt` parameter is able to deterministically deploy an authority.", - "params": { - "_authorityOwner": "The initial authority owner", - "_salt": "The salt used to deterministically generate the authority address" - }, - "returns": { - "_0": "The deterministic authority address" - } - }, - "newAuthority(address)": { - "details": "On success, MUST emit an `AuthorityCreated` event.", - "params": { - "_authorityOwner": "The initial authority owner" - }, - "returns": { - "_0": "The authority" - } - }, - "newAuthority(address,bytes32)": { - "details": "On success, MUST emit an `AuthorityCreated` event.", - "params": { - "_authorityOwner": "The initial authority owner", - "_salt": "The salt used to deterministically generate the authority address" - }, - "returns": { - "_0": "The authority" - } - } - }, - "title": "Authority Factory", - "version": 1 - }, - "userdoc": { - "events": { - "AuthorityCreated(address,address)": { - "notice": "A new authority was deployed." - } - }, - "kind": "user", - "methods": { - "calculateAuthorityAddress(address,bytes32)": { - "notice": "Calculate the address of an authority to be deployed deterministically." - }, - "newAuthority(address)": { - "notice": "Deploy a new authority." - }, - "newAuthority(address,bytes32)": { - "notice": "Deploy a new authority deterministically." - } - }, - "notice": "Allows anyone to reliably deploy a new `Authority` contract.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/deployments/mainnet/CartesiDAppFactory.json b/deployments/mainnet/CartesiDAppFactory.json deleted file mode 100644 index 8f9db2490..000000000 --- a/deployments/mainnet/CartesiDAppFactory.json +++ /dev/null @@ -1,237 +0,0 @@ -{ - "address": "0x7122cd1221C20892234186facfE8615e6743Ab02", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "contract IConsensus", - "name": "consensus", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "dappOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "templateHash", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "contract CartesiDApp", - "name": "application", - "type": "address" - } - ], - "name": "ApplicationCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "contract IConsensus", - "name": "_consensus", - "type": "address" - }, - { - "internalType": "address", - "name": "_dappOwner", - "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": "_dappOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_templateHash", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newApplication", - "outputs": [ - { - "internalType": "contract CartesiDApp", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IConsensus", - "name": "_consensus", - "type": "address" - }, - { - "internalType": "address", - "name": "_dappOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_templateHash", - "type": "bytes32" - } - ], - "name": "newApplication", - "outputs": [ - { - "internalType": "contract CartesiDApp", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0xc87d2b0364d454f4602b0fb2449688ec92a7331415d3bcb3ef808c0d537d7731", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 81, - "gasUsed": "1546312", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x9f93cbb2ad1db3c2b46e4c073d4a9614ed628910fe99a1f7343a65423464a218", - "transactionHash": "0xc87d2b0364d454f4602b0fb2449688ec92a7331415d3bcb3ef808c0d537d7731", - "logs": [], - "blockNumber": 17784740, - "cumulativeGasUsed": "6909161", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 1, - "solcInputHash": "d2696284402b6703b2d41170c93ef3b7", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IConsensus\",\"name\":\"consensus\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"dappOwner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"templateHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"contract CartesiDApp\",\"name\":\"application\",\"type\":\"address\"}],\"name\":\"ApplicationCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"contract IConsensus\",\"name\":\"_consensus\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_dappOwner\",\"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\":\"_dappOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_templateHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"newApplication\",\"outputs\":[{\"internalType\":\"contract CartesiDApp\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IConsensus\",\"name\":\"_consensus\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_dappOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_templateHash\",\"type\":\"bytes32\"}],\"name\":\"newApplication\",\"outputs\":[{\"internalType\":\"contract CartesiDApp\",\"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\":{\"application\":\"The application\",\"consensus\":\"The initial consensus contract\",\"dappOwner\":\"The initial DApp owner\",\"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\":{\"_consensus\":\"The initial consensus contract\",\"_dappOwner\":\"The initial DApp owner\",\"_salt\":\"The salt used to deterministically generate the DApp address\",\"_templateHash\":\"The initial machine state hash\"},\"returns\":{\"_0\":\"The deterministic application address\"}},\"newApplication(address,address,bytes32)\":{\"details\":\"On success, MUST emit an `ApplicationCreated` event.\",\"params\":{\"_consensus\":\"The initial consensus contract\",\"_dappOwner\":\"The initial DApp owner\",\"_templateHash\":\"The initial machine state hash\"},\"returns\":{\"_0\":\"The application\"}},\"newApplication(address,address,bytes32,bytes32)\":{\"details\":\"On success, MUST emit an `ApplicationCreated` event.\",\"params\":{\"_consensus\":\"The initial consensus contract\",\"_dappOwner\":\"The initial DApp owner\",\"_salt\":\"The salt used to deterministically generate the DApp address\",\"_templateHash\":\"The initial machine state hash\"},\"returns\":{\"_0\":\"The application\"}}},\"title\":\"Cartesi DApp 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 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 `CartesiDApp` contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dapp/CartesiDAppFactory.sol\":\"CartesiDAppFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@cartesi/util/contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"},\"@cartesi/util/contracts/CartesiMathV2.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\n/// @title CartesiMath\\n/// @author Felipe Argento\\npragma solidity ^0.8.0;\\n\\nlibrary CartesiMathV2 {\\n // mapping values are packed as bytes3 each\\n // see test/TestCartesiMath.ts for decimal values\\n bytes constant log2tableTimes1M =\\n hex\\\"0000000F4240182F421E8480236E082771822AD63A2DC6C0305E8532B04834C96736B3C23876D73A187A3B9D4A3D09003E5EA63FA0C540D17741F28843057D440BA745062945F60246DC1047B917488DC7495ABA4A207C4ADF8A4B98544C4B404CF8AA4DA0E64E44434EE3054F7D6D5013B750A61A5134C851BFF05247BD52CC58534DE753CC8D54486954C19C55384255AC75561E50568DE956FB575766B057D00758376F589CFA5900BA5962BC59C3135A21CA5A7EF15ADA945B34BF5B8D805BE4DF5C3AEA5C8FA95CE3265D356C5D86835DD6735E25455E73005EBFAD5F0B525F55F75F9FA25FE85A60302460770860BD0A61023061467F6189FD61CCAE620E98624FBF62902762CFD5630ECD634D12638AA963C7966403DC643F7F647A8264B4E864EEB56527EC6560906598A365D029660724663D9766738566A8F066DDDA6712476746386779AF67ACAF67DF3A6811526842FA68743268A4FC68D55C6905536934E169640A6992CF69C13169EF326A1CD46A4A186A76FF6AA38C6ACFC0\\\";\\n\\n /// @notice Approximates log2 * 1M\\n /// @param _num number to take log2 * 1M of\\n /// @return approximate log2 times 1M\\n function log2ApproxTimes1M(uint256 _num) public pure returns (uint256) {\\n require(_num > 0, \\\"Number cannot be zero\\\");\\n uint256 leading = 0;\\n\\n if (_num == 1) return 0;\\n\\n while (_num > 128) {\\n _num = _num >> 1;\\n leading += 1;\\n }\\n return (leading * uint256(1000000)) + (getLog2TableTimes1M(_num));\\n }\\n\\n /// @notice navigates log2tableTimes1M\\n /// @param _num number to take log2 of\\n /// @return result after table look-up\\n function getLog2TableTimes1M(uint256 _num) public pure returns (uint256) {\\n bytes3 result = 0;\\n for (uint8 i = 0; i < 3; i++) {\\n bytes3 tempResult = log2tableTimes1M[(_num - 1) * 3 + i];\\n result = result | (tempResult >> (i * 8));\\n }\\n\\n return uint256(uint24(result));\\n }\\n\\n /// @notice get floor of log2 of number\\n /// @param _num number to take floor(log2) of\\n /// @return floor(log2) of _num\\n function getLog2Floor(uint256 _num) public pure returns (uint8) {\\n require(_num != 0, \\\"log of zero is undefined\\\");\\n\\n return uint8(255 - clz(_num));\\n }\\n\\n /// @notice checks if a number is Power of 2\\n /// @param _num number to check\\n /// @return true if number is power of 2, false if not\\n function isPowerOf2(uint256 _num) public pure returns (bool) {\\n if (_num == 0) return false;\\n\\n return _num & (_num - 1) == 0;\\n }\\n\\n /// @notice count trailing zeros\\n /// @param _num number you want the ctz of\\n /// @dev this a binary search implementation\\n function ctz(uint256 _num) public pure returns (uint256) {\\n if (_num == 0) return 256;\\n\\n uint256 n = 0;\\n if (_num & 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF == 0) {\\n n = n + 128;\\n _num = _num >> 128;\\n }\\n if (_num & 0x000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFF == 0) {\\n n = n + 64;\\n _num = _num >> 64;\\n }\\n if (_num & 0x00000000000000000000000000000000000000000000000000000000FFFFFFFF == 0) {\\n n = n + 32;\\n _num = _num >> 32;\\n }\\n if (_num & 0x000000000000000000000000000000000000000000000000000000000000FFFF == 0) {\\n n = n + 16;\\n _num = _num >> 16;\\n }\\n if (_num & 0x00000000000000000000000000000000000000000000000000000000000000FF == 0) {\\n n = n + 8;\\n _num = _num >> 8;\\n }\\n if (_num & 0x000000000000000000000000000000000000000000000000000000000000000F == 0) {\\n n = n + 4;\\n _num = _num >> 4;\\n }\\n if (_num & 0x0000000000000000000000000000000000000000000000000000000000000003 == 0) {\\n n = n + 2;\\n _num = _num >> 2;\\n }\\n if (_num & 0x0000000000000000000000000000000000000000000000000000000000000001 == 0) {\\n n = n + 1;\\n }\\n\\n return n;\\n }\\n\\n /// @notice count leading zeros\\n /// @param _num number you want the clz of\\n /// @dev this a binary search implementation\\n function clz(uint256 _num) public pure returns (uint256) {\\n if (_num == 0) return 256;\\n\\n uint256 n = 0;\\n if (_num & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000 == 0) {\\n n = n + 128;\\n _num = _num << 128;\\n }\\n if (_num & 0xFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 64;\\n _num = _num << 64;\\n }\\n if (_num & 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 32;\\n _num = _num << 32;\\n }\\n if (_num & 0xFFFF000000000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 16;\\n _num = _num << 16;\\n }\\n if (_num & 0xFF00000000000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 8;\\n _num = _num << 8;\\n }\\n if (_num & 0xF000000000000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 4;\\n _num = _num << 4;\\n }\\n if (_num & 0xC000000000000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 2;\\n _num = _num << 2;\\n }\\n if (_num & 0x8000000000000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 1;\\n }\\n\\n return n;\\n }\\n}\\n\",\"keccak256\":\"0x98fb8d20c05b7c39c44171b6c524cf023da646749eb90157463538da8b2e13d3\",\"license\":\"Apache-2.0\"},\"@cartesi/util/contracts/MerkleV2.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\n/// @title Library for Merkle proofs\\npragma solidity ^0.8.0;\\n\\nimport \\\"./CartesiMathV2.sol\\\";\\n\\nlibrary MerkleV2 {\\n using CartesiMathV2 for uint256;\\n\\n uint128 constant L_WORD_SIZE = 3; // word = 8 bytes, log = 3\\n // number of hashes in EMPTY_TREE_HASHES\\n uint128 constant EMPTY_TREE_SIZE = 1952; // 61*32=1952. 32 bytes per 61 indexes (64 words)\\n\\n // merkle root hashes of trees of zero concatenated\\n // 32 bytes for each root, first one is keccak(0), second one is\\n // keccak(keccack(0), keccak(0)) and so on\\n\\n bytes constant EMPTY_TREE_HASHES =\\n hex\\\"011b4d03dd8c01f1049143cf9c4c817e4b167f1d1b83e5c6f0f10d89ba1e7bce4d9470a821fbe90117ec357e30bad9305732fb19ddf54a07dd3e29f440619254ae39ce8537aca75e2eff3e38c98011dfe934e700a0967732fc07b430dd656a233fc9a15f5b4869c872f81087bb6104b7d63e6f9ab47f2c43f3535eae7172aa7f17d2dd614cddaa4d879276b11e0672c9560033d3e8453a1d045339d34ba601b9c37b8b13ca95166fb7af16988a70fcc90f38bf9126fd833da710a47fb37a55e68e7a427fa943d9966b389f4f257173676090c6e95f43e2cb6d65f8758111e30930b0b9deb73e155c59740bacf14a6ff04b64bb8e201a506409c3fe381ca4ea90cd5deac729d0fdaccc441d09d7325f41586ba13c801b7eccae0f95d8f3933efed8b96e5b7f6f459e9cb6a2f41bf276c7b85c10cd4662c04cbbb365434726c0a0c9695393027fb106a8153109ac516288a88b28a93817899460d6310b71cf1e6163e8806fa0d4b197a259e8c3ac28864268159d0ac85f8581ca28fa7d2c0c03eb91e3eee5ca7a3da2b3053c9770db73599fb149f620e3facef95e947c0ee860b72122e31e4bbd2b7c783d79cc30f60c6238651da7f0726f767d22747264fdb046f7549f26cc70ed5e18baeb6c81bb0625cb95bb4019aeecd40774ee87ae29ec517a71f6ee264c5d761379b3d7d617ca83677374b49d10aec50505ac087408ca892b573c267a712a52e1d06421fe276a03efb1889f337201110fdc32a81f8e152499af665835aabfdc6740c7e2c3791a31c3cdc9f5ab962f681b12fc092816a62f27d86025599a41233848702f0cfc0437b445682df51147a632a0a083d2d38b5e13e466a8935afff58bb533b3ef5d27fba63ee6b0fd9e67ff20af9d50deee3f8bf065ec220c1fd4ba57e341261d55997f85d66d32152526736872693d2b437a233e2337b715f6ac9a6a272622fdc2d67fcfe1da3459f8dab4ed7e40a657a54c36766c5e8ac9a88b35b05c34747e6507f6b044ab66180dc76ac1a696de03189593fedc0d0dbbd855c8ead673544899b0960e4a5a7ca43b4ef90afe607de7698caefdc242788f654b57a4fb32a71b335ef6ff9a4cc118b282b53bdd6d6192b7a82c3c5126b9c7e33c8e5a5ac9738b8bd31247fb7402054f97b573e8abb9faad219f4fd085aceaa7f542d787ee4196d365f3cc566e7bbcfbfd451230c48d804c017d21e2d8fa914e2559bb72bf0ab78c8ab92f00ef0d0d576eccdd486b64138a4172674857e543d1d5b639058dd908186597e366ad5f3d9c7ceaff44d04d1550b8d33abc751df07437834ba5acb32328a396994aebb3c40f759c2d6d7a3cb5377e55d5d218ef5a296dda8ddc355f3f50c3d0b660a51dfa4d98a6a5a33564556cf83c1373a814641d6a1dcef97b883fee61bb84fe60a3409340217e629cc7e4dcc93b85d8820921ff5826148b60e6939acd7838e1d7f20562bff8ee4b5ec4a05ad997a57b9796fdcb2eda87883c2640b072b140b946bfdf6575cacc066fdae04f6951e63624cbd316a677cad529bbe4e97b9144e4bc06c4afd1de55dd3e1175f90423847a230d34dfb71ed56f2965a7f6c72e6aa33c24c303fd67745d632656c5ef90bec80f4f5d1daa251988826cef375c81c36bf457e09687056f924677cb0bccf98dff81e014ce25f2d132497923e267363963cdf4302c5049d63131dc03fd95f65d8b6aa5934f817252c028c90f56d413b9d5d10d89790707dae2fabb249f649929927c21dd71e3f656826de5451c5da375aadecbd59d5ebf3a31fae65ac1b316a1611f1b276b26530f58d7247df459ce1f86db1d734f6f811932f042cee45d0e455306d01081bc3384f82c5fb2aacaa19d89cdfa46cc916eac61121475ba2e6191b4feecbe1789717021a158ace5d06744b40f551076b67cd63af60007f8c99876e1424883a45ec49d497ddaf808a5521ca74a999ab0b3c7aa9c80f85e93977ec61ce68b20307a1a81f71ca645b568fcd319ccbb5f651e87b707d37c39e15f945ea69e2f7c7d2ccc85b7e654c07e96f0636ae4044fe0e38590b431795ad0f8647bdd613713ada493cc17efd313206380e6a685b8198475bbd021c6e9d94daab2214947127506073e44d5408ba166c512a0b86805d07f5a44d3c41706be2bc15e712e55805248b92e8677d90f6d284d1d6ffaff2c430657042a0e82624fa3717b06cc0a6fd12230ea586dae83019fb9e06034ed2803c98d554b93c9a52348cafff75c40174a91f9ae6b8647854a156029f0b88b83316663ce574a4978277bb6bb27a31085634b6ec78864b6d8201c7e93903d75815067e378289a3d072ae172dafa6a452470f8d645bebfad9779594fc0784bb764a22e3a8181d93db7bf97893c414217a618ccb14caa9e92e8c61673afc9583662e812adba1f87a9c68202d60e909efab43c42c0cb00695fc7f1ffe67c75ca894c3c51e1e5e731360199e600f6ced9a87b2a6a87e70bf251bb5075ab222138288164b2eda727515ea7de12e2496d4fe42ea8d1a120c03cf9c50622c2afe4acb0dad98fd62d07ab4e828a94495f6d1ab973982c7ccbe6c1fae02788e4422ae22282fa49cbdb04ba54a7a238c6fc41187451383460762c06d1c8a72b9cd718866ad4b689e10c9a8c38fe5ef045bd785b01e980fc82c7e3532ce81876b778dd9f1ceeba4478e86411fb6fdd790683916ca832592485093644e8760cd7b4c01dba1ccc82b661bf13f0e3f34acd6b88\\\";\\n\\n /// @notice Gets merkle root hash of drive with a replacement\\n /// @param _position position of _drive\\n /// @param _logSizeOfReplacement log2 of size the replacement\\n /// @param _logSizeOfFullDrive log2 of size the full drive, which can be the entire machine\\n /// @param _replacement hash of the replacement\\n /// @param siblings of replacement that merkle root can be calculated\\n function getRootAfterReplacementInDrive(\\n uint256 _position,\\n uint256 _logSizeOfReplacement,\\n uint256 _logSizeOfFullDrive,\\n bytes32 _replacement,\\n bytes32[] calldata siblings\\n ) public pure returns (bytes32) {\\n require(\\n _logSizeOfFullDrive >= _logSizeOfReplacement && _logSizeOfReplacement >= 3 && _logSizeOfFullDrive <= 64,\\n \\\"3 <= logSizeOfReplacement <= logSizeOfFullDrive <= 64\\\"\\n );\\n\\n uint256 size = 1 << _logSizeOfReplacement;\\n\\n require(((size - 1) & _position) == 0, \\\"Position is not aligned\\\");\\n require(siblings.length == _logSizeOfFullDrive - _logSizeOfReplacement, \\\"Proof length does not match\\\");\\n\\n for (uint256 i; i < siblings.length; i++) {\\n if ((_position & (size << i)) == 0) {\\n _replacement = keccak256(abi.encodePacked(_replacement, siblings[i]));\\n } else {\\n _replacement = keccak256(abi.encodePacked(siblings[i], _replacement));\\n }\\n }\\n\\n return _replacement;\\n }\\n\\n /// @notice Gets precomputed hash of zero in empty tree hashes\\n /// @param _index of hash wanted\\n /// @dev first index is keccak(0), second index is keccak(keccak(0), keccak(0))\\n function getEmptyTreeHashAtIndex(uint256 _index) public pure returns (bytes32) {\\n uint256 start = _index * 32;\\n require(EMPTY_TREE_SIZE >= start + 32, \\\"index out of bounds\\\");\\n bytes32 hashedZeros;\\n bytes memory zeroTree = EMPTY_TREE_HASHES;\\n\\n // first word is length, then skip index words\\n assembly {\\n hashedZeros := mload(add(add(zeroTree, 0x20), start))\\n }\\n return hashedZeros;\\n }\\n\\n /// @notice get merkle root of generic array of bytes\\n /// @param _data array of bytes to be merklelized\\n /// @param _log2Size log2 of total size of the drive\\n /// @dev _data is padded with zeroes until is multiple of 8\\n /// @dev root is completed with zero tree until log2size is complete\\n /// @dev hashes are taken word by word (8 bytes by 8 bytes)\\n function getMerkleRootFromBytes(bytes calldata _data, uint256 _log2Size) public pure returns (bytes32) {\\n require(_log2Size >= 3 && _log2Size <= 64, \\\"range of log2Size: [3,64]\\\");\\n\\n // if _data is empty return pristine drive of size log2size\\n if (_data.length == 0) return getEmptyTreeHashAtIndex(_log2Size - 3);\\n\\n // total size of the drive in words\\n uint256 size = 1 << (_log2Size - 3);\\n require(size << L_WORD_SIZE >= _data.length, \\\"data is bigger than drive\\\");\\n // the stack depth is log2(_data.length / 8) + 2\\n uint256 stack_depth = 2 + ((_data.length) >> L_WORD_SIZE).getLog2Floor();\\n bytes32[] memory stack = new bytes32[](stack_depth);\\n\\n uint256 numOfHashes; // total number of hashes on stack (counting levels)\\n uint256 stackLength; // total length of stack\\n uint256 numOfJoins; // number of hashes of the same level on stack\\n uint256 topStackLevel; // hash level of the top of the stack\\n\\n while (numOfHashes < size) {\\n if ((numOfHashes << L_WORD_SIZE) < _data.length) {\\n // we still have words to hash\\n stack[stackLength] = getHashOfWordAtIndex(_data, numOfHashes);\\n numOfHashes++;\\n\\n numOfJoins = numOfHashes;\\n } else {\\n // since padding happens in hashOfWordAtIndex function\\n // we only need to complete the stack with pre-computed\\n // hash(0), hash(hash(0),hash(0)) and so on\\n topStackLevel = numOfHashes.ctz();\\n\\n stack[stackLength] = getEmptyTreeHashAtIndex(topStackLevel);\\n\\n //Empty Tree Hash summarizes many hashes\\n numOfHashes = numOfHashes + (1 << topStackLevel);\\n numOfJoins = numOfHashes >> topStackLevel;\\n }\\n\\n stackLength++;\\n\\n // while there are joins, hash top of stack together\\n while (numOfJoins & 1 == 0) {\\n bytes32 h2 = stack[stackLength - 1];\\n bytes32 h1 = stack[stackLength - 2];\\n\\n stack[stackLength - 2] = keccak256(abi.encodePacked(h1, h2));\\n stackLength = stackLength - 1; // remove hashes from stack\\n\\n numOfJoins = numOfJoins >> 1;\\n }\\n }\\n require(stackLength == 1, \\\"stack error\\\");\\n\\n return stack[0];\\n }\\n\\n /// @notice Get the hash of a word in an array of bytes\\n /// @param _data array of bytes\\n /// @param _wordIndex index of word inside the bytes to get the hash of\\n /// @dev if word is incomplete (< 8 bytes) it gets padded with zeroes\\n function getHashOfWordAtIndex(bytes calldata _data, uint256 _wordIndex) public pure returns (bytes32) {\\n uint256 start = _wordIndex << L_WORD_SIZE;\\n uint256 end = start + (1 << L_WORD_SIZE);\\n\\n // TODO: in .lua this just returns zero, but this might be more consistent\\n require(start <= _data.length, \\\"word out of bounds\\\");\\n\\n if (end <= _data.length) {\\n return keccak256(abi.encodePacked(_data[start:end]));\\n }\\n\\n // word is incomplete\\n // fill paddedSlice with incomplete words - the rest is going to be bytes(0)\\n bytes memory paddedSlice = new bytes(8);\\n uint256 remaining = _data.length - start;\\n\\n for (uint256 i; i < remaining; i++) {\\n paddedSlice[i] = _data[start + i];\\n }\\n\\n return keccak256(paddedSlice);\\n }\\n\\n /// @notice Calculate the root of Merkle tree from an array of power of 2 elements\\n /// @param hashes The array containing power of 2 elements\\n /// @return byte32 the root hash being calculated\\n function calculateRootFromPowerOfTwo(bytes32[] memory hashes) public pure returns (bytes32) {\\n // revert when the input is not of power of 2\\n require((hashes.length).isPowerOf2(), \\\"array len not power of 2\\\");\\n\\n if (hashes.length == 1) {\\n return hashes[0];\\n } else {\\n bytes32[] memory newHashes = new bytes32[](hashes.length >> 1);\\n\\n for (uint256 i; i < hashes.length; i += 2) {\\n newHashes[i >> 1] = keccak256(abi.encodePacked(hashes[i], hashes[i + 1]));\\n }\\n\\n return calculateRootFromPowerOfTwo(newHashes);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x73d86cb2dfa2ca887987c6da8d193d523c6a65ea89e296d1f47f190ebda7fa9b\",\"license\":\"Apache-2.0\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\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 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 require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\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\":\"0xa535a5df777d44e945dd24aa43a11e44b024140fc340ad0dfe42acf4002aade1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev _Available since v3.1._\\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\":\"0xeb373f1fdc7b755c6a750123a9b9e3a8a02c1470042fd6505d875000a80bde0b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/utils/ERC1155Holder.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./ERC1155Receiver.sol\\\";\\n\\n/**\\n * Simple implementation of `ERC1155Receiver` 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 *\\n * @dev _Available since v3.1._\\n */\\ncontract ERC1155Holder is ERC1155Receiver {\\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\":\"0x2e024ca51ce5abe16c0d34e6992a1104f356e2244eb4ccbec970435e8b3405e3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC1155Receiver.sol\\\";\\nimport \\\"../../../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev _Available since v3.1._\\n */\\nabstract contract ERC1155Receiver 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\",\"keccak256\":\"0x3dd5e1a66a56f30302108a1da97d677a42b1daa60e503696b2bcbbf3e4c95bcb\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\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 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\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/utils/ERC721Holder.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../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 {IERC721-setApprovalForAll}.\\n */\\ncontract 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 override returns (bytes4) {\\n return this.onERC721Received.selector;\\n }\\n}\\n\",\"keccak256\":\"0x67ef46fef257faae47adb630aad49694dda0334e5f7a7c5fb386243b974886b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\\n require(address(this).balance >= amount, \\\"Create2: insufficient balance\\\");\\n require(bytecode.length != 0, \\\"Create2: bytecode length is zero\\\");\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n require(addr != address(0), \\\"Create2: Failed on deploy\\\");\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6e00f269073ffc4350e56b7e8153c9092d5f70bfba423299990514183101ef89\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./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 *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/common/CanonicalMachine.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @title Canonical Machine Constants Library\\n///\\n/// @notice Defines several constants related to the reference implementation\\n/// of the RISC-V machine that runs Linux, also known as the \\\"Cartesi Machine\\\".\\nlibrary CanonicalMachine {\\n /// @notice Base-2 logarithm of number of bytes.\\n type Log2Size is uint64;\\n\\n /// @notice Machine word size (8 bytes).\\n Log2Size constant WORD_LOG2_SIZE = Log2Size.wrap(3);\\n\\n /// @notice Machine address space size (2^64 bytes).\\n Log2Size constant MACHINE_LOG2_SIZE = Log2Size.wrap(64);\\n\\n /// @notice Keccak-256 output size (32 bytes).\\n Log2Size constant KECCAK_LOG2_SIZE = Log2Size.wrap(5);\\n\\n /// @notice Maximum input size (~2 megabytes).\\n /// @dev The offset and size fields use up the extra 64 bytes.\\n uint256 constant INPUT_MAX_SIZE = (1 << 21) - 64;\\n\\n /// @notice Maximum voucher metadata memory range (2 megabytes).\\n Log2Size constant VOUCHER_METADATA_LOG2_SIZE = Log2Size.wrap(21);\\n\\n /// @notice Maximum notice metadata memory range (2 megabytes).\\n Log2Size constant NOTICE_METADATA_LOG2_SIZE = Log2Size.wrap(21);\\n\\n /// @notice Maximum epoch voucher memory range (128 megabytes).\\n Log2Size constant EPOCH_VOUCHER_LOG2_SIZE = Log2Size.wrap(37);\\n\\n /// @notice Maximum epoch notice memory range (128 megabytes).\\n Log2Size constant EPOCH_NOTICE_LOG2_SIZE = Log2Size.wrap(37);\\n\\n /// @notice Unwrap `s` into its underlying uint64 value.\\n /// @param s Base-2 logarithm of some number of bytes\\n function uint64OfSize(Log2Size s) internal pure returns (uint64) {\\n return Log2Size.unwrap(s);\\n }\\n\\n /// @notice Return the position of an intra memory range on a memory range\\n /// with contents with the same size.\\n /// @param index Index of intra memory range\\n /// @param log2Size Base-2 logarithm of intra memory range size\\n function getIntraMemoryRangePosition(\\n uint64 index,\\n Log2Size log2Size\\n ) internal pure returns (uint64) {\\n return index << Log2Size.unwrap(log2Size);\\n }\\n}\\n\",\"keccak256\":\"0x97cdce56cdb4f0b4164e6be3a72e50469a3124e4716e753a1792aa70eac614f5\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/common/OutputEncoding.sol\":{\"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 Output Encoding Library\\n///\\n/// @notice Defines the encoding of outputs generated by the off-chain machine.\\nlibrary OutputEncoding {\\n /// @notice Encode a notice.\\n /// @param notice The notice\\n /// @return The encoded output\\n function encodeNotice(\\n bytes calldata notice\\n ) internal pure returns (bytes memory) {\\n return abi.encode(notice);\\n }\\n\\n /// @notice Encode a voucher.\\n /// @param destination The address that will receive the payload through a message call\\n /// @param payload The payload, which\\u2014in the case of Solidity contracts\\u2014encodes a function call\\n /// @return The encoded output\\n function encodeVoucher(\\n address destination,\\n bytes calldata payload\\n ) internal pure returns (bytes memory) {\\n return abi.encode(destination, payload);\\n }\\n}\\n\",\"keccak256\":\"0xfbf8bd40a11aeb380c77910ef7a8c3a4b358dddbd8bc795529de39c955dd6f60\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/IConsensus.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @title Consensus interface\\n///\\n/// @notice This contract defines a generic interface for consensuses.\\n/// We use the word \\\"consensus\\\" to designate a contract that provides claims\\n/// in the base layer regarding the state of off-chain machines running in\\n/// the execution layer. How this contract is able to reach consensus, who is\\n/// able to submit claims, and how are claims stored in the base layer are\\n/// some of the implementation details left unspecified by this interface.\\n///\\n/// From the point of view of a DApp, these claims are necessary to validate\\n/// on-chain action allowed by the off-chain machine in the form of vouchers\\n/// and notices. Each claim is composed of three parts: an epoch hash, a first\\n/// index, and a last index. We'll explain each of these parts below.\\n///\\n/// First, let us define the word \\\"epoch\\\". For finality reasons, we need to\\n/// divide the stream of inputs being fed into the off-chain machine into\\n/// batches of inputs, which we call \\\"epoches\\\". At the end of every epoch,\\n/// we summarize the state of the off-chain machine in a single hash, called\\n/// \\\"epoch hash\\\". Please note that this interface does not define how this\\n/// stream of inputs is being chopped up into epoches.\\n///\\n/// The other two parts are simply the indices of the first and last inputs\\n/// accepted during the epoch. Logically, the first index MUST BE less than\\n/// or equal to the last index. As a result, every epoch MUST accept at least\\n/// one input. This assumption stems from the fact that the state of a machine\\n/// can only change after an input is fed into it.\\n///\\n/// Examples of possible implementations of this interface include:\\n///\\n/// * An authority consensus, controlled by a single address who has full\\n/// control over epoch boundaries, claim submission, asset management, etc.\\n///\\n/// * A quorum consensus, controlled by a limited set of validators, that\\n/// vote on the state of the machine at the end of every epoch. Also, epoch\\n/// boundaries are determined by the timestamp in the base layer, and assets\\n/// are split equally amongst the validators.\\n///\\n/// * An NxN consensus, which allows anyone to submit and dispute claims\\n/// in the base layer. Epoch boundaries are determined in the same fashion\\n/// as in the quorum example.\\n///\\ninterface IConsensus {\\n /// @notice An application has joined the consensus' validation set.\\n /// @param application The application\\n /// @dev MUST be triggered on a successful call to `join`.\\n event ApplicationJoined(address application);\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// The encoding of `_proofContext` might vary\\n /// depending on the implementation.\\n /// @param _dapp The DApp address\\n /// @param _proofContext Data for retrieving the desired claim\\n /// @return epochHash_ The claimed epoch hash\\n /// @return firstInputIndex_ The index of the first input of the epoch in the input box\\n /// @return lastInputIndex_ The index of the last input of the epoch in the input box\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n )\\n external\\n view\\n returns (\\n bytes32 epochHash_,\\n uint256 firstInputIndex_,\\n uint256 lastInputIndex_\\n );\\n\\n /// @notice Signal the consensus that the message sender wants to join its validation set.\\n /// @dev MUST fire an `ApplicationJoined` event with the message sender as argument.\\n function join() external;\\n}\\n\",\"keccak256\":\"0xc9d295fada66eb0602e0f1e2e236708e52f959927abb4ab6b04173a98b92ac16\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/CartesiDApp.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {ICartesiDApp, Proof} from \\\"./ICartesiDApp.sol\\\";\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\nimport {LibOutputValidation, OutputValidityProof} from \\\"../library/LibOutputValidation.sol\\\";\\nimport {Bitmask} from \\\"@cartesi/util/contracts/Bitmask.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/security/ReentrancyGuard.sol\\\";\\n\\n/// @title Cartesi DApp\\n///\\n/// @notice This contract acts as the base layer incarnation of a DApp running on the execution layer.\\n/// The DApp is hereby able to interact with other smart contracts through the execution of vouchers\\n/// and the validation of notices. These outputs are generated by the DApp backend on the execution\\n/// layer and can be proven in the base layer thanks to claims submitted by a consensus contract.\\n///\\n/// A voucher is a one-time message call to another contract. It can encode asset transfers, approvals,\\n/// or any other message call that doesn't require Ether to be sent along. A voucher will only be consumed\\n/// if the underlying message call succeeds (that is, it doesn't revert). Furthermore, the return data of\\n/// the message call is discarded entirely. As a protective measure against reentrancy attacks, nested\\n/// voucher executions are prohibited.\\n///\\n/// A notice, on the other hand, constitutes an arbitrary piece of data that can be proven any number of times.\\n/// On their own, they do not trigger any type of contract-to-contract interaction.\\n/// Rather, they merely serve to attest off-chain results, e.g. which player won a particular chess match.\\n///\\n/// Every DApp is subscribed to a consensus contract, and governed by a single address, the owner.\\n/// The consensus has the power of submitting claims, which, in turn, are used to validate vouchers and notices.\\n/// Meanwhile, the owner has complete power over the DApp, as it can replace the consensus at any time.\\n/// Therefore, the users of a DApp must trust both the consensus and the DApp owner.\\n///\\n/// The DApp developer can choose whichever ownership and consensus models it wants.\\n///\\n/// Examples of DApp ownership models include:\\n///\\n/// * no owner (address zero)\\n/// * individual signer (externally-owned account)\\n/// * multiple signers (multi-sig)\\n/// * DAO (decentralized autonomous organization)\\n/// * self-owned DApp (off-chain governance logic)\\n///\\n/// See `IConsensus` for examples of consensus models.\\n///\\n/// This contract inherits the following OpenZeppelin contracts.\\n/// For more information, please consult OpenZeppelin's official documentation.\\n///\\n/// * `Ownable`\\n/// * `ERC721Holder`\\n/// * `ERC1155Holder`\\n/// * `ReentrancyGuard`\\n///\\ncontract CartesiDApp is\\n ICartesiDApp,\\n Ownable,\\n ERC721Holder,\\n ERC1155Holder,\\n ReentrancyGuard\\n{\\n using Bitmask for mapping(uint256 => uint256);\\n using LibOutputValidation for OutputValidityProof;\\n\\n /// @notice Raised when executing an already executed voucher.\\n error VoucherReexecutionNotAllowed();\\n\\n /// @notice Raised when the transfer fails.\\n error EtherTransferFailed();\\n\\n /// @notice Raised when a mehtod is not called by DApp itself.\\n error OnlyDApp();\\n\\n /// @notice The initial machine state hash.\\n /// @dev See the `getTemplateHash` function.\\n bytes32 internal immutable templateHash;\\n\\n /// @notice The executed voucher bitmask, which keeps track of which vouchers\\n /// were executed already in order to avoid re-execution.\\n /// @dev See the `wasVoucherExecuted` function.\\n mapping(uint256 => uint256) internal voucherBitmask;\\n\\n /// @notice The current consensus contract.\\n /// @dev See the `getConsensus` and `migrateToConsensus` functions.\\n IConsensus internal consensus;\\n\\n /// @notice Creates a `CartesiDApp` contract.\\n /// @param _consensus The initial consensus contract\\n /// @param _owner The initial DApp owner\\n /// @param _templateHash The initial machine state hash\\n /// @dev Calls the `join` function on `_consensus`.\\n constructor(IConsensus _consensus, address _owner, bytes32 _templateHash) {\\n transferOwnership(_owner);\\n templateHash = _templateHash;\\n consensus = _consensus;\\n\\n _consensus.join();\\n }\\n\\n function executeVoucher(\\n address _destination,\\n bytes calldata _payload,\\n Proof calldata _proof\\n ) external override nonReentrant returns (bool) {\\n bytes32 epochHash;\\n uint256 firstInputIndex;\\n uint256 lastInputIndex;\\n uint256 inputIndex;\\n\\n // query the current consensus for the desired claim\\n (epochHash, firstInputIndex, lastInputIndex) = getClaim(_proof.context);\\n\\n // validate input index range and calculate the input index\\n // based on the input index range provided by the consensus\\n inputIndex = _proof.validity.validateInputIndexRange(\\n firstInputIndex,\\n lastInputIndex\\n );\\n\\n // reverts if proof isn't valid\\n _proof.validity.validateVoucher(_destination, _payload, epochHash);\\n\\n uint256 voucherPosition = LibOutputValidation.getBitMaskPosition(\\n _proof.validity.outputIndexWithinInput,\\n inputIndex\\n );\\n\\n // check if voucher has been executed\\n if (_wasVoucherExecuted(voucherPosition)) {\\n revert VoucherReexecutionNotAllowed();\\n }\\n\\n // execute voucher\\n (bool succ, ) = _destination.call(_payload);\\n\\n // if properly executed, mark it as executed and emit event\\n if (succ) {\\n voucherBitmask.setBit(voucherPosition, true);\\n emit VoucherExecuted(voucherPosition);\\n }\\n\\n return succ;\\n }\\n\\n function wasVoucherExecuted(\\n uint256 _inputIndex,\\n uint256 _outputIndexWithinInput\\n ) external view override returns (bool) {\\n uint256 voucherPosition = LibOutputValidation.getBitMaskPosition(\\n _outputIndexWithinInput,\\n _inputIndex\\n );\\n return _wasVoucherExecuted(voucherPosition);\\n }\\n\\n function _wasVoucherExecuted(\\n uint256 _voucherPosition\\n ) internal view returns (bool) {\\n return voucherBitmask.getBit(_voucherPosition);\\n }\\n\\n function validateNotice(\\n bytes calldata _notice,\\n Proof calldata _proof\\n ) external view override returns (bool) {\\n bytes32 epochHash;\\n uint256 firstInputIndex;\\n uint256 lastInputIndex;\\n\\n // query the current consensus for the desired claim\\n (epochHash, firstInputIndex, lastInputIndex) = getClaim(_proof.context);\\n\\n // validate the epoch input index based on the input index range\\n // provided by the consensus\\n _proof.validity.validateInputIndexRange(\\n firstInputIndex,\\n lastInputIndex\\n );\\n\\n // reverts if proof isn't valid\\n _proof.validity.validateNotice(_notice, epochHash);\\n\\n return true;\\n }\\n\\n /// @notice Retrieve a claim about the DApp from the current consensus.\\n /// The encoding of `_proofContext` might vary depending on the implementation.\\n /// @param _proofContext Data for retrieving the desired claim\\n /// @return The claimed epoch hash\\n /// @return The index of the first input of the epoch in the input box\\n /// @return The index of the last input of the epoch in the input box\\n function getClaim(\\n bytes calldata _proofContext\\n ) internal view returns (bytes32, uint256, uint256) {\\n return consensus.getClaim(address(this), _proofContext);\\n }\\n\\n function migrateToConsensus(\\n IConsensus _newConsensus\\n ) external override onlyOwner {\\n consensus = _newConsensus;\\n\\n _newConsensus.join();\\n\\n emit NewConsensus(_newConsensus);\\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 /// @notice Accept Ether transfers.\\n /// @dev If you wish to transfer Ether to a DApp while informing\\n /// the DApp backend of it, then please do so through the Ether portal contract.\\n receive() external payable {}\\n\\n /// @notice Transfer some amount of Ether to some recipient.\\n /// @param _receiver The address which will receive the amount of Ether\\n /// @param _value The amount of Ether to be transferred in Wei\\n /// @dev This function can only be called by the DApp itself through vouchers.\\n /// If this method is not called by DApp itself, `OnlyDApp` error is raised.\\n /// If the transfer fails, `EtherTransferFailed` error is raised.\\n function withdrawEther(address _receiver, uint256 _value) external {\\n if (msg.sender != address(this)) {\\n revert OnlyDApp();\\n }\\n\\n (bool sent, ) = _receiver.call{value: _value}(\\\"\\\");\\n\\n if (!sent) {\\n revert EtherTransferFailed();\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe54766db1afcbb9578fffc1a87927d95673f1a630d88a7889941878a89761128\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/CartesiDAppFactory.sol\":{\"content\":\"// (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 {ICartesiDAppFactory} from \\\"./ICartesiDAppFactory.sol\\\";\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\nimport {CartesiDApp} from \\\"./CartesiDApp.sol\\\";\\n\\n/// @title Cartesi DApp Factory\\n/// @notice Allows anyone to reliably deploy a new `CartesiDApp` contract.\\ncontract CartesiDAppFactory is ICartesiDAppFactory {\\n function newApplication(\\n IConsensus _consensus,\\n address _dappOwner,\\n bytes32 _templateHash\\n ) external override returns (CartesiDApp) {\\n CartesiDApp application = new CartesiDApp(\\n _consensus,\\n _dappOwner,\\n _templateHash\\n );\\n\\n emit ApplicationCreated(\\n _consensus,\\n _dappOwner,\\n _templateHash,\\n application\\n );\\n\\n return application;\\n }\\n\\n function newApplication(\\n IConsensus _consensus,\\n address _dappOwner,\\n bytes32 _templateHash,\\n bytes32 _salt\\n ) external override returns (CartesiDApp) {\\n CartesiDApp application = new CartesiDApp{salt: _salt}(\\n _consensus,\\n _dappOwner,\\n _templateHash\\n );\\n\\n emit ApplicationCreated(\\n _consensus,\\n _dappOwner,\\n _templateHash,\\n application\\n );\\n\\n return application;\\n }\\n\\n function calculateApplicationAddress(\\n IConsensus _consensus,\\n address _dappOwner,\\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(CartesiDApp).creationCode,\\n abi.encode(_consensus, _dappOwner, _templateHash)\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0xd5f93d28a69df7dc63205026dc5a1865ee989a683f3e648812ded6cefb35f10d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/ICartesiDApp.sol\":{\"content\":\"// (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 \\\"../consensus/IConsensus.sol\\\";\\nimport {OutputValidityProof} from \\\"../library/LibOutputValidation.sol\\\";\\n\\n/// @notice Data for validating outputs.\\n/// @param validity A validity proof for the output\\n/// @param context Data for querying the right claim from the current consensus contract\\n/// @dev The encoding of `context` might vary depending on the implementation of the consensus contract.\\nstruct Proof {\\n OutputValidityProof validity;\\n bytes context;\\n}\\n\\n/// @title Cartesi DApp interface\\ninterface ICartesiDApp {\\n // Events\\n\\n /// @notice The DApp has migrated to another consensus contract.\\n /// @param newConsensus The new consensus contract\\n /// @dev MUST be triggered on a successful call to `migrateToConsensus`.\\n event NewConsensus(IConsensus newConsensus);\\n\\n /// @notice A voucher was executed from the DApp.\\n /// @param voucherId A number that uniquely identifies the voucher\\n /// amongst all vouchers emitted by this DApp\\n event VoucherExecuted(uint256 voucherId);\\n\\n // Permissioned functions\\n\\n /// @notice Migrate the DApp to a new consensus.\\n /// @param _newConsensus The new consensus\\n /// @dev Can only be called by the DApp owner.\\n function migrateToConsensus(IConsensus _newConsensus) external;\\n\\n // Permissionless functions\\n\\n /// @notice Try to execute a voucher.\\n ///\\n /// Reverts if voucher was already successfully executed.\\n ///\\n /// @param _destination The address that will receive the payload through a message call\\n /// @param _payload The payload, which\\u2014in the case of Solidity contracts\\u2014encodes a function call\\n /// @param _proof The proof used to validate the voucher against\\n /// a claim submitted by the current consensus contract\\n /// @return Whether the execution was successful or not\\n /// @dev On a successful execution, emits a `VoucherExecuted` event.\\n /// Execution of already executed voucher will raise a `VoucherReexecutionNotAllowed` error.\\n function executeVoucher(\\n address _destination,\\n bytes calldata _payload,\\n Proof calldata _proof\\n ) external returns (bool);\\n\\n /// @notice Check whether a voucher has been executed.\\n /// @param _inputIndex The index of the input in the input box\\n /// @param _outputIndexWithinInput The index of output emitted by the input\\n /// @return Whether the voucher has been executed before\\n function wasVoucherExecuted(\\n uint256 _inputIndex,\\n uint256 _outputIndexWithinInput\\n ) external view returns (bool);\\n\\n /// @notice Validate a notice.\\n /// @param _notice The notice\\n /// @param _proof Data for validating outputs\\n /// @return Whether the notice is valid or not\\n function validateNotice(\\n bytes calldata _notice,\\n Proof calldata _proof\\n ) external view returns (bool);\\n\\n /// @notice Get the DApp's template hash.\\n /// @return The DApp'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\":\"0x7bb375a4deb593af06955bbf1d88e096f4288f25fa032349796f93705d29386f\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/ICartesiDAppFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {CartesiDApp} from \\\"./CartesiDApp.sol\\\";\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\n\\n/// @title Cartesi DApp Factory interface\\ninterface ICartesiDAppFactory {\\n // Events\\n\\n /// @notice A new application was deployed.\\n /// @param consensus The initial consensus contract\\n /// @param dappOwner The initial DApp owner\\n /// @param templateHash The initial machine state hash\\n /// @param application The application\\n /// @dev MUST be triggered on a successful call to `newApplication`.\\n event ApplicationCreated(\\n IConsensus indexed consensus,\\n address dappOwner,\\n bytes32 templateHash,\\n CartesiDApp application\\n );\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new application.\\n /// @param _consensus The initial consensus contract\\n /// @param _dappOwner The initial DApp owner\\n /// @param _templateHash The initial machine state hash\\n /// @return The application\\n /// @dev On success, MUST emit an `ApplicationCreated` event.\\n function newApplication(\\n IConsensus _consensus,\\n address _dappOwner,\\n bytes32 _templateHash\\n ) external returns (CartesiDApp);\\n\\n /// @notice Deploy a new application deterministically.\\n /// @param _consensus The initial consensus contract\\n /// @param _dappOwner The initial DApp owner\\n /// @param _templateHash The initial machine state hash\\n /// @param _salt The salt used to deterministically generate the DApp address\\n /// @return The application\\n /// @dev On success, MUST emit an `ApplicationCreated` event.\\n function newApplication(\\n IConsensus _consensus,\\n address _dappOwner,\\n bytes32 _templateHash,\\n bytes32 _salt\\n ) external returns (CartesiDApp);\\n\\n /// @notice Calculate the address of an application to be deployed deterministically.\\n /// @param _consensus The initial consensus contract\\n /// @param _dappOwner The initial DApp owner\\n /// @param _templateHash The initial machine state hash\\n /// @param _salt The salt used to deterministically generate the DApp address\\n /// @return The deterministic application 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 _dappOwner,\\n bytes32 _templateHash,\\n bytes32 _salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0xb6d6ae44b2195f54a5c5ac85dc1c33801036878982c6b9aafe8fb66a3103517b\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/library/LibOutputValidation.sol\":{\"content\":\"// (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 {MerkleV2} from \\\"@cartesi/util/contracts/MerkleV2.sol\\\";\\nimport {OutputEncoding} from \\\"../common/OutputEncoding.sol\\\";\\n\\n/// @param inputIndexWithinEpoch Which input, inside the epoch, the output belongs to\\n/// @param outputIndexWithinInput Index of output emitted by the input\\n/// @param outputHashesRootHash Merkle root of hashes of outputs emitted by the input\\n/// @param vouchersEpochRootHash Merkle root of all epoch's voucher metadata hashes\\n/// @param noticesEpochRootHash Merkle root of all epoch's notice metadata hashes\\n/// @param machineStateHash Hash of the machine state claimed this epoch\\n/// @param outputHashInOutputHashesSiblings Proof that this output metadata is in metadata memory range\\n/// @param outputHashesInEpochSiblings Proof that this output metadata is in epoch's output memory range\\nstruct OutputValidityProof {\\n uint64 inputIndexWithinEpoch;\\n uint64 outputIndexWithinInput;\\n bytes32 outputHashesRootHash;\\n bytes32 vouchersEpochRootHash;\\n bytes32 noticesEpochRootHash;\\n bytes32 machineStateHash;\\n bytes32[] outputHashInOutputHashesSiblings;\\n bytes32[] outputHashesInEpochSiblings;\\n}\\n\\n/// @title Output Validation Library\\nlibrary LibOutputValidation {\\n using CanonicalMachine for CanonicalMachine.Log2Size;\\n\\n /// @notice Raised when some `OutputValidityProof` variables does not match\\n /// the presented finalized epoch.\\n error IncorrectEpochHash();\\n\\n /// @notice Raised when `OutputValidityProof` metadata memory range is NOT\\n /// contained in epoch's output memory range.\\n error IncorrectOutputsEpochRootHash();\\n\\n /// @notice Raised when Merkle root of output hash is NOT contained\\n /// in the output metadata array memory range.\\n error IncorrectOutputHashesRootHash();\\n\\n /// @notice Raised when epoch input index is NOT compatible with the\\n /// provided input index range.\\n error InputIndexOutOfClaimBounds();\\n\\n /// @notice Make sure the output proof is valid, otherwise revert.\\n /// @param v The output validity proof\\n /// @param encodedOutput The encoded output\\n /// @param epochHash The hash of the epoch in which the output was generated\\n /// @param outputsEpochRootHash Either `v.vouchersEpochRootHash` (for vouchers)\\n /// or `v.noticesEpochRootHash` (for notices)\\n /// @param outputEpochLog2Size Either `EPOCH_VOUCHER_LOG2_SIZE` (for vouchers)\\n /// or `EPOCH_NOTICE_LOG2_SIZE` (for notices)\\n /// @param outputHashesLog2Size Either `VOUCHER_METADATA_LOG2_SIZE` (for vouchers)\\n /// or `NOTICE_METADATA_LOG2_SIZE` (for notices)\\n function validateEncodedOutput(\\n OutputValidityProof calldata v,\\n bytes memory encodedOutput,\\n bytes32 epochHash,\\n bytes32 outputsEpochRootHash,\\n uint256 outputEpochLog2Size,\\n uint256 outputHashesLog2Size\\n ) internal pure {\\n // prove that outputs hash is represented in a finalized epoch\\n if (\\n keccak256(\\n abi.encodePacked(\\n v.vouchersEpochRootHash,\\n v.noticesEpochRootHash,\\n v.machineStateHash\\n )\\n ) != epochHash\\n ) {\\n revert IncorrectEpochHash();\\n }\\n\\n // prove that output metadata memory range is contained in epoch's output memory range\\n if (\\n MerkleV2.getRootAfterReplacementInDrive(\\n CanonicalMachine.getIntraMemoryRangePosition(\\n v.inputIndexWithinEpoch,\\n CanonicalMachine.KECCAK_LOG2_SIZE\\n ),\\n CanonicalMachine.KECCAK_LOG2_SIZE.uint64OfSize(),\\n outputEpochLog2Size,\\n v.outputHashesRootHash,\\n v.outputHashesInEpochSiblings\\n ) != outputsEpochRootHash\\n ) {\\n revert IncorrectOutputsEpochRootHash();\\n }\\n\\n // The hash of the output is converted to bytes (abi.encode) and\\n // treated as data. The metadata output memory range stores that data while\\n // being indifferent to its contents. To prove that the received\\n // output is contained in the metadata output memory range we need to\\n // prove that x, where:\\n // x = keccak(\\n // keccak(\\n // keccak(hashOfOutput[0:7]),\\n // keccak(hashOfOutput[8:15])\\n // ),\\n // keccak(\\n // keccak(hashOfOutput[16:23]),\\n // keccak(hashOfOutput[24:31])\\n // )\\n // )\\n // is contained in it. We can't simply use hashOfOutput because the\\n // log2size of the leaf is three (8 bytes) not five (32 bytes)\\n bytes32 merkleRootOfHashOfOutput = MerkleV2.getMerkleRootFromBytes(\\n abi.encodePacked(keccak256(encodedOutput)),\\n CanonicalMachine.KECCAK_LOG2_SIZE.uint64OfSize()\\n );\\n\\n // prove that Merkle root of bytes(hashOfOutput) is contained\\n // in the output metadata array memory range\\n if (\\n MerkleV2.getRootAfterReplacementInDrive(\\n CanonicalMachine.getIntraMemoryRangePosition(\\n v.outputIndexWithinInput,\\n CanonicalMachine.KECCAK_LOG2_SIZE\\n ),\\n CanonicalMachine.KECCAK_LOG2_SIZE.uint64OfSize(),\\n outputHashesLog2Size,\\n merkleRootOfHashOfOutput,\\n v.outputHashInOutputHashesSiblings\\n ) != v.outputHashesRootHash\\n ) {\\n revert IncorrectOutputHashesRootHash();\\n }\\n }\\n\\n /// @notice Make sure the output proof is valid, otherwise revert.\\n /// @param v The output validity proof\\n /// @param destination The address that will receive the payload through a message call\\n /// @param payload The payload, which\\u2014in the case of Solidity contracts\\u2014encodes a function call\\n /// @param epochHash The hash of the epoch in which the output was generated\\n function validateVoucher(\\n OutputValidityProof calldata v,\\n address destination,\\n bytes calldata payload,\\n bytes32 epochHash\\n ) internal pure {\\n bytes memory encodedVoucher = OutputEncoding.encodeVoucher(\\n destination,\\n payload\\n );\\n validateEncodedOutput(\\n v,\\n encodedVoucher,\\n epochHash,\\n v.vouchersEpochRootHash,\\n CanonicalMachine.EPOCH_VOUCHER_LOG2_SIZE.uint64OfSize(),\\n CanonicalMachine.VOUCHER_METADATA_LOG2_SIZE.uint64OfSize()\\n );\\n }\\n\\n /// @notice Make sure the output proof is valid, otherwise revert.\\n /// @param v The output validity proof\\n /// @param notice The notice\\n /// @param epochHash The hash of the epoch in which the output was generated\\n function validateNotice(\\n OutputValidityProof calldata v,\\n bytes calldata notice,\\n bytes32 epochHash\\n ) internal pure {\\n bytes memory encodedNotice = OutputEncoding.encodeNotice(notice);\\n validateEncodedOutput(\\n v,\\n encodedNotice,\\n epochHash,\\n v.noticesEpochRootHash,\\n CanonicalMachine.EPOCH_NOTICE_LOG2_SIZE.uint64OfSize(),\\n CanonicalMachine.NOTICE_METADATA_LOG2_SIZE.uint64OfSize()\\n );\\n }\\n\\n /// @notice Get the position of a voucher on the bit mask.\\n /// @param voucher The index of voucher from those generated by such input\\n /// @param input The index of the input in the DApp's input box\\n /// @return Position of the voucher on the bit mask\\n function getBitMaskPosition(\\n uint256 voucher,\\n uint256 input\\n ) internal pure returns (uint256) {\\n // voucher * 2 ** 128 + input\\n // this shouldn't overflow because it is impossible to have > 2**128 vouchers\\n // and because we are assuming there will be < 2 ** 128 inputs on the input box\\n return (((voucher << 128) | input));\\n }\\n\\n /// @notice Validate input index range and get the input index.\\n /// @param v The output validity proof\\n /// @param firstInputIndex The index of the first input of the epoch in the input box\\n /// @param lastInputIndex The index of the last input of the epoch in the input box\\n /// @return The index of the input in the DApp's input box\\n /// @dev Reverts if epoch input index is not compatible with the provided input index range.\\n function validateInputIndexRange(\\n OutputValidityProof calldata v,\\n uint256 firstInputIndex,\\n uint256 lastInputIndex\\n ) internal pure returns (uint256) {\\n uint256 inputIndex = firstInputIndex + v.inputIndexWithinEpoch;\\n\\n if (inputIndex > lastInputIndex) {\\n revert InputIndexOutOfClaimBounds();\\n }\\n\\n return inputIndex;\\n }\\n}\\n\",\"keccak256\":\"0x874ef478bd265acc94f2480a97191da907f05c6b46dc9e901c534b6acab14e03\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50611af9806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80630e1a07f5146100465780633648bfb514610075578063bd4f121914610088575b600080fd5b6100596100543660046102df565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b610059610083366004610325565b610148565b6100596100963660046102df565b6101ef565b600080828686866040516100ae906102ba565b6001600160a01b03938416815292909116602083015260408201526060018190604051809103906000f59050801580156100ec573d6000803e3d6000fd5b50604080516001600160a01b03888116825260208201889052838116828401529151929350908816917fe73165c2d277daf8713fd08b40845cb6bb7a20b2b543f3d35324a475660fcebd9181900360600190a295945050505050565b60008084848460405161015a906102ba565b6001600160a01b0393841681529290911660208301526040820152606001604051809103906000f080158015610194573d6000803e3d6000fd5b50604080516001600160a01b03878116825260208201879052838116828401529151929350908716917fe73165c2d277daf8713fd08b40845cb6bb7a20b2b543f3d35324a475660fcebd9181900360600190a2949350505050565b60006102738260405180602001610205906102ba565b601f1982820381018352601f9091011660408181526001600160a01b038a811660208401528916908201526060810187905260800160408051601f19818403018152908290526102589291602001610396565b6040516020818303038152906040528051906020012061027c565b95945050505050565b6000610289838330610290565b9392505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b611710806103b483390190565b6001600160a01b03811681146102dc57600080fd5b50565b600080600080608085870312156102f557600080fd5b8435610300816102c7565b93506020850135610310816102c7565b93969395505050506040820135916060013590565b60008060006060848603121561033a57600080fd5b8335610345816102c7565b92506020840135610355816102c7565b929592945050506040919091013590565b6000815160005b81811015610387576020818501810151868301520161036d565b50600093019283525090919050565b60006103ab6103a58386610366565b84610366565b94935050505056fe60a06040523480156200001157600080fd5b506040516200171038038062001710833981016040819052620000349162000212565b6200003f33620000cb565b600180556200004e826200011b565b6080819052600380546001600160a01b0319166001600160a01b0385169081179091556040805163b688a36360e01b8152905163b688a3639160048082019260009290919082900301818387803b158015620000a957600080fd5b505af1158015620000be573d6000803e3d6000fd5b505050505050506200025a565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b620001256200019e565b6001600160a01b038116620001905760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6200019b81620000cb565b50565b6000546001600160a01b03163314620001fa5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000187565b565b6001600160a01b03811681146200019b57600080fd5b6000806000606084860312156200022857600080fd5b83516200023581620001fc565b60208501519093506200024881620001fc565b80925050604084015190509250925092565b60805161149a6200027660003960006101ec015261149a6000f3fe6080604052600436106100e15760003560e01c80638da5cb5b1161007f578063bc197c8111610059578063bc197c8114610288578063f23a6e61146102b4578063f2fde38b146102e0578063fc4116831461030057600080fd5b80638da5cb5b1461022a57806396487d46146102485780639d9b11451461026857600080fd5b8063179e740b116100bb578063179e740b14610186578063522f6815146101b857806361b12c66146101da578063715018a61461021557600080fd5b806301ffc9a7146100ed5780631250482f14610122578063150b7a021461014257600080fd5b366100e857005b600080fd5b3480156100f957600080fd5b5061010d610108366004610d2a565b610320565b60405190151581526020015b60405180910390f35b34801561012e57600080fd5b5061010d61013d366004610dd0565b610357565b34801561014e57600080fd5b5061016d61015d366004610f00565b630a85bd0160e11b949350505050565b6040516001600160e01b03199091168152602001610119565b34801561019257600080fd5b506003546001600160a01b03165b6040516001600160a01b039091168152602001610119565b3480156101c457600080fd5b506101d86101d3366004610f5f565b61053c565b005b3480156101e657600080fd5b506040517f00000000000000000000000000000000000000000000000000000000000000008152602001610119565b34801561022157600080fd5b506101d86105d5565b34801561023657600080fd5b506000546001600160a01b03166101a0565b34801561025457600080fd5b5061010d610263366004610f8b565b6105e9565b34801561027457600080fd5b5061010d610283366004610ff3565b61063a565b34801561029457600080fd5b5061016d6102a3366004611094565b63bc197c8160e01b95945050505050565b3480156102c057600080fd5b5061016d6102cf366004611141565b63f23a6e6160e01b95945050505050565b3480156102ec57600080fd5b506101d86102fb3660046111a9565b61064c565b34801561030c57600080fd5b506101d861031b3660046111a9565b6106ca565b60006001600160e01b03198216630271189760e51b148061035157506301ffc9a760e01b6001600160e01b03198316145b92915050565b600061036161077f565b600080808061037b61037660208801886111c6565b6107d8565b919550935091506103988383610391898061120c565b919061085f565b90506103b4898989876103ab8b8061120c565b939291906108a5565b60006103e86103c3888061120c565b6103d490604081019060200161122c565b6001600160401b03168360809190911b1790565b90506103f3816108da565b15610411576040516370de22b760e01b815260040160405180910390fd5b60008a6001600160a01b03168a8a60405161042d929190611255565b6000604051808303816000865af19150503d806000811461046a576040519150601f19603f3d011682016040523d82523d6000602084013e61046f565b606091505b505090508015610524576040516306449da160e41b815260026004820152602481018390526001604482015273F5B2d8c81cDE4D6238bBf20D3D77DB37df13f73590636449da109060640160006040518083038186803b1580156104d257600080fd5b505af41580156104e6573d6000803e3d6000fd5b505050507f0eb7ee080f865f1cadc4f54daf58cc3b8879e888832867d13351edcec0fbdc548260405161051b91815260200190565b60405180910390a15b9550505050505061053460018055565b949350505050565b33301461055c5760405163a08d601d60e01b815260040160405180910390fd5b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146105a9576040519150601f19603f3d011682016040523d82523d6000602084013e6105ae565b606091505b50509050806105d057604051630ce8f45160e31b815260040160405180910390fd5b505050565b6105dd610958565b6105e760006109b2565b565b60008080806105fe61037660208701876111c6565b919450925090506106148282610391888061120c565b5061062d878785610625898061120c565b929190610a02565b5060019695505050505050565b6000608082901b8317610534816108da565b610654610958565b6001600160a01b0381166106be5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6106c7816109b2565b50565b6106d2610958565b600380546001600160a01b0319166001600160a01b0383169081179091556040805163b688a36360e01b8152905163b688a3639160048082019260009290919082900301818387803b15801561072757600080fd5b505af115801561073b573d6000803e3d6000fd5b50506040516001600160a01b03841681527f4991c6f37185659e276ff918a96f3e20e6c5abcd8c9aab450dc19c2f7ad35cb59250602001905060405180910390a150565b6002600154036107d15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016106b5565b6002600155565b60035460405163035e6a0960e61b8152600091829182916001600160a01b03169063d79a8240906108119030908990899060040161128e565b606060405180830381865afa15801561082e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085291906112bc565b9250925092509250925092565b60008061086f602086018661122c565b610882906001600160401b0316856112ea565b9050828111156105345760405163fd9ae91f60e01b815260040160405180910390fd5b60006108b2858585610a29565b90506108d2868284606083013560255b6001600160401b03166015610a58565b505050505050565b6040516303fbaf7360e01b8152600260048201526024810182905260009073F5B2d8c81cDE4D6238bBf20D3D77DB37df13f735906303fbaf7390604401602060405180830381865af4158015610934573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610351919061130b565b6000546001600160a01b031633146105e75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106b5565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610a0e8484610cfe565b9050610a22858284608083013560256108c2565b5050505050565b6060838383604051602001610a409392919061128e565b60405160208183030381529060405290509392505050565b6040805160608089013560208301526080808a01359383019390935260a0890135908201528591016040516020818303038152906040528051906020012014610ab457604051636fbd3b7160e11b815260040160405180910390fd5b827333436035441927Df1a73FE3AAC5906854632e53d6379de4601610af0610adf60208b018b61122c565b60051b681fffffffffffffffe01690565b60058660408c0135610b0560e08e018e61132d565b6040518763ffffffff1660e01b8152600401610b2696959493929190611376565b602060405180830381865af4158015610b43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6791906113d9565b14610b8557604051634371daa160e11b815260040160405180910390fd5b60007333436035441927Df1a73FE3AAC5906854632e53d63c84583a18780519060200120604051602001610bbb91815260200190565b60408051601f19818403018152908290526001600160e01b031960e084901b168252610bec916005906004016113f2565b602060405180830381865af4158015610c09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2d91906113d9565b905086604001357333436035441927Df1a73FE3AAC5906854632e53d6379de4601610c648a6020016020810190610adf919061122c565b60058686610c7560c08f018f61132d565b6040518763ffffffff1660e01b8152600401610c9696959493929190611376565b602060405180830381865af4158015610cb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd791906113d9565b14610cf55760405163017c689560e61b815260040160405180910390fd5b50505050505050565b60608282604051602001610d13929190611450565b604051602081830303815290604052905092915050565b600060208284031215610d3c57600080fd5b81356001600160e01b031981168114610d5457600080fd5b9392505050565b6001600160a01b03811681146106c757600080fd5b60008083601f840112610d8257600080fd5b5081356001600160401b03811115610d9957600080fd5b602083019150836020828501011115610db157600080fd5b9250929050565b600060408284031215610dca57600080fd5b50919050565b60008060008060608587031215610de657600080fd5b8435610df181610d5b565b935060208501356001600160401b0380821115610e0d57600080fd5b610e1988838901610d70565b90955093506040870135915080821115610e3257600080fd5b50610e3f87828801610db8565b91505092959194509250565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715610e8957610e89610e4b565b604052919050565b600082601f830112610ea257600080fd5b81356001600160401b03811115610ebb57610ebb610e4b565b610ece601f8201601f1916602001610e61565b818152846020838601011115610ee357600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215610f1657600080fd5b8435610f2181610d5b565b93506020850135610f3181610d5b565b92506040850135915060608501356001600160401b03811115610f5357600080fd5b610e3f87828801610e91565b60008060408385031215610f7257600080fd5b8235610f7d81610d5b565b946020939093013593505050565b600080600060408486031215610fa057600080fd5b83356001600160401b0380821115610fb757600080fd5b610fc387838801610d70565b90955093506020860135915080821115610fdc57600080fd5b50610fe986828701610db8565b9150509250925092565b6000806040838503121561100657600080fd5b50508035926020909101359150565b600082601f83011261102657600080fd5b813560206001600160401b0382111561104157611041610e4b565b8160051b611050828201610e61565b928352848101820192828101908785111561106a57600080fd5b83870192505b8483101561108957823582529183019190830190611070565b979650505050505050565b600080600080600060a086880312156110ac57600080fd5b85356110b781610d5b565b945060208601356110c781610d5b565b935060408601356001600160401b03808211156110e357600080fd5b6110ef89838a01611015565b9450606088013591508082111561110557600080fd5b61111189838a01611015565b9350608088013591508082111561112757600080fd5b5061113488828901610e91565b9150509295509295909350565b600080600080600060a0868803121561115957600080fd5b853561116481610d5b565b9450602086013561117481610d5b565b9350604086013592506060860135915060808601356001600160401b0381111561119d57600080fd5b61113488828901610e91565b6000602082840312156111bb57600080fd5b8135610d5481610d5b565b6000808335601e198436030181126111dd57600080fd5b8301803591506001600160401b038211156111f757600080fd5b602001915036819003821315610db157600080fd5b6000823560fe1983360301811261122257600080fd5b9190910192915050565b60006020828403121561123e57600080fd5b81356001600160401b0381168114610d5457600080fd5b8183823760009101908152919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03841681526040602082018190526000906112b39083018486611265565b95945050505050565b6000806000606084860312156112d157600080fd5b8351925060208401519150604084015190509250925092565b8082018082111561035157634e487b7160e01b600052601160045260246000fd5b60006020828403121561131d57600080fd5b81518015158114610d5457600080fd5b6000808335601e1984360301811261134457600080fd5b8301803591506001600160401b0382111561135e57600080fd5b6020019150600581901b3603821315610db157600080fd5b6001600160401b03878116825286166020820152604081018590526060810184905260a060808201819052810182905260006001600160fb1b038311156113bc57600080fd5b8260051b808560c08501379190910160c001979650505050505050565b6000602082840312156113eb57600080fd5b5051919050565b604081526000835180604084015260005b818110156114205760208187018101516060868401015201611403565b506000606082850101526060601f19601f8301168401019150506001600160401b03831660208301529392505050565b60208152600061053460208301848661126556fea2646970667358221220981835fbbf44aedaeb41e0c0c9001ffe55187a0b5606db0cdbf7500fc7c5e30e64736f6c63430008130033a2646970667358221220a12c770ef21751c306949fd9ed57ed453446a67f2dfb1d63d08c918461eca99764736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80630e1a07f5146100465780633648bfb514610075578063bd4f121914610088575b600080fd5b6100596100543660046102df565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b610059610083366004610325565b610148565b6100596100963660046102df565b6101ef565b600080828686866040516100ae906102ba565b6001600160a01b03938416815292909116602083015260408201526060018190604051809103906000f59050801580156100ec573d6000803e3d6000fd5b50604080516001600160a01b03888116825260208201889052838116828401529151929350908816917fe73165c2d277daf8713fd08b40845cb6bb7a20b2b543f3d35324a475660fcebd9181900360600190a295945050505050565b60008084848460405161015a906102ba565b6001600160a01b0393841681529290911660208301526040820152606001604051809103906000f080158015610194573d6000803e3d6000fd5b50604080516001600160a01b03878116825260208201879052838116828401529151929350908716917fe73165c2d277daf8713fd08b40845cb6bb7a20b2b543f3d35324a475660fcebd9181900360600190a2949350505050565b60006102738260405180602001610205906102ba565b601f1982820381018352601f9091011660408181526001600160a01b038a811660208401528916908201526060810187905260800160408051601f19818403018152908290526102589291602001610396565b6040516020818303038152906040528051906020012061027c565b95945050505050565b6000610289838330610290565b9392505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b611710806103b483390190565b6001600160a01b03811681146102dc57600080fd5b50565b600080600080608085870312156102f557600080fd5b8435610300816102c7565b93506020850135610310816102c7565b93969395505050506040820135916060013590565b60008060006060848603121561033a57600080fd5b8335610345816102c7565b92506020840135610355816102c7565b929592945050506040919091013590565b6000815160005b81811015610387576020818501810151868301520161036d565b50600093019283525090919050565b60006103ab6103a58386610366565b84610366565b94935050505056fe60a06040523480156200001157600080fd5b506040516200171038038062001710833981016040819052620000349162000212565b6200003f33620000cb565b600180556200004e826200011b565b6080819052600380546001600160a01b0319166001600160a01b0385169081179091556040805163b688a36360e01b8152905163b688a3639160048082019260009290919082900301818387803b158015620000a957600080fd5b505af1158015620000be573d6000803e3d6000fd5b505050505050506200025a565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b620001256200019e565b6001600160a01b038116620001905760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6200019b81620000cb565b50565b6000546001600160a01b03163314620001fa5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000187565b565b6001600160a01b03811681146200019b57600080fd5b6000806000606084860312156200022857600080fd5b83516200023581620001fc565b60208501519093506200024881620001fc565b80925050604084015190509250925092565b60805161149a6200027660003960006101ec015261149a6000f3fe6080604052600436106100e15760003560e01c80638da5cb5b1161007f578063bc197c8111610059578063bc197c8114610288578063f23a6e61146102b4578063f2fde38b146102e0578063fc4116831461030057600080fd5b80638da5cb5b1461022a57806396487d46146102485780639d9b11451461026857600080fd5b8063179e740b116100bb578063179e740b14610186578063522f6815146101b857806361b12c66146101da578063715018a61461021557600080fd5b806301ffc9a7146100ed5780631250482f14610122578063150b7a021461014257600080fd5b366100e857005b600080fd5b3480156100f957600080fd5b5061010d610108366004610d2a565b610320565b60405190151581526020015b60405180910390f35b34801561012e57600080fd5b5061010d61013d366004610dd0565b610357565b34801561014e57600080fd5b5061016d61015d366004610f00565b630a85bd0160e11b949350505050565b6040516001600160e01b03199091168152602001610119565b34801561019257600080fd5b506003546001600160a01b03165b6040516001600160a01b039091168152602001610119565b3480156101c457600080fd5b506101d86101d3366004610f5f565b61053c565b005b3480156101e657600080fd5b506040517f00000000000000000000000000000000000000000000000000000000000000008152602001610119565b34801561022157600080fd5b506101d86105d5565b34801561023657600080fd5b506000546001600160a01b03166101a0565b34801561025457600080fd5b5061010d610263366004610f8b565b6105e9565b34801561027457600080fd5b5061010d610283366004610ff3565b61063a565b34801561029457600080fd5b5061016d6102a3366004611094565b63bc197c8160e01b95945050505050565b3480156102c057600080fd5b5061016d6102cf366004611141565b63f23a6e6160e01b95945050505050565b3480156102ec57600080fd5b506101d86102fb3660046111a9565b61064c565b34801561030c57600080fd5b506101d861031b3660046111a9565b6106ca565b60006001600160e01b03198216630271189760e51b148061035157506301ffc9a760e01b6001600160e01b03198316145b92915050565b600061036161077f565b600080808061037b61037660208801886111c6565b6107d8565b919550935091506103988383610391898061120c565b919061085f565b90506103b4898989876103ab8b8061120c565b939291906108a5565b60006103e86103c3888061120c565b6103d490604081019060200161122c565b6001600160401b03168360809190911b1790565b90506103f3816108da565b15610411576040516370de22b760e01b815260040160405180910390fd5b60008a6001600160a01b03168a8a60405161042d929190611255565b6000604051808303816000865af19150503d806000811461046a576040519150601f19603f3d011682016040523d82523d6000602084013e61046f565b606091505b505090508015610524576040516306449da160e41b815260026004820152602481018390526001604482015273__$f57eb21c11c6dae369da3ca36f4f48eb77$__90636449da109060640160006040518083038186803b1580156104d257600080fd5b505af41580156104e6573d6000803e3d6000fd5b505050507f0eb7ee080f865f1cadc4f54daf58cc3b8879e888832867d13351edcec0fbdc548260405161051b91815260200190565b60405180910390a15b9550505050505061053460018055565b949350505050565b33301461055c5760405163a08d601d60e01b815260040160405180910390fd5b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146105a9576040519150601f19603f3d011682016040523d82523d6000602084013e6105ae565b606091505b50509050806105d057604051630ce8f45160e31b815260040160405180910390fd5b505050565b6105dd610958565b6105e760006109b2565b565b60008080806105fe61037660208701876111c6565b919450925090506106148282610391888061120c565b5061062d878785610625898061120c565b929190610a02565b5060019695505050505050565b6000608082901b8317610534816108da565b610654610958565b6001600160a01b0381166106be5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6106c7816109b2565b50565b6106d2610958565b600380546001600160a01b0319166001600160a01b0383169081179091556040805163b688a36360e01b8152905163b688a3639160048082019260009290919082900301818387803b15801561072757600080fd5b505af115801561073b573d6000803e3d6000fd5b50506040516001600160a01b03841681527f4991c6f37185659e276ff918a96f3e20e6c5abcd8c9aab450dc19c2f7ad35cb59250602001905060405180910390a150565b6002600154036107d15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016106b5565b6002600155565b60035460405163035e6a0960e61b8152600091829182916001600160a01b03169063d79a8240906108119030908990899060040161128e565b606060405180830381865afa15801561082e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085291906112bc565b9250925092509250925092565b60008061086f602086018661122c565b610882906001600160401b0316856112ea565b9050828111156105345760405163fd9ae91f60e01b815260040160405180910390fd5b60006108b2858585610a29565b90506108d2868284606083013560255b6001600160401b03166015610a58565b505050505050565b6040516303fbaf7360e01b8152600260048201526024810182905260009073__$f57eb21c11c6dae369da3ca36f4f48eb77$__906303fbaf7390604401602060405180830381865af4158015610934573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610351919061130b565b6000546001600160a01b031633146105e75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106b5565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610a0e8484610cfe565b9050610a22858284608083013560256108c2565b5050505050565b6060838383604051602001610a409392919061128e565b60405160208183030381529060405290509392505050565b6040805160608089013560208301526080808a01359383019390935260a0890135908201528591016040516020818303038152906040528051906020012014610ab457604051636fbd3b7160e11b815260040160405180910390fd5b8273__$2a7ef22e717e9afc55afc95d018bf1a85b$__6379de4601610af0610adf60208b018b61122c565b60051b681fffffffffffffffe01690565b60058660408c0135610b0560e08e018e61132d565b6040518763ffffffff1660e01b8152600401610b2696959493929190611376565b602060405180830381865af4158015610b43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6791906113d9565b14610b8557604051634371daa160e11b815260040160405180910390fd5b600073__$2a7ef22e717e9afc55afc95d018bf1a85b$__63c84583a18780519060200120604051602001610bbb91815260200190565b60408051601f19818403018152908290526001600160e01b031960e084901b168252610bec916005906004016113f2565b602060405180830381865af4158015610c09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2d91906113d9565b9050866040013573__$2a7ef22e717e9afc55afc95d018bf1a85b$__6379de4601610c648a6020016020810190610adf919061122c565b60058686610c7560c08f018f61132d565b6040518763ffffffff1660e01b8152600401610c9696959493929190611376565b602060405180830381865af4158015610cb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd791906113d9565b14610cf55760405163017c689560e61b815260040160405180910390fd5b50505050505050565b60608282604051602001610d13929190611450565b604051602081830303815290604052905092915050565b600060208284031215610d3c57600080fd5b81356001600160e01b031981168114610d5457600080fd5b9392505050565b6001600160a01b03811681146106c757600080fd5b60008083601f840112610d8257600080fd5b5081356001600160401b03811115610d9957600080fd5b602083019150836020828501011115610db157600080fd5b9250929050565b600060408284031215610dca57600080fd5b50919050565b60008060008060608587031215610de657600080fd5b8435610df181610d5b565b935060208501356001600160401b0380821115610e0d57600080fd5b610e1988838901610d70565b90955093506040870135915080821115610e3257600080fd5b50610e3f87828801610db8565b91505092959194509250565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715610e8957610e89610e4b565b604052919050565b600082601f830112610ea257600080fd5b81356001600160401b03811115610ebb57610ebb610e4b565b610ece601f8201601f1916602001610e61565b818152846020838601011115610ee357600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215610f1657600080fd5b8435610f2181610d5b565b93506020850135610f3181610d5b565b92506040850135915060608501356001600160401b03811115610f5357600080fd5b610e3f87828801610e91565b60008060408385031215610f7257600080fd5b8235610f7d81610d5b565b946020939093013593505050565b600080600060408486031215610fa057600080fd5b83356001600160401b0380821115610fb757600080fd5b610fc387838801610d70565b90955093506020860135915080821115610fdc57600080fd5b50610fe986828701610db8565b9150509250925092565b6000806040838503121561100657600080fd5b50508035926020909101359150565b600082601f83011261102657600080fd5b813560206001600160401b0382111561104157611041610e4b565b8160051b611050828201610e61565b928352848101820192828101908785111561106a57600080fd5b83870192505b8483101561108957823582529183019190830190611070565b979650505050505050565b600080600080600060a086880312156110ac57600080fd5b85356110b781610d5b565b945060208601356110c781610d5b565b935060408601356001600160401b03808211156110e357600080fd5b6110ef89838a01611015565b9450606088013591508082111561110557600080fd5b61111189838a01611015565b9350608088013591508082111561112757600080fd5b5061113488828901610e91565b9150509295509295909350565b600080600080600060a0868803121561115957600080fd5b853561116481610d5b565b9450602086013561117481610d5b565b9350604086013592506060860135915060808601356001600160401b0381111561119d57600080fd5b61113488828901610e91565b6000602082840312156111bb57600080fd5b8135610d5481610d5b565b6000808335601e198436030181126111dd57600080fd5b8301803591506001600160401b038211156111f757600080fd5b602001915036819003821315610db157600080fd5b6000823560fe1983360301811261122257600080fd5b9190910192915050565b60006020828403121561123e57600080fd5b81356001600160401b0381168114610d5457600080fd5b8183823760009101908152919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03841681526040602082018190526000906112b39083018486611265565b95945050505050565b6000806000606084860312156112d157600080fd5b8351925060208401519150604084015190509250925092565b8082018082111561035157634e487b7160e01b600052601160045260246000fd5b60006020828403121561131d57600080fd5b81518015158114610d5457600080fd5b6000808335601e1984360301811261134457600080fd5b8301803591506001600160401b0382111561135e57600080fd5b6020019150600581901b3603821315610db157600080fd5b6001600160401b03878116825286166020820152604081018590526060810184905260a060808201819052810182905260006001600160fb1b038311156113bc57600080fd5b8260051b808560c08501379190910160c001979650505050505050565b6000602082840312156113eb57600080fd5b5051919050565b604081526000835180604084015260005b818110156114205760208187018101516060868401015201611403565b506000606082850101526060601f19601f8301168401019150506001600160401b03831660208301529392505050565b60208152600061053460208301848661126556fea2646970667358221220981835fbbf44aedaeb41e0c0c9001ffe55187a0b5606db0cdbf7500fc7c5e30e64736f6c63430008130033a2646970667358221220a12c770ef21751c306949fd9ed57ed453446a67f2dfb1d63d08c918461eca99764736f6c63430008130033", - "libraries": { - "Bitmask": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", - "MerkleV2": "0x33436035441927Df1a73FE3AAC5906854632e53d" - }, - "devdoc": { - "events": { - "ApplicationCreated(address,address,bytes32,address)": { - "details": "MUST be triggered on a successful call to `newApplication`.", - "params": { - "application": "The application", - "consensus": "The initial consensus contract", - "dappOwner": "The initial DApp owner", - "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": { - "_consensus": "The initial consensus contract", - "_dappOwner": "The initial DApp owner", - "_salt": "The salt used to deterministically generate the DApp address", - "_templateHash": "The initial machine state hash" - }, - "returns": { - "_0": "The deterministic application address" - } - }, - "newApplication(address,address,bytes32)": { - "details": "On success, MUST emit an `ApplicationCreated` event.", - "params": { - "_consensus": "The initial consensus contract", - "_dappOwner": "The initial DApp owner", - "_templateHash": "The initial machine state hash" - }, - "returns": { - "_0": "The application" - } - }, - "newApplication(address,address,bytes32,bytes32)": { - "details": "On success, MUST emit an `ApplicationCreated` event.", - "params": { - "_consensus": "The initial consensus contract", - "_dappOwner": "The initial DApp owner", - "_salt": "The salt used to deterministically generate the DApp address", - "_templateHash": "The initial machine state hash" - }, - "returns": { - "_0": "The application" - } - } - }, - "title": "Cartesi DApp 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 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 `CartesiDApp` contract.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/deployments/mainnet/ERC1155BatchPortal.json b/deployments/mainnet/ERC1155BatchPortal.json deleted file mode 100644 index 6835bcde6..000000000 --- a/deployments/mainnet/ERC1155BatchPortal.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "address": "0xedB53860A6B52bbb7561Ad596416ee9965B055Aa", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC1155", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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": "0x11c6b8f38493eefc1568b0c7cda2ba1e92266c3ff61210ea56cc0b1ff13d2b6b", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 54, - "gasUsed": "370950", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xe2d51dda162ecb0fed4ef2630b2117dd7fcbc118d249784a14ece1cf317a862e", - "transactionHash": "0x11c6b8f38493eefc1568b0c7cda2ba1e92266c3ff61210ea56cc0b1ff13d2b6b", - "logs": [], - "blockNumber": 17784738, - "cumulativeGasUsed": "4322488", - "status": 1, - "byzantium": true - }, - "args": [ - "0x59b22D57D4f067708AB0c00552767405926dc768" - ], - "numDeployments": 1, - "solcInputHash": "d2696284402b6703b2d41170c93ef3b7", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"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\":\"_dapp\",\"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 `_tokenIds` and `_values` have the same length.\",\"params\":{\"_baseLayerData\":\"Additional data to be interpreted by the base layer\",\"_dapp\":\"The address of the DApp\",\"_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 to a DApp and add an input to the DApp'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 input relay.\"}},\"notice\":\"This contract allows anyone to perform batch transfers of ERC-1155 tokens to a DApp 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 v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token 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 amount 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 `amount` tokens of token type `id` from `from` to `to`.\\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 `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 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` 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 amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon 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 caller.\\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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"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 and relays.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Ether being sent in Wei\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\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 ret The return value of `transferFrom`\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param amount The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\n function encodeERC20Deposit(\\n bool ret,\\n IERC20 token,\\n address sender,\\n uint256 amount,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n ret, // 1B\\n token, // 20B\\n sender, // 20B\\n amount, // 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\\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\\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\\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 /// @notice Encode a DApp address relay.\\n /// @param dapp The DApp address\\n /// @return The encoded input\\n function encodeDAppAddressRelay(\\n address dapp\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n dapp // 20B\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5dce266a7b70ba86adf6a728c7667255d3e2b20f1789a951150a1d05439b7019\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputRelay.sol\":{\"content\":\"// (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 \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay interface\\ninterface IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this input relay.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x8c9316c43cc2c7754fbd5abccfcdbc5ed09a2f1228d993240eac6c41ea531521\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/InputRelay.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputRelay} from \\\"./IInputRelay.sol\\\";\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay\\n/// @notice This contract serves as a base for all the other input relays.\\ncontract InputRelay is IInputRelay {\\n /// @notice The input box used by the input relay.\\n IInputBox internal immutable inputBox;\\n\\n /// @notice Constructs the input relay.\\n /// @param _inputBox The input box used by the input relay\\n constructor(IInputBox _inputBox) {\\n inputBox = _inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return inputBox;\\n }\\n}\\n\",\"keccak256\":\"0xbb489f157a0bd7a9da29b0bf3c47c4b4051d90ccd252abc3f81c8e897329e590\",\"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 {InputRelay} from \\\"../inputs/InputRelay.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 a DApp while informing the off-chain machine.\\ncontract ERC1155BatchPortal is InputRelay, IERC1155BatchPortal {\\n /// @notice Constructs the portal.\\n /// @param _inputBox The input box used by the portal\\n constructor(IInputBox _inputBox) InputRelay(_inputBox) {}\\n\\n function depositBatchERC1155Token(\\n IERC1155 _token,\\n address _dapp,\\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 _dapp,\\n _tokenIds,\\n _values,\\n _baseLayerData\\n );\\n\\n bytes memory input = InputEncoding.encodeBatchERC1155Deposit(\\n _token,\\n msg.sender,\\n _tokenIds,\\n _values,\\n _baseLayerData,\\n _execLayerData\\n );\\n\\n inputBox.addInput(_dapp, input);\\n }\\n}\\n\",\"keccak256\":\"0x8aab3384ab673cf9dd34da33b2a1c9efbbfb4960acaee44c7d50c63344237d86\",\"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 {IInputRelay} from \\\"../inputs/IInputRelay.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title ERC-1155 Batch Transfer Portal interface\\ninterface IERC1155BatchPortal is IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Transfer a batch of ERC-1155 tokens to a DApp and add an input to\\n /// the DApp'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 _dapp The address of the DApp\\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 `_tokenIds` and `_values` have the same length.\\n function depositBatchERC1155Token(\\n IERC1155 _token,\\n address _dapp,\\n uint256[] calldata _tokenIds,\\n uint256[] calldata _values,\\n bytes calldata _baseLayerData,\\n bytes calldata _execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0xfd76007f27ca0b4886d477eabdbda517e6a4a139c2b044cd8b59debf4894016d\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b5060405161064538038061064583398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516105b461009160003960008181603c015261012601526105b46000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806324d15c6714610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a6100853660046102c1565b61008c565b005b604051631759616b60e11b81526001600160a01b038b1690632eb2c2d6906100c69033908d908d908d908d908d908d908d90600401610404565b600060405180830381600087803b1580156100e057600080fd5b505af11580156100f4573d6000803e3d6000fd5b50505050600061010c8b338b8b8b8b8b8b8b8b6101ae565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061015d908d90859060040161048c565b6020604051808303816000875af115801561017c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a091906104ce565b505050505050505050505050565b6060600089898989898989896040516020016101d19897969594939291906104e7565b60405160208183030381529060405290508b8b826040516020016101f793929190610538565b6040516020818303038152906040529150509a9950505050505050505050565b80356001600160a01b038116811461022e57600080fd5b919050565b60008083601f84011261024557600080fd5b50813567ffffffffffffffff81111561025d57600080fd5b6020830191508360208260051b850101111561027857600080fd5b9250929050565b60008083601f84011261029157600080fd5b50813567ffffffffffffffff8111156102a957600080fd5b60208301915083602082850101111561027857600080fd5b60008060008060008060008060008060c08b8d0312156102e057600080fd5b6102e98b610217565b99506102f760208c01610217565b985060408b013567ffffffffffffffff8082111561031457600080fd5b6103208e838f01610233565b909a50985060608d013591508082111561033957600080fd5b6103458e838f01610233565b909850965060808d013591508082111561035e57600080fd5b61036a8e838f0161027f565b909650945060a08d013591508082111561038357600080fd5b506103908d828e0161027f565b915080935050809150509295989b9194979a5092959850565b81835260006001600160fb1b038311156103c257600080fd5b8260051b80836020870137939093016020019392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0389811682528816602082015260a060408201819052600090610431908301888a6103a9565b82810360608401526104448187896103a9565b905082810360808401526104598185876103db565b9b9a5050505050505050505050565b60005b8381101561048357818101518382015260200161046b565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526104b9816060850160208701610468565b601f01601f1916919091016060019392505050565b6000602082840312156104e057600080fd5b5051919050565b6080815260006104fb608083018a8c6103a9565b828103602084015261050e81898b6103a9565b905082810360408401526105238187896103db565b905082810360608401526104598185876103db565b60006bffffffffffffffffffffffff19808660601b168352808560601b16601484015250825161056f816028850160208701610468565b9190910160280194935050505056fea2646970667358221220b1261ceaf7c0f69c5d0d611864ae36802a7987738f02b3c9f93c1843357f32eb64736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806324d15c6714610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a6100853660046102c1565b61008c565b005b604051631759616b60e11b81526001600160a01b038b1690632eb2c2d6906100c69033908d908d908d908d908d908d908d90600401610404565b600060405180830381600087803b1580156100e057600080fd5b505af11580156100f4573d6000803e3d6000fd5b50505050600061010c8b338b8b8b8b8b8b8b8b6101ae565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061015d908d90859060040161048c565b6020604051808303816000875af115801561017c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a091906104ce565b505050505050505050505050565b6060600089898989898989896040516020016101d19897969594939291906104e7565b60405160208183030381529060405290508b8b826040516020016101f793929190610538565b6040516020818303038152906040529150509a9950505050505050505050565b80356001600160a01b038116811461022e57600080fd5b919050565b60008083601f84011261024557600080fd5b50813567ffffffffffffffff81111561025d57600080fd5b6020830191508360208260051b850101111561027857600080fd5b9250929050565b60008083601f84011261029157600080fd5b50813567ffffffffffffffff8111156102a957600080fd5b60208301915083602082850101111561027857600080fd5b60008060008060008060008060008060c08b8d0312156102e057600080fd5b6102e98b610217565b99506102f760208c01610217565b985060408b013567ffffffffffffffff8082111561031457600080fd5b6103208e838f01610233565b909a50985060608d013591508082111561033957600080fd5b6103458e838f01610233565b909850965060808d013591508082111561035e57600080fd5b61036a8e838f0161027f565b909650945060a08d013591508082111561038357600080fd5b506103908d828e0161027f565b915080935050809150509295989b9194979a5092959850565b81835260006001600160fb1b038311156103c257600080fd5b8260051b80836020870137939093016020019392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0389811682528816602082015260a060408201819052600090610431908301888a6103a9565b82810360608401526104448187896103a9565b905082810360808401526104598185876103db565b9b9a5050505050505050505050565b60005b8381101561048357818101518382015260200161046b565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526104b9816060850160208701610468565b601f01601f1916919091016060019392505050565b6000602082840312156104e057600080fd5b5051919050565b6080815260006104fb608083018a8c6103a9565b828103602084015261050e81898b6103a9565b905082810360408401526105238187896103db565b905082810360608401526104598185876103db565b60006bffffffffffffffffffffffff19808660601b168352808560601b16601484015250825161056f816028850160208701610468565b9190910160280194935050505056fea2646970667358221220b1261ceaf7c0f69c5d0d611864ae36802a7987738f02b3c9f93c1843357f32eb64736f6c63430008130033", - "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 `_tokenIds` and `_values` have the same length.", - "params": { - "_baseLayerData": "Additional data to be interpreted by the base layer", - "_dapp": "The address of the DApp", - "_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 to a DApp and add an input to the DApp'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 input relay." - } - }, - "notice": "This contract allows anyone to perform batch transfers of ERC-1155 tokens to a DApp while informing the off-chain machine.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/deployments/mainnet/ERC1155SinglePortal.json b/deployments/mainnet/ERC1155SinglePortal.json deleted file mode 100644 index 6ffff03bb..000000000 --- a/deployments/mainnet/ERC1155SinglePortal.json +++ /dev/null @@ -1,138 +0,0 @@ -{ - "address": "0x7CFB0193Ca87eB6e48056885E026552c3A941FC4", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC1155", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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": "0x4dd774a60bf0a6fe9ecf9ade3f7c02c6dddad78a385c2e2f07eca21c9900bbbf", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 110, - "gasUsed": "317542", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x6e40ef8c09ebccd92a11f1b3234d6b0611cc69d89a91d3a26259ef710dfbc489", - "transactionHash": "0x4dd774a60bf0a6fe9ecf9ade3f7c02c6dddad78a385c2e2f07eca21c9900bbbf", - "logs": [], - "blockNumber": 17784737, - "cumulativeGasUsed": "9612402", - "status": 1, - "byzantium": true - }, - "args": [ - "0x59b22D57D4f067708AB0c00552767405926dc768" - ], - "numDeployments": 1, - "solcInputHash": "d2696284402b6703b2d41170c93ef3b7", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"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\":\"_dapp\",\"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\":{\"_baseLayerData\":\"Additional data to be interpreted by the base layer\",\"_dapp\":\"The address of the DApp\",\"_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 an ERC-1155 token to a DApp and add an input to the DApp'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 input relay.\"}},\"notice\":\"This contract allows anyone to perform single transfers of ERC-1155 tokens to a DApp 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 v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token 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 amount 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 `amount` tokens of token type `id` from `from` to `to`.\\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 `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 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` 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 amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon 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 caller.\\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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"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 and relays.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Ether being sent in Wei\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\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 ret The return value of `transferFrom`\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param amount The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\n function encodeERC20Deposit(\\n bool ret,\\n IERC20 token,\\n address sender,\\n uint256 amount,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n ret, // 1B\\n token, // 20B\\n sender, // 20B\\n amount, // 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\\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\\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\\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 /// @notice Encode a DApp address relay.\\n /// @param dapp The DApp address\\n /// @return The encoded input\\n function encodeDAppAddressRelay(\\n address dapp\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n dapp // 20B\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5dce266a7b70ba86adf6a728c7667255d3e2b20f1789a951150a1d05439b7019\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputRelay.sol\":{\"content\":\"// (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 \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay interface\\ninterface IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this input relay.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x8c9316c43cc2c7754fbd5abccfcdbc5ed09a2f1228d993240eac6c41ea531521\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/InputRelay.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputRelay} from \\\"./IInputRelay.sol\\\";\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay\\n/// @notice This contract serves as a base for all the other input relays.\\ncontract InputRelay is IInputRelay {\\n /// @notice The input box used by the input relay.\\n IInputBox internal immutable inputBox;\\n\\n /// @notice Constructs the input relay.\\n /// @param _inputBox The input box used by the input relay\\n constructor(IInputBox _inputBox) {\\n inputBox = _inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return inputBox;\\n }\\n}\\n\",\"keccak256\":\"0xbb489f157a0bd7a9da29b0bf3c47c4b4051d90ccd252abc3f81c8e897329e590\",\"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 {InputRelay} from \\\"../inputs/InputRelay.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 a DApp while informing the off-chain machine.\\ncontract ERC1155SinglePortal is InputRelay, IERC1155SinglePortal {\\n /// @notice Constructs the portal.\\n /// @param _inputBox The input box used by the portal\\n constructor(IInputBox _inputBox) InputRelay(_inputBox) {}\\n\\n function depositSingleERC1155Token(\\n IERC1155 _token,\\n address _dapp,\\n uint256 _tokenId,\\n uint256 _value,\\n bytes calldata _baseLayerData,\\n bytes calldata _execLayerData\\n ) external override {\\n _token.safeTransferFrom(\\n msg.sender,\\n _dapp,\\n _tokenId,\\n _value,\\n _baseLayerData\\n );\\n\\n bytes memory input = InputEncoding.encodeSingleERC1155Deposit(\\n _token,\\n msg.sender,\\n _tokenId,\\n _value,\\n _baseLayerData,\\n _execLayerData\\n );\\n\\n inputBox.addInput(_dapp, input);\\n }\\n}\\n\",\"keccak256\":\"0x1647752c6abb80e283258cc863425845d31f3b2a53f85bc4d1db91853416b434\",\"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 {IInputRelay} from \\\"../inputs/IInputRelay.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title ERC-1155 Single Transfer Portal interface\\ninterface IERC1155SinglePortal is IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Transfer an ERC-1155 token to a DApp and add an input to\\n /// the DApp'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 _dapp The address of the DApp\\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 _dapp,\\n uint256 _tokenId,\\n uint256 _value,\\n bytes calldata _baseLayerData,\\n bytes calldata _execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0x1d3c93c70d81ede71436b43dfecbfa9f644010ca08f4197bfb966831451dab6d\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b5060405161054e38038061054e83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516104bd61009160003960008181603c015261012001526104bd6000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a578063dec07dca14610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a61008536600461026a565b61008c565b005b604051637921219560e11b81526001600160a01b0389169063f242432a906100c29033908b908b908b908b908b9060040161033b565b600060405180830381600087803b1580156100dc57600080fd5b505af11580156100f0573d6000803e3d6000fd5b50505050600061010689338989898989896101a6565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd6390610157908b9085906004016103a6565b6020604051808303816000875af1158015610176573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019a91906103e8565b50505050505050505050565b60606000858585856040516020016101c19493929190610401565b604051602081830303815290604052905089898989846040516020016101eb959493929190610433565b60405160208183030381529060405291505098975050505050505050565b6001600160a01b038116811461021e57600080fd5b50565b60008083601f84011261023357600080fd5b50813567ffffffffffffffff81111561024b57600080fd5b60208301915083602082850101111561026357600080fd5b9250929050565b60008060008060008060008060c0898b03121561028657600080fd5b883561029181610209565b975060208901356102a181610209565b96506040890135955060608901359450608089013567ffffffffffffffff808211156102cc57600080fd5b6102d88c838d01610221565b909650945060a08b01359150808211156102f157600080fd5b506102fe8b828c01610221565b999c989b5096995094979396929594505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03878116825286166020820152604081018590526060810184905260a0608082018190526000906103769083018486610312565b98975050505050505050565b60005b8381101561039d578181015183820152602001610385565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526103d3816060850160208701610382565b601f01601f1916919091016060019392505050565b6000602082840312156103fa57600080fd5b5051919050565b604081526000610415604083018688610312565b8281036020840152610428818587610312565b979650505050505050565b60006bffffffffffffffffffffffff19808860601b168352808760601b166014840152508460288301528360488301528251610476816068850160208701610382565b91909101606801969550505050505056fea26469706673582212208a2be17b506fdeea2c29cef703e184884f695e71e9147dce06da5055620ed53364736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a578063dec07dca14610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a61008536600461026a565b61008c565b005b604051637921219560e11b81526001600160a01b0389169063f242432a906100c29033908b908b908b908b908b9060040161033b565b600060405180830381600087803b1580156100dc57600080fd5b505af11580156100f0573d6000803e3d6000fd5b50505050600061010689338989898989896101a6565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd6390610157908b9085906004016103a6565b6020604051808303816000875af1158015610176573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019a91906103e8565b50505050505050505050565b60606000858585856040516020016101c19493929190610401565b604051602081830303815290604052905089898989846040516020016101eb959493929190610433565b60405160208183030381529060405291505098975050505050505050565b6001600160a01b038116811461021e57600080fd5b50565b60008083601f84011261023357600080fd5b50813567ffffffffffffffff81111561024b57600080fd5b60208301915083602082850101111561026357600080fd5b9250929050565b60008060008060008060008060c0898b03121561028657600080fd5b883561029181610209565b975060208901356102a181610209565b96506040890135955060608901359450608089013567ffffffffffffffff808211156102cc57600080fd5b6102d88c838d01610221565b909650945060a08b01359150808211156102f157600080fd5b506102fe8b828c01610221565b999c989b5096995094979396929594505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03878116825286166020820152604081018590526060810184905260a0608082018190526000906103769083018486610312565b98975050505050505050565b60005b8381101561039d578181015183820152602001610385565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526103d3816060850160208701610382565b601f01601f1916919091016060019392505050565b6000602082840312156103fa57600080fd5b5051919050565b604081526000610415604083018688610312565b8281036020840152610428818587610312565b979650505050505050565b60006bffffffffffffffffffffffff19808860601b168352808760601b166014840152508460288301528360488301528251610476816068850160208701610382565b91909101606801969550505050505056fea26469706673582212208a2be17b506fdeea2c29cef703e184884f695e71e9147dce06da5055620ed53364736f6c63430008130033", - "devdoc": { - "kind": "dev", - "methods": { - "constructor": { - "params": { - "_inputBox": "The input box used by the portal" - } - }, - "depositSingleERC1155Token(address,address,uint256,uint256,bytes,bytes)": { - "params": { - "_baseLayerData": "Additional data to be interpreted by the base layer", - "_dapp": "The address of the DApp", - "_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 an ERC-1155 token to a DApp and add an input to the DApp'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 input relay." - } - }, - "notice": "This contract allows anyone to perform single transfers of ERC-1155 tokens to a DApp while informing the off-chain machine.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/deployments/mainnet/ERC20Portal.json b/deployments/mainnet/ERC20Portal.json deleted file mode 100644 index 7260a3939..000000000 --- a/deployments/mainnet/ERC20Portal.json +++ /dev/null @@ -1,126 +0,0 @@ -{ - "address": "0x9C21AEb2093C32DDbC53eEF24B873BDCd1aDa1DB", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC20", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "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": "0x595d60288da439a450a123587f0286713d3292b64e5f052b2256dbc2303498fb", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 85, - "gasUsed": "265834", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xa7642b5a1aac713a0eb266bd54c936ac25e71ea0064218377b844bacf48fc5ad", - "transactionHash": "0x595d60288da439a450a123587f0286713d3292b64e5f052b2256dbc2303498fb", - "logs": [], - "blockNumber": 17784735, - "cumulativeGasUsed": "9522968", - "status": 1, - "byzantium": true - }, - "args": [ - "0x59b22D57D4f067708AB0c00552767405926dc768" - ], - "numDeployments": 1, - "solcInputHash": "d2696284402b6703b2d41170c93ef3b7", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"_inputBox\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_dapp\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"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\":{\"_amount\":\"The amount of tokens to be transferred\",\"_dapp\":\"The address of the DApp\",\"_execLayerData\":\"Additional data to be interpreted by the execution layer\",\"_token\":\"The ERC-20 token contract\"}},\"getInputBox()\":{\"returns\":{\"_0\":\"The input box\"}}},\"title\":\"ERC-20 Portal\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs the portal.\"},\"depositERC20Tokens(address,address,uint256,bytes)\":{\"notice\":\"Transfer ERC-20 tokens to a DApp and add an input to the DApp's input box to signal such operation. The caller must allow the portal to withdraw at least `_amount` tokens from their account beforehand, by calling the `approve` function in the token contract.\"},\"getInputBox()\":{\"notice\":\"Get the input box used by this input relay.\"}},\"notice\":\"This contract allows anyone to perform transfers of ERC-20 tokens to a DApp 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 v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token 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 amount 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 `amount` tokens of token type `id` from `from` to `to`.\\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 `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 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` 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 amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon 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 caller.\\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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"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 and relays.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Ether being sent in Wei\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\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 ret The return value of `transferFrom`\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param amount The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\n function encodeERC20Deposit(\\n bool ret,\\n IERC20 token,\\n address sender,\\n uint256 amount,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n ret, // 1B\\n token, // 20B\\n sender, // 20B\\n amount, // 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\\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\\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\\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 /// @notice Encode a DApp address relay.\\n /// @param dapp The DApp address\\n /// @return The encoded input\\n function encodeDAppAddressRelay(\\n address dapp\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n dapp // 20B\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5dce266a7b70ba86adf6a728c7667255d3e2b20f1789a951150a1d05439b7019\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputRelay.sol\":{\"content\":\"// (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 \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay interface\\ninterface IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this input relay.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x8c9316c43cc2c7754fbd5abccfcdbc5ed09a2f1228d993240eac6c41ea531521\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/InputRelay.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputRelay} from \\\"./IInputRelay.sol\\\";\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay\\n/// @notice This contract serves as a base for all the other input relays.\\ncontract InputRelay is IInputRelay {\\n /// @notice The input box used by the input relay.\\n IInputBox internal immutable inputBox;\\n\\n /// @notice Constructs the input relay.\\n /// @param _inputBox The input box used by the input relay\\n constructor(IInputBox _inputBox) {\\n inputBox = _inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return inputBox;\\n }\\n}\\n\",\"keccak256\":\"0xbb489f157a0bd7a9da29b0bf3c47c4b4051d90ccd252abc3f81c8e897329e590\",\"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 {InputRelay} from \\\"../inputs/InputRelay.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 a DApp while informing the off-chain machine.\\ncontract ERC20Portal is InputRelay, IERC20Portal {\\n /// @notice Constructs the portal.\\n /// @param _inputBox The input box used by the portal\\n constructor(IInputBox _inputBox) InputRelay(_inputBox) {}\\n\\n function depositERC20Tokens(\\n IERC20 _token,\\n address _dapp,\\n uint256 _amount,\\n bytes calldata _execLayerData\\n ) external override {\\n bool success = _token.transferFrom(msg.sender, _dapp, _amount);\\n\\n bytes memory input = InputEncoding.encodeERC20Deposit(\\n success,\\n _token,\\n msg.sender,\\n _amount,\\n _execLayerData\\n );\\n\\n inputBox.addInput(_dapp, input);\\n }\\n}\\n\",\"keccak256\":\"0x0de20df5988c4cda715ff1b1fbf30119822b850d2541d9a7119b8d44907da31f\",\"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 {IInputRelay} from \\\"../inputs/IInputRelay.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title ERC-20 Portal interface\\ninterface IERC20Portal is IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Transfer ERC-20 tokens to a DApp and add an input to\\n /// the DApp's input box to signal such operation.\\n ///\\n /// The caller must allow the portal to withdraw at least `_amount` 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 _dapp The address of the DApp\\n /// @param _amount 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 _dapp,\\n uint256 _amount,\\n bytes calldata _execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0xaeacb82606f1a687170c230eb169094cb3eea8ddc4838dc13f4830721fb5234b\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b5060405161045f38038061045f83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516103ce61009160003960008181603c015261013501526103ce6000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806395854b8114610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a610085366004610209565b61008c565b005b6040516323b872dd60e01b81523360048201526001600160a01b03858116602483015260448201859052600091908716906323b872dd906064016020604051808303816000875af11580156100e5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061010991906102a8565b9050600061011b8288338888886101b9565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061016c90899085906004016102d1565b6020604051808303816000875af115801561018b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101af919061032f565b5050505050505050565b60608686868686866040516020016101d696959493929190610348565b60405160208183030381529060405290509695505050505050565b6001600160a01b038116811461020657600080fd5b50565b60008060008060006080868803121561022157600080fd5b853561022c816101f1565b9450602086013561023c816101f1565b935060408601359250606086013567ffffffffffffffff8082111561026057600080fd5b818801915088601f83011261027457600080fd5b81358181111561028357600080fd5b89602082850101111561029557600080fd5b9699959850939650602001949392505050565b6000602082840312156102ba57600080fd5b815180151581146102ca57600080fd5b9392505050565b60018060a01b038316815260006020604081840152835180604085015260005b8181101561030d578581018301518582016060015282016102f1565b506000606082860101526060601f19601f830116850101925050509392505050565b60006020828403121561034157600080fd5b5051919050565b86151560f81b815260006bffffffffffffffffffffffff19808860601b166001840152808760601b166015840152508460298301528284604984013750600091016049019081529594505050505056fea26469706673582212205635c4a24e9e9f5e128a69b633d53f24838d8833b76e4fca1f3bf3b490e380c664736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806395854b8114610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a610085366004610209565b61008c565b005b6040516323b872dd60e01b81523360048201526001600160a01b03858116602483015260448201859052600091908716906323b872dd906064016020604051808303816000875af11580156100e5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061010991906102a8565b9050600061011b8288338888886101b9565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061016c90899085906004016102d1565b6020604051808303816000875af115801561018b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101af919061032f565b5050505050505050565b60608686868686866040516020016101d696959493929190610348565b60405160208183030381529060405290509695505050505050565b6001600160a01b038116811461020657600080fd5b50565b60008060008060006080868803121561022157600080fd5b853561022c816101f1565b9450602086013561023c816101f1565b935060408601359250606086013567ffffffffffffffff8082111561026057600080fd5b818801915088601f83011261027457600080fd5b81358181111561028357600080fd5b89602082850101111561029557600080fd5b9699959850939650602001949392505050565b6000602082840312156102ba57600080fd5b815180151581146102ca57600080fd5b9392505050565b60018060a01b038316815260006020604081840152835180604085015260005b8181101561030d578581018301518582016060015282016102f1565b506000606082860101526060601f19601f830116850101925050509392505050565b60006020828403121561034157600080fd5b5051919050565b86151560f81b815260006bffffffffffffffffffffffff19808860601b166001840152808760601b166015840152508460298301528284604984013750600091016049019081529594505050505056fea26469706673582212205635c4a24e9e9f5e128a69b633d53f24838d8833b76e4fca1f3bf3b490e380c664736f6c63430008130033", - "devdoc": { - "kind": "dev", - "methods": { - "constructor": { - "params": { - "_inputBox": "The input box used by the portal" - } - }, - "depositERC20Tokens(address,address,uint256,bytes)": { - "params": { - "_amount": "The amount of tokens to be transferred", - "_dapp": "The address of the DApp", - "_execLayerData": "Additional data to be interpreted by the execution layer", - "_token": "The ERC-20 token contract" - } - }, - "getInputBox()": { - "returns": { - "_0": "The input box" - } - } - }, - "title": "ERC-20 Portal", - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "constructor": { - "notice": "Constructs the portal." - }, - "depositERC20Tokens(address,address,uint256,bytes)": { - "notice": "Transfer ERC-20 tokens to a DApp and add an input to the DApp's input box to signal such operation. The caller must allow the portal to withdraw at least `_amount` tokens from their account beforehand, by calling the `approve` function in the token contract." - }, - "getInputBox()": { - "notice": "Get the input box used by this input relay." - } - }, - "notice": "This contract allows anyone to perform transfers of ERC-20 tokens to a DApp while informing the off-chain machine.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/deployments/mainnet/ERC721Portal.json b/deployments/mainnet/ERC721Portal.json deleted file mode 100644 index b0642b332..000000000 --- a/deployments/mainnet/ERC721Portal.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "address": "0x237F8DD094C0e47f4236f12b4Fa01d6Dae89fb87", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC721", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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": "0xf5b35581019329b52f3ff0bf2e87eb9086a219eeb7d1ea8d798550f7bbd1f158", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 80, - "gasUsed": "308450", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x2bc3af71dd1e10dab6c13a1f4069bed2e6b105144f126aebe3fef08825b2b98f", - "transactionHash": "0xf5b35581019329b52f3ff0bf2e87eb9086a219eeb7d1ea8d798550f7bbd1f158", - "logs": [], - "blockNumber": 17784736, - "cumulativeGasUsed": "7532413", - "status": 1, - "byzantium": true - }, - "args": [ - "0x59b22D57D4f067708AB0c00552767405926dc768" - ], - "numDeployments": 1, - "solcInputHash": "d2696284402b6703b2d41170c93ef3b7", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"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\":\"_dapp\",\"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\":{\"_baseLayerData\":\"Additional data to be interpreted by the base layer\",\"_dapp\":\"The address of the DApp\",\"_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 a DApp and add an input to the DApp'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 input relay.\"}},\"notice\":\"This contract allows anyone to perform transfers of ERC-721 tokens to a DApp 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 v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token 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 amount 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 `amount` tokens of token type `id` from `from` to `to`.\\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 `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 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` 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 amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon 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 caller.\\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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"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 and relays.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Ether being sent in Wei\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\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 ret The return value of `transferFrom`\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param amount The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\n function encodeERC20Deposit(\\n bool ret,\\n IERC20 token,\\n address sender,\\n uint256 amount,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n ret, // 1B\\n token, // 20B\\n sender, // 20B\\n amount, // 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\\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\\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\\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 /// @notice Encode a DApp address relay.\\n /// @param dapp The DApp address\\n /// @return The encoded input\\n function encodeDAppAddressRelay(\\n address dapp\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n dapp // 20B\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5dce266a7b70ba86adf6a728c7667255d3e2b20f1789a951150a1d05439b7019\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputRelay.sol\":{\"content\":\"// (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 \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay interface\\ninterface IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this input relay.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x8c9316c43cc2c7754fbd5abccfcdbc5ed09a2f1228d993240eac6c41ea531521\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/InputRelay.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputRelay} from \\\"./IInputRelay.sol\\\";\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay\\n/// @notice This contract serves as a base for all the other input relays.\\ncontract InputRelay is IInputRelay {\\n /// @notice The input box used by the input relay.\\n IInputBox internal immutable inputBox;\\n\\n /// @notice Constructs the input relay.\\n /// @param _inputBox The input box used by the input relay\\n constructor(IInputBox _inputBox) {\\n inputBox = _inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return inputBox;\\n }\\n}\\n\",\"keccak256\":\"0xbb489f157a0bd7a9da29b0bf3c47c4b4051d90ccd252abc3f81c8e897329e590\",\"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 {InputRelay} from \\\"../inputs/InputRelay.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 a DApp while informing the off-chain machine.\\ncontract ERC721Portal is InputRelay, IERC721Portal {\\n /// @notice Constructs the portal.\\n /// @param _inputBox The input box used by the portal\\n constructor(IInputBox _inputBox) InputRelay(_inputBox) {}\\n\\n function depositERC721Token(\\n IERC721 _token,\\n address _dapp,\\n uint256 _tokenId,\\n bytes calldata _baseLayerData,\\n bytes calldata _execLayerData\\n ) external override {\\n _token.safeTransferFrom(msg.sender, _dapp, _tokenId, _baseLayerData);\\n\\n bytes memory input = InputEncoding.encodeERC721Deposit(\\n _token,\\n msg.sender,\\n _tokenId,\\n _baseLayerData,\\n _execLayerData\\n );\\n\\n inputBox.addInput(_dapp, input);\\n }\\n}\\n\",\"keccak256\":\"0xe402b9ad4394ceb4e6bc0a0fe9df7fa0f9ee46709b8046ed50fe2f83ab259a9e\",\"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 {IInputRelay} from \\\"../inputs/IInputRelay.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title ERC-721 Portal interface\\ninterface IERC721Portal is IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Transfer an ERC-721 token to a DApp and add an input to\\n /// the DApp'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 _dapp The address of the DApp\\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 _dapp,\\n uint256 _tokenId,\\n bytes calldata _baseLayerData,\\n bytes calldata _execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0x9da43aa0b2c19659dd96c244ce260760d7c1c675aaec85feacd322d35b8e1844\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b5060405161052438038061052483398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b60805161049361009160003960008181603c015261011d01526104936000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806328911e8314610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a610085366004610263565b61008c565b005b604051635c46a7ef60e11b81526001600160a01b0388169063b88d4fde906100c09033908a908a908a908a9060040161032b565b600060405180830381600087803b1580156100da57600080fd5b505af11580156100ee573d6000803e3d6000fd5b505050506000610103883388888888886101a2565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd6390610154908a90859060040161038e565b6020604051808303816000875af1158015610173573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019791906103d0565b505050505050505050565b60606000858585856040516020016101bd94939291906103e9565b6040516020818303038152906040529050888888836040516020016101e59493929190610410565b604051602081830303815290604052915050979650505050505050565b6001600160a01b038116811461021757600080fd5b50565b60008083601f84011261022c57600080fd5b50813567ffffffffffffffff81111561024457600080fd5b60208301915083602082850101111561025c57600080fd5b9250929050565b600080600080600080600060a0888a03121561027e57600080fd5b873561028981610202565b9650602088013561029981610202565b955060408801359450606088013567ffffffffffffffff808211156102bd57600080fd5b6102c98b838c0161021a565b909650945060808a01359150808211156102e257600080fd5b506102ef8a828b0161021a565b989b979a50959850939692959293505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038681168252851660208201526040810184905260806060820181905260009061035f9083018486610302565b979650505050505050565b60005b8381101561038557818101518382015260200161036d565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526103bb81606085016020870161036a565b601f01601f1916919091016060019392505050565b6000602082840312156103e257600080fd5b5051919050565b6040815260006103fd604083018688610302565b828103602084015261035f818587610302565b60006bffffffffffffffffffffffff19808760601b168352808660601b16601484015250836028830152825161044d81604885016020870161036a565b919091016048019594505050505056fea2646970667358221220c2c237b79e46918de25850a3a3944f2f3cce2d65223f9c2c4e6fefb21e70609864736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806328911e8314610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a610085366004610263565b61008c565b005b604051635c46a7ef60e11b81526001600160a01b0388169063b88d4fde906100c09033908a908a908a908a9060040161032b565b600060405180830381600087803b1580156100da57600080fd5b505af11580156100ee573d6000803e3d6000fd5b505050506000610103883388888888886101a2565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd6390610154908a90859060040161038e565b6020604051808303816000875af1158015610173573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019791906103d0565b505050505050505050565b60606000858585856040516020016101bd94939291906103e9565b6040516020818303038152906040529050888888836040516020016101e59493929190610410565b604051602081830303815290604052915050979650505050505050565b6001600160a01b038116811461021757600080fd5b50565b60008083601f84011261022c57600080fd5b50813567ffffffffffffffff81111561024457600080fd5b60208301915083602082850101111561025c57600080fd5b9250929050565b600080600080600080600060a0888a03121561027e57600080fd5b873561028981610202565b9650602088013561029981610202565b955060408801359450606088013567ffffffffffffffff808211156102bd57600080fd5b6102c98b838c0161021a565b909650945060808a01359150808211156102e257600080fd5b506102ef8a828b0161021a565b989b979a50959850939692959293505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038681168252851660208201526040810184905260806060820181905260009061035f9083018486610302565b979650505050505050565b60005b8381101561038557818101518382015260200161036d565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526103bb81606085016020870161036a565b601f01601f1916919091016060019392505050565b6000602082840312156103e257600080fd5b5051919050565b6040815260006103fd604083018688610302565b828103602084015261035f818587610302565b60006bffffffffffffffffffffffff19808760601b168352808660601b16601484015250836028830152825161044d81604885016020870161036a565b919091016048019594505050505056fea2646970667358221220c2c237b79e46918de25850a3a3944f2f3cce2d65223f9c2c4e6fefb21e70609864736f6c63430008130033", - "devdoc": { - "kind": "dev", - "methods": { - "constructor": { - "params": { - "_inputBox": "The input box used by the portal" - } - }, - "depositERC721Token(address,address,uint256,bytes,bytes)": { - "params": { - "_baseLayerData": "Additional data to be interpreted by the base layer", - "_dapp": "The address of the DApp", - "_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 a DApp and add an input to the DApp'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 input relay." - } - }, - "notice": "This contract allows anyone to perform transfers of ERC-721 tokens to a DApp while informing the off-chain machine.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/deployments/mainnet/EtherPortal.json b/deployments/mainnet/EtherPortal.json deleted file mode 100644 index 7bde80f71..000000000 --- a/deployments/mainnet/EtherPortal.json +++ /dev/null @@ -1,127 +0,0 @@ -{ - "address": "0xFfdbe43d4c855BF7e0f105c400A50857f53AB044", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "EtherTransferFailed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "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": "0x08233c8e69c1bf26f8362723b4ff0d074faf65f7434ec8e0028c73e9866fb890", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 101, - "gasUsed": "237926", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x849fef79a222dec092cdf29c74c8b7bbddc263c09e4b59965c6c50f348cd9fc3", - "transactionHash": "0x08233c8e69c1bf26f8362723b4ff0d074faf65f7434ec8e0028c73e9866fb890", - "logs": [], - "blockNumber": 17784734, - "cumulativeGasUsed": "7655641", - "status": 1, - "byzantium": true - }, - "args": [ - "0x59b22D57D4f067708AB0c00552767405926dc768" - ], - "numDeployments": 1, - "solcInputHash": "d2696284402b6703b2d41170c93ef3b7", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"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\":\"_dapp\",\"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\":\"All the value sent through this function is forwarded to the DApp. If the transfer fails, `EtherTransferFailed` error is raised.\",\"params\":{\"_dapp\":\"The address of the DApp\",\"_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\":\"Raised when the Ether transfer fails.\"}]},\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs the portal.\"},\"depositEther(address,bytes)\":{\"notice\":\"Transfer Ether to a DApp and add an input to the DApp's input box to signal such operation. All the value sent through this function is forwarded to the DApp.\"},\"getInputBox()\":{\"notice\":\"Get the input box used by this input relay.\"}},\"notice\":\"This contract allows anyone to perform transfers of Ether to a DApp 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 v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token 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 amount 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 `amount` tokens of token type `id` from `from` to `to`.\\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 `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 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` 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 amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon 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 caller.\\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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"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 and relays.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Ether being sent in Wei\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\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 ret The return value of `transferFrom`\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param amount The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\n function encodeERC20Deposit(\\n bool ret,\\n IERC20 token,\\n address sender,\\n uint256 amount,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n ret, // 1B\\n token, // 20B\\n sender, // 20B\\n amount, // 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\\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\\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\\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 /// @notice Encode a DApp address relay.\\n /// @param dapp The DApp address\\n /// @return The encoded input\\n function encodeDAppAddressRelay(\\n address dapp\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n dapp // 20B\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5dce266a7b70ba86adf6a728c7667255d3e2b20f1789a951150a1d05439b7019\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputRelay.sol\":{\"content\":\"// (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 \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay interface\\ninterface IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this input relay.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x8c9316c43cc2c7754fbd5abccfcdbc5ed09a2f1228d993240eac6c41ea531521\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/InputRelay.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputRelay} from \\\"./IInputRelay.sol\\\";\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay\\n/// @notice This contract serves as a base for all the other input relays.\\ncontract InputRelay is IInputRelay {\\n /// @notice The input box used by the input relay.\\n IInputBox internal immutable inputBox;\\n\\n /// @notice Constructs the input relay.\\n /// @param _inputBox The input box used by the input relay\\n constructor(IInputBox _inputBox) {\\n inputBox = _inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return inputBox;\\n }\\n}\\n\",\"keccak256\":\"0xbb489f157a0bd7a9da29b0bf3c47c4b4051d90ccd252abc3f81c8e897329e590\",\"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 {InputRelay} from \\\"../inputs/InputRelay.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 a DApp while informing the off-chain machine.\\ncontract EtherPortal is InputRelay, IEtherPortal {\\n /// @notice Raised when the Ether transfer fails.\\n error EtherTransferFailed();\\n\\n /// @notice Constructs the portal.\\n /// @param _inputBox The input box used by the portal\\n constructor(IInputBox _inputBox) InputRelay(_inputBox) {}\\n\\n function depositEther(\\n address _dapp,\\n bytes calldata _execLayerData\\n ) external payable override {\\n // We used to call `transfer()` but it's not considered safe,\\n // as it assumes gas costs are immutable (they are not).\\n (bool success, ) = _dapp.call{value: msg.value}(\\\"\\\");\\n\\n if (!success) {\\n revert EtherTransferFailed();\\n }\\n\\n bytes memory input = InputEncoding.encodeEtherDeposit(\\n msg.sender,\\n msg.value,\\n _execLayerData\\n );\\n\\n inputBox.addInput(_dapp, input);\\n }\\n}\\n\",\"keccak256\":\"0x47950c335ae2d0dd03b680d6fcd9cb26aa1333ecf6772b1f3a71a80100b8b34c\",\"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 {IInputRelay} from \\\"../inputs/IInputRelay.sol\\\";\\n\\n/// @title Ether Portal interface\\ninterface IEtherPortal is IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Transfer Ether to a DApp and add an input to\\n /// the DApp's input box to signal such operation.\\n ///\\n /// All the value sent through this function is forwarded to the DApp.\\n ///\\n /// @param _dapp The address of the DApp\\n /// @param _execLayerData Additional data to be interpreted by the execution layer\\n /// @dev All the value sent through this function is forwarded to the DApp.\\n /// If the transfer fails, `EtherTransferFailed` error is raised.\\n function depositEther(\\n address _dapp,\\n bytes calldata _execLayerData\\n ) external payable;\\n}\\n\",\"keccak256\":\"0xa8bdb1f91935db3d7ba158935164e61f042da26a9abe872edccbff28614d9143\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b506040516103de3803806103de83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b60805161034d61009160003960008181603c0152610128015261034d6000f3fe6080604052600436106100285760003560e01c8062aace9a1461002d578063938c054f14610077575b600080fd5b34801561003957600080fd5b507f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a6100853660046101dc565b61008c565b005b6000836001600160a01b03163460405160006040518083038185875af1925050503d80600081146100d9576040519150601f19603f3d011682016040523d82523d6000602084013e6100de565b606091505b505090508061010057604051630ce8f45160e31b815260040160405180910390fd5b600061010e333486866101aa565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061015f908890859060040161026d565b6020604051808303816000875af115801561017e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a291906102cb565b505050505050565b6060848484846040516020016101c394939291906102e4565b6040516020818303038152906040529050949350505050565b6000806000604084860312156101f157600080fd5b83356001600160a01b038116811461020857600080fd5b9250602084013567ffffffffffffffff8082111561022557600080fd5b818601915086601f83011261023957600080fd5b81358181111561024857600080fd5b87602082850101111561025a57600080fd5b6020830194508093505050509250925092565b60018060a01b038316815260006020604081840152835180604085015260005b818110156102a95785810183015185820160600152820161028d565b506000606082860101526060601f19601f830116850101925050509392505050565b6000602082840312156102dd57600080fd5b5051919050565b6bffffffffffffffffffffffff198560601b1681528360148201528183603483013760009101603401908152939250505056fea26469706673582212203555bb6cf9b2020729bb19c561673a225f367cd3219906075930d8b9f3fb219864736f6c63430008130033", - "deployedBytecode": "0x6080604052600436106100285760003560e01c8062aace9a1461002d578063938c054f14610077575b600080fd5b34801561003957600080fd5b507f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a6100853660046101dc565b61008c565b005b6000836001600160a01b03163460405160006040518083038185875af1925050503d80600081146100d9576040519150601f19603f3d011682016040523d82523d6000602084013e6100de565b606091505b505090508061010057604051630ce8f45160e31b815260040160405180910390fd5b600061010e333486866101aa565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061015f908890859060040161026d565b6020604051808303816000875af115801561017e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a291906102cb565b505050505050565b6060848484846040516020016101c394939291906102e4565b6040516020818303038152906040529050949350505050565b6000806000604084860312156101f157600080fd5b83356001600160a01b038116811461020857600080fd5b9250602084013567ffffffffffffffff8082111561022557600080fd5b818601915086601f83011261023957600080fd5b81358181111561024857600080fd5b87602082850101111561025a57600080fd5b6020830194508093505050509250925092565b60018060a01b038316815260006020604081840152835180604085015260005b818110156102a95785810183015185820160600152820161028d565b506000606082860101526060601f19601f830116850101925050509392505050565b6000602082840312156102dd57600080fd5b5051919050565b6bffffffffffffffffffffffff198560601b1681528360148201528183603483013760009101603401908152939250505056fea26469706673582212203555bb6cf9b2020729bb19c561673a225f367cd3219906075930d8b9f3fb219864736f6c63430008130033", - "devdoc": { - "kind": "dev", - "methods": { - "constructor": { - "params": { - "_inputBox": "The input box used by the portal" - } - }, - "depositEther(address,bytes)": { - "details": "All the value sent through this function is forwarded to the DApp. If the transfer fails, `EtherTransferFailed` error is raised.", - "params": { - "_dapp": "The address of the DApp", - "_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": "Raised when the Ether transfer fails." - } - ] - }, - "kind": "user", - "methods": { - "constructor": { - "notice": "Constructs the portal." - }, - "depositEther(address,bytes)": { - "notice": "Transfer Ether to a DApp and add an input to the DApp's input box to signal such operation. All the value sent through this function is forwarded to the DApp." - }, - "getInputBox()": { - "notice": "Get the input box used by this input relay." - } - }, - "notice": "This contract allows anyone to perform transfers of Ether to a DApp while informing the off-chain machine.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/deployments/mainnet/InputBox.json b/deployments/mainnet/InputBox.json deleted file mode 100644 index 7f9a545ea..000000000 --- a/deployments/mainnet/InputBox.json +++ /dev/null @@ -1,246 +0,0 @@ -{ - "address": "0x59b22D57D4f067708AB0c00552767405926dc768", - "abi": [ - { - "inputs": [], - "name": "InputSizeExceedsLimit", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "dapp", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "inputIndex", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "input", - "type": "bytes" - } - ], - "name": "InputAdded", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_input", - "type": "bytes" - } - ], - "name": "addInput", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "getInputHash", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - } - ], - "name": "getNumberOfInputs", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "transactionHash": "0xab98fc7ae70bd05c888d95e99a6de06aca663883412e363cb2615d4511d73ca8", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 74, - "gasUsed": "260728", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xba4fa13489895f6d30ca9ebb6cf611a53321ab67bc1aef057119b8ada548acb7", - "transactionHash": "0xab98fc7ae70bd05c888d95e99a6de06aca663883412e363cb2615d4511d73ca8", - "logs": [], - "blockNumber": 17784733, - "cumulativeGasUsed": "6838290", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 1, - "solcInputHash": "d2696284402b6703b2d41170c93ef3b7", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"InputSizeExceedsLimit\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"dapp\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"inputIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"input\",\"type\":\"bytes\"}],\"name\":\"InputAdded\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_dapp\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_input\",\"type\":\"bytes\"}],\"name\":\"addInput\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_dapp\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"getInputHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_dapp\",\"type\":\"address\"}],\"name\":\"getNumberOfInputs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"InputAdded(address,uint256,address,bytes)\":{\"details\":\"MUST be triggered on a successful call to `addInput`.\",\"params\":{\"dapp\":\"The address of the DApp\",\"input\":\"The contents of the input\",\"inputIndex\":\"The index of the input in the input box\",\"sender\":\"The address that sent the input\"}}},\"kind\":\"dev\",\"methods\":{\"addInput(address,bytes)\":{\"details\":\"MUST fire an `InputAdded` event accordingly. Input larger than machine limit will raise `InputSizeExceedsLimit` error.\",\"params\":{\"_dapp\":\"The address of the DApp\",\"_input\":\"The contents of the input\"},\"returns\":{\"_0\":\"The hash of the input plus some extra metadata\"}},\"getInputHash(address,uint256)\":{\"details\":\"`_index` MUST be in the interval `[0,n)` where `n` is the number of inputs in the DApp's input box. See the `getNumberOfInputs` function.\",\"params\":{\"_dapp\":\"The address of the DApp\",\"_index\":\"The index of the input in the DApp's input box\"},\"returns\":{\"_0\":\"The hash of the input at the provided index in the DApp's input box\"}},\"getNumberOfInputs(address)\":{\"params\":{\"_dapp\":\"The address of the DApp\"},\"returns\":{\"_0\":\"Number of inputs in the DApp's input box\"}}},\"stateVariables\":{\"inputBoxes\":{\"details\":\"See the `getNumberOfInputs`, `getInputHash` and `addInput` functions.\"}},\"title\":\"Input Box\",\"version\":1},\"userdoc\":{\"errors\":{\"InputSizeExceedsLimit()\":[{\"notice\":\"Raised when input is larger than the machine limit.\"}]},\"events\":{\"InputAdded(address,uint256,address,bytes)\":{\"notice\":\"Emitted when an input is added to a DApp's input box.\"}},\"kind\":\"user\",\"methods\":{\"addInput(address,bytes)\":{\"notice\":\"Add an input to a DApp's input box.\"},\"getInputHash(address,uint256)\":{\"notice\":\"Get the hash of an input in a DApp's input box.\"},\"getNumberOfInputs(address)\":{\"notice\":\"Get the number of inputs in a DApp's input box.\"}},\"notice\":\"Trustless and permissionless contract that receives arbitrary blobs (called \\\"inputs\\\") from anyone and adds a compound hash to an append-only list (called \\\"input box\\\"). Each DApp has its own input box. The hash that is stored on-chain is composed by the hash of the input blob, the block number and timestamp, the input sender address, and the input index. Data availability is guaranteed by the emission of `InputAdded` events on every successful call to `addInput`. This ensures that inputs can be retrieved by anyone at any time, without having to rely on centralized data providers. From the perspective of this contract, inputs are encoding-agnostic byte arrays. It is up to the DApp to interpret, validate and act upon inputs.\",\"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 Base-2 logarithm of number of bytes.\\n type Log2Size is uint64;\\n\\n /// @notice Machine word size (8 bytes).\\n Log2Size constant WORD_LOG2_SIZE = Log2Size.wrap(3);\\n\\n /// @notice Machine address space size (2^64 bytes).\\n Log2Size constant MACHINE_LOG2_SIZE = Log2Size.wrap(64);\\n\\n /// @notice Keccak-256 output size (32 bytes).\\n Log2Size constant KECCAK_LOG2_SIZE = Log2Size.wrap(5);\\n\\n /// @notice Maximum input size (~2 megabytes).\\n /// @dev The offset and size fields use up the extra 64 bytes.\\n uint256 constant INPUT_MAX_SIZE = (1 << 21) - 64;\\n\\n /// @notice Maximum voucher metadata memory range (2 megabytes).\\n Log2Size constant VOUCHER_METADATA_LOG2_SIZE = Log2Size.wrap(21);\\n\\n /// @notice Maximum notice metadata memory range (2 megabytes).\\n Log2Size constant NOTICE_METADATA_LOG2_SIZE = Log2Size.wrap(21);\\n\\n /// @notice Maximum epoch voucher memory range (128 megabytes).\\n Log2Size constant EPOCH_VOUCHER_LOG2_SIZE = Log2Size.wrap(37);\\n\\n /// @notice Maximum epoch notice memory range (128 megabytes).\\n Log2Size constant EPOCH_NOTICE_LOG2_SIZE = Log2Size.wrap(37);\\n\\n /// @notice Unwrap `s` into its underlying uint64 value.\\n /// @param s Base-2 logarithm of some number of bytes\\n function uint64OfSize(Log2Size s) internal pure returns (uint64) {\\n return Log2Size.unwrap(s);\\n }\\n\\n /// @notice Return the position of an intra memory range on a memory range\\n /// with contents with the same size.\\n /// @param index Index of intra memory range\\n /// @param log2Size Base-2 logarithm of intra memory range size\\n function getIntraMemoryRangePosition(\\n uint64 index,\\n Log2Size log2Size\\n ) internal pure returns (uint64) {\\n return index << Log2Size.unwrap(log2Size);\\n }\\n}\\n\",\"keccak256\":\"0x97cdce56cdb4f0b4164e6be3a72e50469a3124e4716e753a1792aa70eac614f5\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"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.8;\\n\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\nimport {LibInput} from \\\"../library/LibInput.sol\\\";\\n\\n/// @title Input Box\\n///\\n/// @notice Trustless and permissionless contract that receives arbitrary blobs\\n/// (called \\\"inputs\\\") from anyone and adds a compound hash to an append-only list\\n/// (called \\\"input box\\\"). Each DApp has its own input box.\\n///\\n/// The hash that is stored on-chain is composed by the hash of the input blob,\\n/// the block number and timestamp, the input sender address, and the input index.\\n///\\n/// Data availability is guaranteed by the emission of `InputAdded` events\\n/// on every successful call to `addInput`. This ensures that inputs can be\\n/// retrieved by anyone at any time, without having to rely on centralized data\\n/// providers.\\n///\\n/// From the perspective of this contract, inputs are encoding-agnostic byte\\n/// arrays. It is up to the DApp to interpret, validate and act upon inputs.\\ncontract InputBox is IInputBox {\\n /// @notice Mapping from DApp address to list of input hashes.\\n /// @dev See the `getNumberOfInputs`, `getInputHash` and `addInput` functions.\\n mapping(address => bytes32[]) internal inputBoxes;\\n\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external override returns (bytes32) {\\n bytes32[] storage inputBox = inputBoxes[_dapp];\\n uint256 inputIndex = inputBox.length;\\n\\n bytes32 inputHash = LibInput.computeInputHash(\\n msg.sender,\\n block.number,\\n block.timestamp,\\n _input,\\n inputIndex\\n );\\n\\n // add input to the input box\\n inputBox.push(inputHash);\\n\\n // block.number and timestamp can be retrieved by the event metadata itself\\n emit InputAdded(_dapp, inputIndex, msg.sender, _input);\\n\\n return inputHash;\\n }\\n\\n function getNumberOfInputs(\\n address _dapp\\n ) external view override returns (uint256) {\\n return inputBoxes[_dapp].length;\\n }\\n\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view override returns (bytes32) {\\n return inputBoxes[_dapp][_index];\\n }\\n}\\n\",\"keccak256\":\"0x83d36baf0bda5a63ea5eae7e021b80eabb30f9ace14fcdb5936f0e27b779fccb\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/library/LibInput.sol\":{\"content\":\"// (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\\\";\\n\\n/// @title Input Library\\nlibrary LibInput {\\n using CanonicalMachine for CanonicalMachine.Log2Size;\\n\\n /// @notice Raised when input is larger than the machine limit.\\n error InputSizeExceedsLimit();\\n\\n /// @notice Summarize input data in a single hash.\\n /// @param sender `msg.sender`\\n /// @param blockNumber `block.number`\\n /// @param blockTimestamp `block.timestamp`\\n /// @param input The input blob\\n /// @param inputIndex The index of the input in the input box\\n /// @return The input hash\\n function computeInputHash(\\n address sender,\\n uint256 blockNumber,\\n uint256 blockTimestamp,\\n bytes calldata input,\\n uint256 inputIndex\\n ) internal pure returns (bytes32) {\\n if (input.length > CanonicalMachine.INPUT_MAX_SIZE) {\\n revert InputSizeExceedsLimit();\\n }\\n\\n bytes32 keccakMetadata = keccak256(\\n abi.encode(\\n sender,\\n blockNumber,\\n blockTimestamp,\\n 0, //TODO decide how to deal with epoch index\\n inputIndex // input index in the input box\\n )\\n );\\n\\n bytes32 keccakInput = keccak256(input);\\n\\n return keccak256(abi.encode(keccakMetadata, keccakInput));\\n }\\n}\\n\",\"keccak256\":\"0x27f2fe9efc2f6fc85687ea78e5c79a090c46ece27e7bb26e0c184a3fef62317a\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506103be806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80631789cd631461004657806361a93c871461006b578063677087c914610094575b600080fd5b610059610054366004610253565b6100a7565b60405190815260200160405180910390f35b6100596100793660046102d6565b6001600160a01b031660009081526020819052604090205490565b6100596100a23660046102f8565b61013b565b6001600160a01b03831660009081526020819052604081208054826100d0334342898987610178565b83546001810185556000858152602090200181905560405190915082906001600160a01b038916907f6aaa400068bf4ca337265e2a1e1e841f66b8597fd5b452fdc52a44bed28a0784906101299033908b908b90610322565b60405180910390a39695505050505050565b6001600160a01b038216600090815260208190526040812080548390811061016557610165610362565b9060005260206000200154905092915050565b6000621fffc083111561019e57604051634273a49560e11b815260040160405180910390fd5b604080516001600160a01b03891660208201529081018790526060810186905260006080820181905260a082018490529060c001604051602081830303815290604052805190602001209050600085856040516101fc929190610378565b604080519182900382206020808401959095528282015280518083038201815260609092019052805192019190912098975050505050505050565b80356001600160a01b038116811461024e57600080fd5b919050565b60008060006040848603121561026857600080fd5b61027184610237565b9250602084013567ffffffffffffffff8082111561028e57600080fd5b818601915086601f8301126102a257600080fd5b8135818111156102b157600080fd5b8760208285010111156102c357600080fd5b6020830194508093505050509250925092565b6000602082840312156102e857600080fd5b6102f182610237565b9392505050565b6000806040838503121561030b57600080fd5b61031483610237565b946020939093013593505050565b6001600160a01b03841681526040602082018190528101829052818360608301376000818301606090810191909152601f909201601f1916010192915050565b634e487b7160e01b600052603260045260246000fd5b818382376000910190815291905056fea264697066735822122043b0a58952371efb5f75573ec65e82305da7154e6338f4e9c00f5cc07f92c4af64736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80631789cd631461004657806361a93c871461006b578063677087c914610094575b600080fd5b610059610054366004610253565b6100a7565b60405190815260200160405180910390f35b6100596100793660046102d6565b6001600160a01b031660009081526020819052604090205490565b6100596100a23660046102f8565b61013b565b6001600160a01b03831660009081526020819052604081208054826100d0334342898987610178565b83546001810185556000858152602090200181905560405190915082906001600160a01b038916907f6aaa400068bf4ca337265e2a1e1e841f66b8597fd5b452fdc52a44bed28a0784906101299033908b908b90610322565b60405180910390a39695505050505050565b6001600160a01b038216600090815260208190526040812080548390811061016557610165610362565b9060005260206000200154905092915050565b6000621fffc083111561019e57604051634273a49560e11b815260040160405180910390fd5b604080516001600160a01b03891660208201529081018790526060810186905260006080820181905260a082018490529060c001604051602081830303815290604052805190602001209050600085856040516101fc929190610378565b604080519182900382206020808401959095528282015280518083038201815260609092019052805192019190912098975050505050505050565b80356001600160a01b038116811461024e57600080fd5b919050565b60008060006040848603121561026857600080fd5b61027184610237565b9250602084013567ffffffffffffffff8082111561028e57600080fd5b818601915086601f8301126102a257600080fd5b8135818111156102b157600080fd5b8760208285010111156102c357600080fd5b6020830194508093505050509250925092565b6000602082840312156102e857600080fd5b6102f182610237565b9392505050565b6000806040838503121561030b57600080fd5b61031483610237565b946020939093013593505050565b6001600160a01b03841681526040602082018190528101829052818360608301376000818301606090810191909152601f909201601f1916010192915050565b634e487b7160e01b600052603260045260246000fd5b818382376000910190815291905056fea264697066735822122043b0a58952371efb5f75573ec65e82305da7154e6338f4e9c00f5cc07f92c4af64736f6c63430008130033", - "devdoc": { - "events": { - "InputAdded(address,uint256,address,bytes)": { - "details": "MUST be triggered on a successful call to `addInput`.", - "params": { - "dapp": "The address of the DApp", - "input": "The contents of the input", - "inputIndex": "The index of the input in the input box", - "sender": "The address that sent the input" - } - } - }, - "kind": "dev", - "methods": { - "addInput(address,bytes)": { - "details": "MUST fire an `InputAdded` event accordingly. Input larger than machine limit will raise `InputSizeExceedsLimit` error.", - "params": { - "_dapp": "The address of the DApp", - "_input": "The contents of the input" - }, - "returns": { - "_0": "The hash of the input plus some extra metadata" - } - }, - "getInputHash(address,uint256)": { - "details": "`_index` MUST be in the interval `[0,n)` where `n` is the number of inputs in the DApp's input box. See the `getNumberOfInputs` function.", - "params": { - "_dapp": "The address of the DApp", - "_index": "The index of the input in the DApp's input box" - }, - "returns": { - "_0": "The hash of the input at the provided index in the DApp's input box" - } - }, - "getNumberOfInputs(address)": { - "params": { - "_dapp": "The address of the DApp" - }, - "returns": { - "_0": "Number of inputs in the DApp's input box" - } - } - }, - "stateVariables": { - "inputBoxes": { - "details": "See the `getNumberOfInputs`, `getInputHash` and `addInput` functions." - } - }, - "title": "Input Box", - "version": 1 - }, - "userdoc": { - "errors": { - "InputSizeExceedsLimit()": [ - { - "notice": "Raised when input is larger than the machine limit." - } - ] - }, - "events": { - "InputAdded(address,uint256,address,bytes)": { - "notice": "Emitted when an input is added to a DApp's input box." - } - }, - "kind": "user", - "methods": { - "addInput(address,bytes)": { - "notice": "Add an input to a DApp's input box." - }, - "getInputHash(address,uint256)": { - "notice": "Get the hash of an input in a DApp's input box." - }, - "getNumberOfInputs(address)": { - "notice": "Get the number of inputs in a DApp's input box." - } - }, - "notice": "Trustless and permissionless contract that receives arbitrary blobs (called \"inputs\") from anyone and adds a compound hash to an append-only list (called \"input box\"). Each DApp has its own input box. The hash that is stored on-chain is composed by the hash of the input blob, the block number and timestamp, the input sender address, and the input index. Data availability is guaranteed by the emission of `InputAdded` events on every successful call to `addInput`. This ensures that inputs can be retrieved by anyone at any time, without having to rely on centralized data providers. From the perspective of this contract, inputs are encoding-agnostic byte arrays. It is up to the DApp to interpret, validate and act upon inputs.", - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 3451, - "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/.chainId b/deployments/optimism/.chainId deleted file mode 100644 index 9a037142a..000000000 --- a/deployments/optimism/.chainId +++ /dev/null @@ -1 +0,0 @@ -10 \ No newline at end of file diff --git a/deployments/optimism/AuthorityFactory.json b/deployments/optimism/AuthorityFactory.json deleted file mode 100644 index eaaaa675f..000000000 --- a/deployments/optimism/AuthorityFactory.json +++ /dev/null @@ -1,183 +0,0 @@ -{ - "address": "0xf26a5b278C25D8D41A136d22Ad719EACEd9c3e63", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "authorityOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract Authority", - "name": "authority", - "type": "address" - } - ], - "name": "AuthorityCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateAuthorityAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newAuthority", - "outputs": [ - { - "internalType": "contract Authority", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - } - ], - "name": "newAuthority", - "outputs": [ - { - "internalType": "contract Authority", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0x7e44fe756eeff3a00f615a73775cf4b7e32ac6e56cd3040a08093861f0f1c2b4", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 4, - "gasUsed": "756688", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5a8052b0542cd8eade31223fa1b438a19dad75ef00835764e97ac81edae0b9b9", - "transactionHash": "0x7e44fe756eeff3a00f615a73775cf4b7e32ac6e56cd3040a08093861f0f1c2b4", - "logs": [], - "blockNumber": 110415997, - "cumulativeGasUsed": "1096772", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 1, - "solcInputHash": "b1bc2a879218740e83dfbb7046a3cc8c", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"authorityOwner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract Authority\",\"name\":\"authority\",\"type\":\"address\"}],\"name\":\"AuthorityCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"calculateAuthorityAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"newAuthority\",\"outputs\":[{\"internalType\":\"contract Authority\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"}],\"name\":\"newAuthority\",\"outputs\":[{\"internalType\":\"contract Authority\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"AuthorityCreated(address,address)\":{\"details\":\"MUST be triggered on a successful call to `newAuthority`.\",\"params\":{\"authority\":\"The authority\",\"authorityOwner\":\"The initial authority owner\"}}},\"kind\":\"dev\",\"methods\":{\"calculateAuthorityAddress(address,bytes32)\":{\"details\":\"Beware that only the `newAuthority` function with the `_salt` parameter is able to deterministically deploy an authority.\",\"params\":{\"_authorityOwner\":\"The initial authority owner\",\"_salt\":\"The salt used to deterministically generate the authority address\"},\"returns\":{\"_0\":\"The deterministic authority address\"}},\"newAuthority(address)\":{\"details\":\"On success, MUST emit an `AuthorityCreated` event.\",\"params\":{\"_authorityOwner\":\"The initial authority owner\"},\"returns\":{\"_0\":\"The authority\"}},\"newAuthority(address,bytes32)\":{\"details\":\"On success, MUST emit an `AuthorityCreated` event.\",\"params\":{\"_authorityOwner\":\"The initial authority owner\",\"_salt\":\"The salt used to deterministically generate the authority address\"},\"returns\":{\"_0\":\"The authority\"}}},\"title\":\"Authority Factory\",\"version\":1},\"userdoc\":{\"events\":{\"AuthorityCreated(address,address)\":{\"notice\":\"A new authority was deployed.\"}},\"kind\":\"user\",\"methods\":{\"calculateAuthorityAddress(address,bytes32)\":{\"notice\":\"Calculate the address of an authority to be deployed deterministically.\"},\"newAuthority(address)\":{\"notice\":\"Deploy a new authority.\"},\"newAuthority(address,bytes32)\":{\"notice\":\"Deploy a new authority deterministically.\"}},\"notice\":\"Allows anyone to reliably deploy a new `Authority` contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/consensus/authority/AuthorityFactory.sol\":\"AuthorityFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\\n require(address(this).balance >= amount, \\\"Create2: insufficient balance\\\");\\n require(bytecode.length != 0, \\\"Create2: bytecode length is zero\\\");\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n require(addr != address(0), \\\"Create2: Failed on deploy\\\");\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6e00f269073ffc4350e56b7e8153c9092d5f70bfba423299990514183101ef89\",\"license\":\"MIT\"},\"contracts/consensus/AbstractConsensus.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IConsensus} from \\\"./IConsensus.sol\\\";\\n\\n/// @title Abstract Consensus\\n/// @notice An abstract contract that partially implements `IConsensus`.\\nabstract contract AbstractConsensus is IConsensus {\\n /// @notice Emits an `ApplicationJoined` event with the message sender.\\n function join() external override {\\n emit ApplicationJoined(msg.sender);\\n }\\n}\\n\",\"keccak256\":\"0xced9c940ccbbe81fbfcf3bc087c04b9ae90325d6bba68a8cee9ebfa3dd9d231d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/IConsensus.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @title Consensus interface\\n///\\n/// @notice This contract defines a generic interface for consensuses.\\n/// We use the word \\\"consensus\\\" to designate a contract that provides claims\\n/// in the base layer regarding the state of off-chain machines running in\\n/// the execution layer. How this contract is able to reach consensus, who is\\n/// able to submit claims, and how are claims stored in the base layer are\\n/// some of the implementation details left unspecified by this interface.\\n///\\n/// From the point of view of a DApp, these claims are necessary to validate\\n/// on-chain action allowed by the off-chain machine in the form of vouchers\\n/// and notices. Each claim is composed of three parts: an epoch hash, a first\\n/// index, and a last index. We'll explain each of these parts below.\\n///\\n/// First, let us define the word \\\"epoch\\\". For finality reasons, we need to\\n/// divide the stream of inputs being fed into the off-chain machine into\\n/// batches of inputs, which we call \\\"epoches\\\". At the end of every epoch,\\n/// we summarize the state of the off-chain machine in a single hash, called\\n/// \\\"epoch hash\\\". Please note that this interface does not define how this\\n/// stream of inputs is being chopped up into epoches.\\n///\\n/// The other two parts are simply the indices of the first and last inputs\\n/// accepted during the epoch. Logically, the first index MUST BE less than\\n/// or equal to the last index. As a result, every epoch MUST accept at least\\n/// one input. This assumption stems from the fact that the state of a machine\\n/// can only change after an input is fed into it.\\n///\\n/// Examples of possible implementations of this interface include:\\n///\\n/// * An authority consensus, controlled by a single address who has full\\n/// control over epoch boundaries, claim submission, asset management, etc.\\n///\\n/// * A quorum consensus, controlled by a limited set of validators, that\\n/// vote on the state of the machine at the end of every epoch. Also, epoch\\n/// boundaries are determined by the timestamp in the base layer, and assets\\n/// are split equally amongst the validators.\\n///\\n/// * An NxN consensus, which allows anyone to submit and dispute claims\\n/// in the base layer. Epoch boundaries are determined in the same fashion\\n/// as in the quorum example.\\n///\\ninterface IConsensus {\\n /// @notice An application has joined the consensus' validation set.\\n /// @param application The application\\n /// @dev MUST be triggered on a successful call to `join`.\\n event ApplicationJoined(address application);\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// The encoding of `_proofContext` might vary\\n /// depending on the implementation.\\n /// @param _dapp The DApp address\\n /// @param _proofContext Data for retrieving the desired claim\\n /// @return epochHash_ The claimed epoch hash\\n /// @return firstInputIndex_ The index of the first input of the epoch in the input box\\n /// @return lastInputIndex_ The index of the last input of the epoch in the input box\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n )\\n external\\n view\\n returns (\\n bytes32 epochHash_,\\n uint256 firstInputIndex_,\\n uint256 lastInputIndex_\\n );\\n\\n /// @notice Signal the consensus that the message sender wants to join its validation set.\\n /// @dev MUST fire an `ApplicationJoined` event with the message sender as argument.\\n function join() external;\\n}\\n\",\"keccak256\":\"0xc9d295fada66eb0602e0f1e2e236708e52f959927abb4ab6b04173a98b92ac16\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/Authority.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {IConsensus} from \\\"../IConsensus.sol\\\";\\nimport {AbstractConsensus} from \\\"../AbstractConsensus.sol\\\";\\nimport {IHistory} from \\\"../../history/IHistory.sol\\\";\\n\\n/// @title Authority consensus\\n/// @notice A consensus model controlled by a single address, the owner.\\n/// Claims are stored in an auxiliary contract called `History`.\\n/// @dev This contract inherits `AbstractConsensus` and OpenZeppelin's `Ownable` contract.\\n/// For more information on `Ownable`, please consult OpenZeppelin's official documentation.\\ncontract Authority is AbstractConsensus, Ownable {\\n /// @notice The current history contract.\\n /// @dev See the `getHistory` and `setHistory` functions.\\n IHistory internal history;\\n\\n /// @notice A new history contract is used to store claims.\\n /// @param history The new history contract\\n /// @dev MUST be triggered on a successful call to `setHistory`.\\n event NewHistory(IHistory history);\\n\\n /// @notice Raised when a transfer of tokens from an authority to a recipient fails.\\n error AuthorityWithdrawalFailed();\\n\\n /// @notice Constructs an `Authority` contract.\\n /// @param _owner The initial contract owner\\n constructor(address _owner) {\\n // constructor in Ownable already called `transferOwnership(msg.sender)`, so\\n // we only need to call `transferOwnership(_owner)` if _owner != msg.sender\\n if (msg.sender != _owner) {\\n transferOwnership(_owner);\\n }\\n }\\n\\n /// @notice Submits a claim to the current history contract.\\n /// The encoding of `_claimData` might vary depending on the\\n /// implementation of the current history contract.\\n /// @param _claimData Data for submitting a claim\\n /// @dev Can only be called by the `Authority` owner,\\n /// and the `Authority` contract must have ownership over\\n /// its current history contract.\\n function submitClaim(bytes calldata _claimData) external onlyOwner {\\n history.submitClaim(_claimData);\\n }\\n\\n /// @notice Transfer ownership over the current history contract to `_consensus`.\\n /// @param _consensus The new owner of the current history contract\\n /// @dev Can only be called by the `Authority` owner,\\n /// and the `Authority` contract must have ownership over\\n /// its current history contract.\\n function migrateHistoryToConsensus(address _consensus) external onlyOwner {\\n history.migrateToConsensus(_consensus);\\n }\\n\\n /// @notice Make `Authority` point to another history contract.\\n /// @param _history The new history contract\\n /// @dev Emits a `NewHistory` event.\\n /// Can only be called by the `Authority` owner.\\n function setHistory(IHistory _history) external onlyOwner {\\n history = _history;\\n emit NewHistory(_history);\\n }\\n\\n /// @notice Get the current history contract.\\n /// @return The current history contract\\n function getHistory() external view returns (IHistory) {\\n return history;\\n }\\n\\n /// @notice Get a claim from the current history.\\n /// The encoding of `_proofContext` might vary depending on the\\n /// implementation of the current history contract.\\n /// @inheritdoc IConsensus\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n ) external view override returns (bytes32, uint256, uint256) {\\n return history.getClaim(_dapp, _proofContext);\\n }\\n\\n /// @notice Transfer some amount of ERC-20 tokens to a recipient.\\n /// @param _token The token contract\\n /// @param _recipient The recipient address\\n /// @param _amount The amount of tokens to be withdrawn\\n /// @dev Can only be called by the `Authority` owner.\\n function withdrawERC20Tokens(\\n IERC20 _token,\\n address _recipient,\\n uint256 _amount\\n ) external onlyOwner {\\n bool success = _token.transfer(_recipient, _amount);\\n\\n if (!success) {\\n revert AuthorityWithdrawalFailed();\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc71ea13163833684ce576861fbb19dc40e7096a022c6976b61a99dfc9e1c0903\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/AuthorityFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Create2} from \\\"@openzeppelin/contracts/utils/Create2.sol\\\";\\n\\nimport {IAuthorityFactory} from \\\"./IAuthorityFactory.sol\\\";\\nimport {Authority} from \\\"./Authority.sol\\\";\\n\\n/// @title Authority Factory\\n/// @notice Allows anyone to reliably deploy a new `Authority` contract.\\ncontract AuthorityFactory is IAuthorityFactory {\\n function newAuthority(\\n address _authorityOwner\\n ) external override returns (Authority) {\\n Authority authority = new Authority(_authorityOwner);\\n\\n emit AuthorityCreated(_authorityOwner, authority);\\n\\n return authority;\\n }\\n\\n function newAuthority(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external override returns (Authority) {\\n Authority authority = new Authority{salt: _salt}(_authorityOwner);\\n\\n emit AuthorityCreated(_authorityOwner, authority);\\n\\n return authority;\\n }\\n\\n function calculateAuthorityAddress(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external view override returns (address) {\\n return\\n Create2.computeAddress(\\n _salt,\\n keccak256(\\n abi.encodePacked(\\n type(Authority).creationCode,\\n abi.encode(_authorityOwner)\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x1b78c9693cfd7df3833c6ea1c18d767a10167f4bf6ac8ea883c74e7da281f418\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/IAuthorityFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Authority} from \\\"./Authority.sol\\\";\\n\\n/// @title Authority Factory interface\\ninterface IAuthorityFactory {\\n // Events\\n\\n /// @notice A new authority was deployed.\\n /// @param authorityOwner The initial authority owner\\n /// @param authority The authority\\n /// @dev MUST be triggered on a successful call to `newAuthority`.\\n event AuthorityCreated(address authorityOwner, Authority authority);\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new authority.\\n /// @param _authorityOwner The initial authority owner\\n /// @return The authority\\n /// @dev On success, MUST emit an `AuthorityCreated` event.\\n function newAuthority(address _authorityOwner) external returns (Authority);\\n\\n /// @notice Deploy a new authority deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority address\\n /// @return The authority\\n /// @dev On success, MUST emit an `AuthorityCreated` event.\\n function newAuthority(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external returns (Authority);\\n\\n /// @notice Calculate the address of an authority to be deployed deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority address\\n /// @return The deterministic authority address\\n /// @dev Beware that only the `newAuthority` function with the `_salt` parameter\\n /// is able to deterministically deploy an authority.\\n function calculateAuthorityAddress(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x149bcdf9641b337836263196aabb655e69902212ede21becedd9c08b5b304717\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/history/IHistory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @title History interface\\ninterface IHistory {\\n // Permissioned functions\\n\\n /// @notice Submit a claim.\\n /// The encoding of `_claimData` might vary\\n /// depending on the history implementation.\\n /// @param _claimData Data for submitting a claim\\n /// @dev Should have access control.\\n function submitClaim(bytes calldata _claimData) external;\\n\\n /// @notice Transfer ownership to another consensus.\\n /// @param _consensus The new consensus\\n /// @dev Should have access control.\\n function migrateToConsensus(address _consensus) external;\\n\\n // Permissionless functions\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// The encoding of `_proofContext` might vary\\n /// depending on the history implementation.\\n /// @param _dapp The DApp address\\n /// @param _proofContext Data for retrieving the desired claim\\n /// @return epochHash_ The claimed epoch hash\\n /// @return firstInputIndex_ The index of the first input of the epoch in the input box\\n /// @return lastInputIndex_ The index of the last input of the epoch in the input box\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n )\\n external\\n view\\n returns (\\n bytes32 epochHash_,\\n uint256 firstInputIndex_,\\n uint256 lastInputIndex_\\n );\\n}\\n\",\"keccak256\":\"0x1378cbc831833abae8e2a565b88899d6416ea1208aa9724bd4df28e74848ffcf\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50610cb5806100206000396000f3fe608060405234801561001057600080fd5b50600436106100405760003560e01c80629c5784146100455780635a3f27d314610074578063b3a51b8414610087575b600080fd5b610058610053366004610288565b61009a565b6040516001600160a01b03909116815260200160405180910390f35b610058610082366004610288565b610115565b6100586100953660046102b2565b6101a4565b600061010e82604051806020016100b09061025f565b601f1982820381018352601f9091011660408181526001600160a01b03881660208301520160408051601f19818403018152908290526100f392916020016102fd565b6040516020818303038152906040528051906020012061022d565b9392505050565b60008082846040516101269061025f565b6001600160a01b0390911681526020018190604051809103906000f5905080158015610156573d6000803e3d6000fd5b50604080516001600160a01b038088168252831660208201529192507f0fb2d916aa6a78060ff9e89d89d62797c6668818dec04969013c5098754380ec910160405180910390a19392505050565b600080826040516101b49061025f565b6001600160a01b039091168152602001604051809103906000f0801580156101e0573d6000803e3d6000fd5b50604080516001600160a01b038087168252831660208201529192507f0fb2d916aa6a78060ff9e89d89d62797c6668818dec04969013c5098754380ec910160405180910390a192915050565b600061010e8383306000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b6109658061031b83390190565b80356001600160a01b038116811461028357600080fd5b919050565b6000806040838503121561029b57600080fd5b6102a48361026c565b946020939093013593505050565b6000602082840312156102c457600080fd5b61010e8261026c565b6000815160005b818110156102ee57602081850181015186830152016102d4565b50600093019283525090919050565b600061031261030c83866102cd565b846102cd565b94935050505056fe608060405234801561001057600080fd5b5060405161096538038061096583398101604081905261002f91610181565b61003833610057565b336001600160a01b0382161461005157610051816100a7565b506101b1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6100af610125565b6001600160a01b0381166101195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61012281610057565b50565b6000546001600160a01b0316331461017f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610110565b565b60006020828403121561019357600080fd5b81516001600160a01b03811681146101aa57600080fd5b9392505050565b6107a5806101c06000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063b688a36311610066578063b688a3631461010e578063bcdd1e1314610116578063d79a824014610129578063ddfdfbb014610157578063f2fde38b1461016a57600080fd5b8063159c5ea1146100a3578063715018a6146100b85780638da5cb5b146100c05780639368a3d3146100ea578063aa15efc8146100fd575b600080fd5b6100b66100b1366004610567565b61017d565b005b6100b66101d9565b6000546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b6100b66100f8366004610567565b6101ed565b6001546001600160a01b03166100cd565b6100b6610257565b6100b661012436600461058b565b61028c565b61013c610137366004610615565b610331565b604080519384526020840192909252908201526060016100e1565b6100b661016536600461066a565b6103ba565b6100b6610178366004610567565b61042a565b6101856104a8565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f2bcd43869347a1d42f97ac6042f3d129817abd05a6125f9750fe3724e321d23e9060200160405180910390a150565b6101e16104a8565b6101eb6000610502565b565b6101f56104a8565b60015460405163fc41168360e01b81526001600160a01b0383811660048301529091169063fc41168390602401600060405180830381600087803b15801561023c57600080fd5b505af1158015610250573d6000803e3d6000fd5b5050505050565b6040513381527f27c2b702d3bff195a18baca2daf00b20a986177c5f1449af4e2d46a3c3e02ce59060200160405180910390a1565b6102946104a8565b60405163a9059cbb60e01b81526001600160a01b038381166004830152602482018390526000919085169063a9059cbb906044016020604051808303816000875af11580156102e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030b91906106ac565b90508061032b5760405163099e1ca760e11b815260040160405180910390fd5b50505050565b60015460405163035e6a0960e61b8152600091829182916001600160a01b03169063d79a82409061036a908990899089906004016106f7565b606060405180830381865afa158015610387573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ab9190610725565b92509250925093509350939050565b6103c26104a8565b600154604051630ddfdfbb60e41b81526001600160a01b039091169063ddfdfbb0906103f49085908590600401610753565b600060405180830381600087803b15801561040e57600080fd5b505af1158015610422573d6000803e3d6000fd5b505050505050565b6104326104a8565b6001600160a01b03811661049c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6104a581610502565b50565b6000546001600160a01b031633146101eb5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610493565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146104a557600080fd5b60006020828403121561057957600080fd5b813561058481610552565b9392505050565b6000806000606084860312156105a057600080fd5b83356105ab81610552565b925060208401356105bb81610552565b929592945050506040919091013590565b60008083601f8401126105de57600080fd5b50813567ffffffffffffffff8111156105f657600080fd5b60208301915083602082850101111561060e57600080fd5b9250929050565b60008060006040848603121561062a57600080fd5b833561063581610552565b9250602084013567ffffffffffffffff81111561065157600080fd5b61065d868287016105cc565b9497909650939450505050565b6000806020838503121561067d57600080fd5b823567ffffffffffffffff81111561069457600080fd5b6106a0858286016105cc565b90969095509350505050565b6000602082840312156106be57600080fd5b8151801515811461058457600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038416815260406020820181905260009061071c90830184866106ce565b95945050505050565b60008060006060848603121561073a57600080fd5b8351925060208401519150604084015190509250925092565b6020815260006107676020830184866106ce565b94935050505056fea2646970667358221220c0785a1cc37ffa8f096145bce62f62d9cae719c200dba5e33a279c7f0894965164736f6c63430008130033a26469706673582212202de7e9a1b007ca2f3a7a6c53b2972dc3f889e83efde5ce289389b45306e1fe7864736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100405760003560e01c80629c5784146100455780635a3f27d314610074578063b3a51b8414610087575b600080fd5b610058610053366004610288565b61009a565b6040516001600160a01b03909116815260200160405180910390f35b610058610082366004610288565b610115565b6100586100953660046102b2565b6101a4565b600061010e82604051806020016100b09061025f565b601f1982820381018352601f9091011660408181526001600160a01b03881660208301520160408051601f19818403018152908290526100f392916020016102fd565b6040516020818303038152906040528051906020012061022d565b9392505050565b60008082846040516101269061025f565b6001600160a01b0390911681526020018190604051809103906000f5905080158015610156573d6000803e3d6000fd5b50604080516001600160a01b038088168252831660208201529192507f0fb2d916aa6a78060ff9e89d89d62797c6668818dec04969013c5098754380ec910160405180910390a19392505050565b600080826040516101b49061025f565b6001600160a01b039091168152602001604051809103906000f0801580156101e0573d6000803e3d6000fd5b50604080516001600160a01b038087168252831660208201529192507f0fb2d916aa6a78060ff9e89d89d62797c6668818dec04969013c5098754380ec910160405180910390a192915050565b600061010e8383306000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b6109658061031b83390190565b80356001600160a01b038116811461028357600080fd5b919050565b6000806040838503121561029b57600080fd5b6102a48361026c565b946020939093013593505050565b6000602082840312156102c457600080fd5b61010e8261026c565b6000815160005b818110156102ee57602081850181015186830152016102d4565b50600093019283525090919050565b600061031261030c83866102cd565b846102cd565b94935050505056fe608060405234801561001057600080fd5b5060405161096538038061096583398101604081905261002f91610181565b61003833610057565b336001600160a01b0382161461005157610051816100a7565b506101b1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6100af610125565b6001600160a01b0381166101195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61012281610057565b50565b6000546001600160a01b0316331461017f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610110565b565b60006020828403121561019357600080fd5b81516001600160a01b03811681146101aa57600080fd5b9392505050565b6107a5806101c06000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063b688a36311610066578063b688a3631461010e578063bcdd1e1314610116578063d79a824014610129578063ddfdfbb014610157578063f2fde38b1461016a57600080fd5b8063159c5ea1146100a3578063715018a6146100b85780638da5cb5b146100c05780639368a3d3146100ea578063aa15efc8146100fd575b600080fd5b6100b66100b1366004610567565b61017d565b005b6100b66101d9565b6000546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b6100b66100f8366004610567565b6101ed565b6001546001600160a01b03166100cd565b6100b6610257565b6100b661012436600461058b565b61028c565b61013c610137366004610615565b610331565b604080519384526020840192909252908201526060016100e1565b6100b661016536600461066a565b6103ba565b6100b6610178366004610567565b61042a565b6101856104a8565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f2bcd43869347a1d42f97ac6042f3d129817abd05a6125f9750fe3724e321d23e9060200160405180910390a150565b6101e16104a8565b6101eb6000610502565b565b6101f56104a8565b60015460405163fc41168360e01b81526001600160a01b0383811660048301529091169063fc41168390602401600060405180830381600087803b15801561023c57600080fd5b505af1158015610250573d6000803e3d6000fd5b5050505050565b6040513381527f27c2b702d3bff195a18baca2daf00b20a986177c5f1449af4e2d46a3c3e02ce59060200160405180910390a1565b6102946104a8565b60405163a9059cbb60e01b81526001600160a01b038381166004830152602482018390526000919085169063a9059cbb906044016020604051808303816000875af11580156102e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030b91906106ac565b90508061032b5760405163099e1ca760e11b815260040160405180910390fd5b50505050565b60015460405163035e6a0960e61b8152600091829182916001600160a01b03169063d79a82409061036a908990899089906004016106f7565b606060405180830381865afa158015610387573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ab9190610725565b92509250925093509350939050565b6103c26104a8565b600154604051630ddfdfbb60e41b81526001600160a01b039091169063ddfdfbb0906103f49085908590600401610753565b600060405180830381600087803b15801561040e57600080fd5b505af1158015610422573d6000803e3d6000fd5b505050505050565b6104326104a8565b6001600160a01b03811661049c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6104a581610502565b50565b6000546001600160a01b031633146101eb5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610493565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146104a557600080fd5b60006020828403121561057957600080fd5b813561058481610552565b9392505050565b6000806000606084860312156105a057600080fd5b83356105ab81610552565b925060208401356105bb81610552565b929592945050506040919091013590565b60008083601f8401126105de57600080fd5b50813567ffffffffffffffff8111156105f657600080fd5b60208301915083602082850101111561060e57600080fd5b9250929050565b60008060006040848603121561062a57600080fd5b833561063581610552565b9250602084013567ffffffffffffffff81111561065157600080fd5b61065d868287016105cc565b9497909650939450505050565b6000806020838503121561067d57600080fd5b823567ffffffffffffffff81111561069457600080fd5b6106a0858286016105cc565b90969095509350505050565b6000602082840312156106be57600080fd5b8151801515811461058457600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038416815260406020820181905260009061071c90830184866106ce565b95945050505050565b60008060006060848603121561073a57600080fd5b8351925060208401519150604084015190509250925092565b6020815260006107676020830184866106ce565b94935050505056fea2646970667358221220c0785a1cc37ffa8f096145bce62f62d9cae719c200dba5e33a279c7f0894965164736f6c63430008130033a26469706673582212202de7e9a1b007ca2f3a7a6c53b2972dc3f889e83efde5ce289389b45306e1fe7864736f6c63430008130033", - "devdoc": { - "events": { - "AuthorityCreated(address,address)": { - "details": "MUST be triggered on a successful call to `newAuthority`.", - "params": { - "authority": "The authority", - "authorityOwner": "The initial authority owner" - } - } - }, - "kind": "dev", - "methods": { - "calculateAuthorityAddress(address,bytes32)": { - "details": "Beware that only the `newAuthority` function with the `_salt` parameter is able to deterministically deploy an authority.", - "params": { - "_authorityOwner": "The initial authority owner", - "_salt": "The salt used to deterministically generate the authority address" - }, - "returns": { - "_0": "The deterministic authority address" - } - }, - "newAuthority(address)": { - "details": "On success, MUST emit an `AuthorityCreated` event.", - "params": { - "_authorityOwner": "The initial authority owner" - }, - "returns": { - "_0": "The authority" - } - }, - "newAuthority(address,bytes32)": { - "details": "On success, MUST emit an `AuthorityCreated` event.", - "params": { - "_authorityOwner": "The initial authority owner", - "_salt": "The salt used to deterministically generate the authority address" - }, - "returns": { - "_0": "The authority" - } - } - }, - "title": "Authority Factory", - "version": 1 - }, - "userdoc": { - "events": { - "AuthorityCreated(address,address)": { - "notice": "A new authority was deployed." - } - }, - "kind": "user", - "methods": { - "calculateAuthorityAddress(address,bytes32)": { - "notice": "Calculate the address of an authority to be deployed deterministically." - }, - "newAuthority(address)": { - "notice": "Deploy a new authority." - }, - "newAuthority(address,bytes32)": { - "notice": "Deploy a new authority deterministically." - } - }, - "notice": "Allows anyone to reliably deploy a new `Authority` contract.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/deployments/optimism/CartesiDAppFactory.json b/deployments/optimism/CartesiDAppFactory.json deleted file mode 100644 index 1cc17ac5b..000000000 --- a/deployments/optimism/CartesiDAppFactory.json +++ /dev/null @@ -1,237 +0,0 @@ -{ - "address": "0x7122cd1221C20892234186facfE8615e6743Ab02", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "contract IConsensus", - "name": "consensus", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "dappOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "templateHash", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "contract CartesiDApp", - "name": "application", - "type": "address" - } - ], - "name": "ApplicationCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "contract IConsensus", - "name": "_consensus", - "type": "address" - }, - { - "internalType": "address", - "name": "_dappOwner", - "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": "_dappOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_templateHash", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newApplication", - "outputs": [ - { - "internalType": "contract CartesiDApp", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IConsensus", - "name": "_consensus", - "type": "address" - }, - { - "internalType": "address", - "name": "_dappOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_templateHash", - "type": "bytes32" - } - ], - "name": "newApplication", - "outputs": [ - { - "internalType": "contract CartesiDApp", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0x5026ea3190d288f4fba80087fd41895932edafc5eedb1306acc0300cbca9fe18", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 7, - "gasUsed": "1545878", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x2959c9aa19ec52cd607f838a8af3c13386cae5d79cdc70b857a66c3c83ab8df8", - "transactionHash": "0x5026ea3190d288f4fba80087fd41895932edafc5eedb1306acc0300cbca9fe18", - "logs": [], - "blockNumber": 107433016, - "cumulativeGasUsed": "2248427", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 1, - "solcInputHash": "d2696284402b6703b2d41170c93ef3b7", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IConsensus\",\"name\":\"consensus\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"dappOwner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"templateHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"contract CartesiDApp\",\"name\":\"application\",\"type\":\"address\"}],\"name\":\"ApplicationCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"contract IConsensus\",\"name\":\"_consensus\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_dappOwner\",\"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\":\"_dappOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_templateHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"newApplication\",\"outputs\":[{\"internalType\":\"contract CartesiDApp\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IConsensus\",\"name\":\"_consensus\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_dappOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_templateHash\",\"type\":\"bytes32\"}],\"name\":\"newApplication\",\"outputs\":[{\"internalType\":\"contract CartesiDApp\",\"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\":{\"application\":\"The application\",\"consensus\":\"The initial consensus contract\",\"dappOwner\":\"The initial DApp owner\",\"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\":{\"_consensus\":\"The initial consensus contract\",\"_dappOwner\":\"The initial DApp owner\",\"_salt\":\"The salt used to deterministically generate the DApp address\",\"_templateHash\":\"The initial machine state hash\"},\"returns\":{\"_0\":\"The deterministic application address\"}},\"newApplication(address,address,bytes32)\":{\"details\":\"On success, MUST emit an `ApplicationCreated` event.\",\"params\":{\"_consensus\":\"The initial consensus contract\",\"_dappOwner\":\"The initial DApp owner\",\"_templateHash\":\"The initial machine state hash\"},\"returns\":{\"_0\":\"The application\"}},\"newApplication(address,address,bytes32,bytes32)\":{\"details\":\"On success, MUST emit an `ApplicationCreated` event.\",\"params\":{\"_consensus\":\"The initial consensus contract\",\"_dappOwner\":\"The initial DApp owner\",\"_salt\":\"The salt used to deterministically generate the DApp address\",\"_templateHash\":\"The initial machine state hash\"},\"returns\":{\"_0\":\"The application\"}}},\"title\":\"Cartesi DApp 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 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 `CartesiDApp` contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dapp/CartesiDAppFactory.sol\":\"CartesiDAppFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@cartesi/util/contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"},\"@cartesi/util/contracts/CartesiMathV2.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\n/// @title CartesiMath\\n/// @author Felipe Argento\\npragma solidity ^0.8.0;\\n\\nlibrary CartesiMathV2 {\\n // mapping values are packed as bytes3 each\\n // see test/TestCartesiMath.ts for decimal values\\n bytes constant log2tableTimes1M =\\n hex\\\"0000000F4240182F421E8480236E082771822AD63A2DC6C0305E8532B04834C96736B3C23876D73A187A3B9D4A3D09003E5EA63FA0C540D17741F28843057D440BA745062945F60246DC1047B917488DC7495ABA4A207C4ADF8A4B98544C4B404CF8AA4DA0E64E44434EE3054F7D6D5013B750A61A5134C851BFF05247BD52CC58534DE753CC8D54486954C19C55384255AC75561E50568DE956FB575766B057D00758376F589CFA5900BA5962BC59C3135A21CA5A7EF15ADA945B34BF5B8D805BE4DF5C3AEA5C8FA95CE3265D356C5D86835DD6735E25455E73005EBFAD5F0B525F55F75F9FA25FE85A60302460770860BD0A61023061467F6189FD61CCAE620E98624FBF62902762CFD5630ECD634D12638AA963C7966403DC643F7F647A8264B4E864EEB56527EC6560906598A365D029660724663D9766738566A8F066DDDA6712476746386779AF67ACAF67DF3A6811526842FA68743268A4FC68D55C6905536934E169640A6992CF69C13169EF326A1CD46A4A186A76FF6AA38C6ACFC0\\\";\\n\\n /// @notice Approximates log2 * 1M\\n /// @param _num number to take log2 * 1M of\\n /// @return approximate log2 times 1M\\n function log2ApproxTimes1M(uint256 _num) public pure returns (uint256) {\\n require(_num > 0, \\\"Number cannot be zero\\\");\\n uint256 leading = 0;\\n\\n if (_num == 1) return 0;\\n\\n while (_num > 128) {\\n _num = _num >> 1;\\n leading += 1;\\n }\\n return (leading * uint256(1000000)) + (getLog2TableTimes1M(_num));\\n }\\n\\n /// @notice navigates log2tableTimes1M\\n /// @param _num number to take log2 of\\n /// @return result after table look-up\\n function getLog2TableTimes1M(uint256 _num) public pure returns (uint256) {\\n bytes3 result = 0;\\n for (uint8 i = 0; i < 3; i++) {\\n bytes3 tempResult = log2tableTimes1M[(_num - 1) * 3 + i];\\n result = result | (tempResult >> (i * 8));\\n }\\n\\n return uint256(uint24(result));\\n }\\n\\n /// @notice get floor of log2 of number\\n /// @param _num number to take floor(log2) of\\n /// @return floor(log2) of _num\\n function getLog2Floor(uint256 _num) public pure returns (uint8) {\\n require(_num != 0, \\\"log of zero is undefined\\\");\\n\\n return uint8(255 - clz(_num));\\n }\\n\\n /// @notice checks if a number is Power of 2\\n /// @param _num number to check\\n /// @return true if number is power of 2, false if not\\n function isPowerOf2(uint256 _num) public pure returns (bool) {\\n if (_num == 0) return false;\\n\\n return _num & (_num - 1) == 0;\\n }\\n\\n /// @notice count trailing zeros\\n /// @param _num number you want the ctz of\\n /// @dev this a binary search implementation\\n function ctz(uint256 _num) public pure returns (uint256) {\\n if (_num == 0) return 256;\\n\\n uint256 n = 0;\\n if (_num & 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF == 0) {\\n n = n + 128;\\n _num = _num >> 128;\\n }\\n if (_num & 0x000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFF == 0) {\\n n = n + 64;\\n _num = _num >> 64;\\n }\\n if (_num & 0x00000000000000000000000000000000000000000000000000000000FFFFFFFF == 0) {\\n n = n + 32;\\n _num = _num >> 32;\\n }\\n if (_num & 0x000000000000000000000000000000000000000000000000000000000000FFFF == 0) {\\n n = n + 16;\\n _num = _num >> 16;\\n }\\n if (_num & 0x00000000000000000000000000000000000000000000000000000000000000FF == 0) {\\n n = n + 8;\\n _num = _num >> 8;\\n }\\n if (_num & 0x000000000000000000000000000000000000000000000000000000000000000F == 0) {\\n n = n + 4;\\n _num = _num >> 4;\\n }\\n if (_num & 0x0000000000000000000000000000000000000000000000000000000000000003 == 0) {\\n n = n + 2;\\n _num = _num >> 2;\\n }\\n if (_num & 0x0000000000000000000000000000000000000000000000000000000000000001 == 0) {\\n n = n + 1;\\n }\\n\\n return n;\\n }\\n\\n /// @notice count leading zeros\\n /// @param _num number you want the clz of\\n /// @dev this a binary search implementation\\n function clz(uint256 _num) public pure returns (uint256) {\\n if (_num == 0) return 256;\\n\\n uint256 n = 0;\\n if (_num & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000 == 0) {\\n n = n + 128;\\n _num = _num << 128;\\n }\\n if (_num & 0xFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 64;\\n _num = _num << 64;\\n }\\n if (_num & 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 32;\\n _num = _num << 32;\\n }\\n if (_num & 0xFFFF000000000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 16;\\n _num = _num << 16;\\n }\\n if (_num & 0xFF00000000000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 8;\\n _num = _num << 8;\\n }\\n if (_num & 0xF000000000000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 4;\\n _num = _num << 4;\\n }\\n if (_num & 0xC000000000000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 2;\\n _num = _num << 2;\\n }\\n if (_num & 0x8000000000000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 1;\\n }\\n\\n return n;\\n }\\n}\\n\",\"keccak256\":\"0x98fb8d20c05b7c39c44171b6c524cf023da646749eb90157463538da8b2e13d3\",\"license\":\"Apache-2.0\"},\"@cartesi/util/contracts/MerkleV2.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\n/// @title Library for Merkle proofs\\npragma solidity ^0.8.0;\\n\\nimport \\\"./CartesiMathV2.sol\\\";\\n\\nlibrary MerkleV2 {\\n using CartesiMathV2 for uint256;\\n\\n uint128 constant L_WORD_SIZE = 3; // word = 8 bytes, log = 3\\n // number of hashes in EMPTY_TREE_HASHES\\n uint128 constant EMPTY_TREE_SIZE = 1952; // 61*32=1952. 32 bytes per 61 indexes (64 words)\\n\\n // merkle root hashes of trees of zero concatenated\\n // 32 bytes for each root, first one is keccak(0), second one is\\n // keccak(keccack(0), keccak(0)) and so on\\n\\n bytes constant EMPTY_TREE_HASHES =\\n hex\\\"011b4d03dd8c01f1049143cf9c4c817e4b167f1d1b83e5c6f0f10d89ba1e7bce4d9470a821fbe90117ec357e30bad9305732fb19ddf54a07dd3e29f440619254ae39ce8537aca75e2eff3e38c98011dfe934e700a0967732fc07b430dd656a233fc9a15f5b4869c872f81087bb6104b7d63e6f9ab47f2c43f3535eae7172aa7f17d2dd614cddaa4d879276b11e0672c9560033d3e8453a1d045339d34ba601b9c37b8b13ca95166fb7af16988a70fcc90f38bf9126fd833da710a47fb37a55e68e7a427fa943d9966b389f4f257173676090c6e95f43e2cb6d65f8758111e30930b0b9deb73e155c59740bacf14a6ff04b64bb8e201a506409c3fe381ca4ea90cd5deac729d0fdaccc441d09d7325f41586ba13c801b7eccae0f95d8f3933efed8b96e5b7f6f459e9cb6a2f41bf276c7b85c10cd4662c04cbbb365434726c0a0c9695393027fb106a8153109ac516288a88b28a93817899460d6310b71cf1e6163e8806fa0d4b197a259e8c3ac28864268159d0ac85f8581ca28fa7d2c0c03eb91e3eee5ca7a3da2b3053c9770db73599fb149f620e3facef95e947c0ee860b72122e31e4bbd2b7c783d79cc30f60c6238651da7f0726f767d22747264fdb046f7549f26cc70ed5e18baeb6c81bb0625cb95bb4019aeecd40774ee87ae29ec517a71f6ee264c5d761379b3d7d617ca83677374b49d10aec50505ac087408ca892b573c267a712a52e1d06421fe276a03efb1889f337201110fdc32a81f8e152499af665835aabfdc6740c7e2c3791a31c3cdc9f5ab962f681b12fc092816a62f27d86025599a41233848702f0cfc0437b445682df51147a632a0a083d2d38b5e13e466a8935afff58bb533b3ef5d27fba63ee6b0fd9e67ff20af9d50deee3f8bf065ec220c1fd4ba57e341261d55997f85d66d32152526736872693d2b437a233e2337b715f6ac9a6a272622fdc2d67fcfe1da3459f8dab4ed7e40a657a54c36766c5e8ac9a88b35b05c34747e6507f6b044ab66180dc76ac1a696de03189593fedc0d0dbbd855c8ead673544899b0960e4a5a7ca43b4ef90afe607de7698caefdc242788f654b57a4fb32a71b335ef6ff9a4cc118b282b53bdd6d6192b7a82c3c5126b9c7e33c8e5a5ac9738b8bd31247fb7402054f97b573e8abb9faad219f4fd085aceaa7f542d787ee4196d365f3cc566e7bbcfbfd451230c48d804c017d21e2d8fa914e2559bb72bf0ab78c8ab92f00ef0d0d576eccdd486b64138a4172674857e543d1d5b639058dd908186597e366ad5f3d9c7ceaff44d04d1550b8d33abc751df07437834ba5acb32328a396994aebb3c40f759c2d6d7a3cb5377e55d5d218ef5a296dda8ddc355f3f50c3d0b660a51dfa4d98a6a5a33564556cf83c1373a814641d6a1dcef97b883fee61bb84fe60a3409340217e629cc7e4dcc93b85d8820921ff5826148b60e6939acd7838e1d7f20562bff8ee4b5ec4a05ad997a57b9796fdcb2eda87883c2640b072b140b946bfdf6575cacc066fdae04f6951e63624cbd316a677cad529bbe4e97b9144e4bc06c4afd1de55dd3e1175f90423847a230d34dfb71ed56f2965a7f6c72e6aa33c24c303fd67745d632656c5ef90bec80f4f5d1daa251988826cef375c81c36bf457e09687056f924677cb0bccf98dff81e014ce25f2d132497923e267363963cdf4302c5049d63131dc03fd95f65d8b6aa5934f817252c028c90f56d413b9d5d10d89790707dae2fabb249f649929927c21dd71e3f656826de5451c5da375aadecbd59d5ebf3a31fae65ac1b316a1611f1b276b26530f58d7247df459ce1f86db1d734f6f811932f042cee45d0e455306d01081bc3384f82c5fb2aacaa19d89cdfa46cc916eac61121475ba2e6191b4feecbe1789717021a158ace5d06744b40f551076b67cd63af60007f8c99876e1424883a45ec49d497ddaf808a5521ca74a999ab0b3c7aa9c80f85e93977ec61ce68b20307a1a81f71ca645b568fcd319ccbb5f651e87b707d37c39e15f945ea69e2f7c7d2ccc85b7e654c07e96f0636ae4044fe0e38590b431795ad0f8647bdd613713ada493cc17efd313206380e6a685b8198475bbd021c6e9d94daab2214947127506073e44d5408ba166c512a0b86805d07f5a44d3c41706be2bc15e712e55805248b92e8677d90f6d284d1d6ffaff2c430657042a0e82624fa3717b06cc0a6fd12230ea586dae83019fb9e06034ed2803c98d554b93c9a52348cafff75c40174a91f9ae6b8647854a156029f0b88b83316663ce574a4978277bb6bb27a31085634b6ec78864b6d8201c7e93903d75815067e378289a3d072ae172dafa6a452470f8d645bebfad9779594fc0784bb764a22e3a8181d93db7bf97893c414217a618ccb14caa9e92e8c61673afc9583662e812adba1f87a9c68202d60e909efab43c42c0cb00695fc7f1ffe67c75ca894c3c51e1e5e731360199e600f6ced9a87b2a6a87e70bf251bb5075ab222138288164b2eda727515ea7de12e2496d4fe42ea8d1a120c03cf9c50622c2afe4acb0dad98fd62d07ab4e828a94495f6d1ab973982c7ccbe6c1fae02788e4422ae22282fa49cbdb04ba54a7a238c6fc41187451383460762c06d1c8a72b9cd718866ad4b689e10c9a8c38fe5ef045bd785b01e980fc82c7e3532ce81876b778dd9f1ceeba4478e86411fb6fdd790683916ca832592485093644e8760cd7b4c01dba1ccc82b661bf13f0e3f34acd6b88\\\";\\n\\n /// @notice Gets merkle root hash of drive with a replacement\\n /// @param _position position of _drive\\n /// @param _logSizeOfReplacement log2 of size the replacement\\n /// @param _logSizeOfFullDrive log2 of size the full drive, which can be the entire machine\\n /// @param _replacement hash of the replacement\\n /// @param siblings of replacement that merkle root can be calculated\\n function getRootAfterReplacementInDrive(\\n uint256 _position,\\n uint256 _logSizeOfReplacement,\\n uint256 _logSizeOfFullDrive,\\n bytes32 _replacement,\\n bytes32[] calldata siblings\\n ) public pure returns (bytes32) {\\n require(\\n _logSizeOfFullDrive >= _logSizeOfReplacement && _logSizeOfReplacement >= 3 && _logSizeOfFullDrive <= 64,\\n \\\"3 <= logSizeOfReplacement <= logSizeOfFullDrive <= 64\\\"\\n );\\n\\n uint256 size = 1 << _logSizeOfReplacement;\\n\\n require(((size - 1) & _position) == 0, \\\"Position is not aligned\\\");\\n require(siblings.length == _logSizeOfFullDrive - _logSizeOfReplacement, \\\"Proof length does not match\\\");\\n\\n for (uint256 i; i < siblings.length; i++) {\\n if ((_position & (size << i)) == 0) {\\n _replacement = keccak256(abi.encodePacked(_replacement, siblings[i]));\\n } else {\\n _replacement = keccak256(abi.encodePacked(siblings[i], _replacement));\\n }\\n }\\n\\n return _replacement;\\n }\\n\\n /// @notice Gets precomputed hash of zero in empty tree hashes\\n /// @param _index of hash wanted\\n /// @dev first index is keccak(0), second index is keccak(keccak(0), keccak(0))\\n function getEmptyTreeHashAtIndex(uint256 _index) public pure returns (bytes32) {\\n uint256 start = _index * 32;\\n require(EMPTY_TREE_SIZE >= start + 32, \\\"index out of bounds\\\");\\n bytes32 hashedZeros;\\n bytes memory zeroTree = EMPTY_TREE_HASHES;\\n\\n // first word is length, then skip index words\\n assembly {\\n hashedZeros := mload(add(add(zeroTree, 0x20), start))\\n }\\n return hashedZeros;\\n }\\n\\n /// @notice get merkle root of generic array of bytes\\n /// @param _data array of bytes to be merklelized\\n /// @param _log2Size log2 of total size of the drive\\n /// @dev _data is padded with zeroes until is multiple of 8\\n /// @dev root is completed with zero tree until log2size is complete\\n /// @dev hashes are taken word by word (8 bytes by 8 bytes)\\n function getMerkleRootFromBytes(bytes calldata _data, uint256 _log2Size) public pure returns (bytes32) {\\n require(_log2Size >= 3 && _log2Size <= 64, \\\"range of log2Size: [3,64]\\\");\\n\\n // if _data is empty return pristine drive of size log2size\\n if (_data.length == 0) return getEmptyTreeHashAtIndex(_log2Size - 3);\\n\\n // total size of the drive in words\\n uint256 size = 1 << (_log2Size - 3);\\n require(size << L_WORD_SIZE >= _data.length, \\\"data is bigger than drive\\\");\\n // the stack depth is log2(_data.length / 8) + 2\\n uint256 stack_depth = 2 + ((_data.length) >> L_WORD_SIZE).getLog2Floor();\\n bytes32[] memory stack = new bytes32[](stack_depth);\\n\\n uint256 numOfHashes; // total number of hashes on stack (counting levels)\\n uint256 stackLength; // total length of stack\\n uint256 numOfJoins; // number of hashes of the same level on stack\\n uint256 topStackLevel; // hash level of the top of the stack\\n\\n while (numOfHashes < size) {\\n if ((numOfHashes << L_WORD_SIZE) < _data.length) {\\n // we still have words to hash\\n stack[stackLength] = getHashOfWordAtIndex(_data, numOfHashes);\\n numOfHashes++;\\n\\n numOfJoins = numOfHashes;\\n } else {\\n // since padding happens in hashOfWordAtIndex function\\n // we only need to complete the stack with pre-computed\\n // hash(0), hash(hash(0),hash(0)) and so on\\n topStackLevel = numOfHashes.ctz();\\n\\n stack[stackLength] = getEmptyTreeHashAtIndex(topStackLevel);\\n\\n //Empty Tree Hash summarizes many hashes\\n numOfHashes = numOfHashes + (1 << topStackLevel);\\n numOfJoins = numOfHashes >> topStackLevel;\\n }\\n\\n stackLength++;\\n\\n // while there are joins, hash top of stack together\\n while (numOfJoins & 1 == 0) {\\n bytes32 h2 = stack[stackLength - 1];\\n bytes32 h1 = stack[stackLength - 2];\\n\\n stack[stackLength - 2] = keccak256(abi.encodePacked(h1, h2));\\n stackLength = stackLength - 1; // remove hashes from stack\\n\\n numOfJoins = numOfJoins >> 1;\\n }\\n }\\n require(stackLength == 1, \\\"stack error\\\");\\n\\n return stack[0];\\n }\\n\\n /// @notice Get the hash of a word in an array of bytes\\n /// @param _data array of bytes\\n /// @param _wordIndex index of word inside the bytes to get the hash of\\n /// @dev if word is incomplete (< 8 bytes) it gets padded with zeroes\\n function getHashOfWordAtIndex(bytes calldata _data, uint256 _wordIndex) public pure returns (bytes32) {\\n uint256 start = _wordIndex << L_WORD_SIZE;\\n uint256 end = start + (1 << L_WORD_SIZE);\\n\\n // TODO: in .lua this just returns zero, but this might be more consistent\\n require(start <= _data.length, \\\"word out of bounds\\\");\\n\\n if (end <= _data.length) {\\n return keccak256(abi.encodePacked(_data[start:end]));\\n }\\n\\n // word is incomplete\\n // fill paddedSlice with incomplete words - the rest is going to be bytes(0)\\n bytes memory paddedSlice = new bytes(8);\\n uint256 remaining = _data.length - start;\\n\\n for (uint256 i; i < remaining; i++) {\\n paddedSlice[i] = _data[start + i];\\n }\\n\\n return keccak256(paddedSlice);\\n }\\n\\n /// @notice Calculate the root of Merkle tree from an array of power of 2 elements\\n /// @param hashes The array containing power of 2 elements\\n /// @return byte32 the root hash being calculated\\n function calculateRootFromPowerOfTwo(bytes32[] memory hashes) public pure returns (bytes32) {\\n // revert when the input is not of power of 2\\n require((hashes.length).isPowerOf2(), \\\"array len not power of 2\\\");\\n\\n if (hashes.length == 1) {\\n return hashes[0];\\n } else {\\n bytes32[] memory newHashes = new bytes32[](hashes.length >> 1);\\n\\n for (uint256 i; i < hashes.length; i += 2) {\\n newHashes[i >> 1] = keccak256(abi.encodePacked(hashes[i], hashes[i + 1]));\\n }\\n\\n return calculateRootFromPowerOfTwo(newHashes);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x73d86cb2dfa2ca887987c6da8d193d523c6a65ea89e296d1f47f190ebda7fa9b\",\"license\":\"Apache-2.0\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\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 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 require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\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\":\"0xa535a5df777d44e945dd24aa43a11e44b024140fc340ad0dfe42acf4002aade1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev _Available since v3.1._\\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\":\"0xeb373f1fdc7b755c6a750123a9b9e3a8a02c1470042fd6505d875000a80bde0b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/utils/ERC1155Holder.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./ERC1155Receiver.sol\\\";\\n\\n/**\\n * Simple implementation of `ERC1155Receiver` 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 *\\n * @dev _Available since v3.1._\\n */\\ncontract ERC1155Holder is ERC1155Receiver {\\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\":\"0x2e024ca51ce5abe16c0d34e6992a1104f356e2244eb4ccbec970435e8b3405e3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC1155Receiver.sol\\\";\\nimport \\\"../../../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev _Available since v3.1._\\n */\\nabstract contract ERC1155Receiver 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\",\"keccak256\":\"0x3dd5e1a66a56f30302108a1da97d677a42b1daa60e503696b2bcbbf3e4c95bcb\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\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 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\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/utils/ERC721Holder.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../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 {IERC721-setApprovalForAll}.\\n */\\ncontract 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 override returns (bytes4) {\\n return this.onERC721Received.selector;\\n }\\n}\\n\",\"keccak256\":\"0x67ef46fef257faae47adb630aad49694dda0334e5f7a7c5fb386243b974886b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\\n require(address(this).balance >= amount, \\\"Create2: insufficient balance\\\");\\n require(bytecode.length != 0, \\\"Create2: bytecode length is zero\\\");\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n require(addr != address(0), \\\"Create2: Failed on deploy\\\");\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6e00f269073ffc4350e56b7e8153c9092d5f70bfba423299990514183101ef89\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./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 *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/common/CanonicalMachine.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @title Canonical Machine Constants Library\\n///\\n/// @notice Defines several constants related to the reference implementation\\n/// of the RISC-V machine that runs Linux, also known as the \\\"Cartesi Machine\\\".\\nlibrary CanonicalMachine {\\n /// @notice Base-2 logarithm of number of bytes.\\n type Log2Size is uint64;\\n\\n /// @notice Machine word size (8 bytes).\\n Log2Size constant WORD_LOG2_SIZE = Log2Size.wrap(3);\\n\\n /// @notice Machine address space size (2^64 bytes).\\n Log2Size constant MACHINE_LOG2_SIZE = Log2Size.wrap(64);\\n\\n /// @notice Keccak-256 output size (32 bytes).\\n Log2Size constant KECCAK_LOG2_SIZE = Log2Size.wrap(5);\\n\\n /// @notice Maximum input size (~2 megabytes).\\n /// @dev The offset and size fields use up the extra 64 bytes.\\n uint256 constant INPUT_MAX_SIZE = (1 << 21) - 64;\\n\\n /// @notice Maximum voucher metadata memory range (2 megabytes).\\n Log2Size constant VOUCHER_METADATA_LOG2_SIZE = Log2Size.wrap(21);\\n\\n /// @notice Maximum notice metadata memory range (2 megabytes).\\n Log2Size constant NOTICE_METADATA_LOG2_SIZE = Log2Size.wrap(21);\\n\\n /// @notice Maximum epoch voucher memory range (128 megabytes).\\n Log2Size constant EPOCH_VOUCHER_LOG2_SIZE = Log2Size.wrap(37);\\n\\n /// @notice Maximum epoch notice memory range (128 megabytes).\\n Log2Size constant EPOCH_NOTICE_LOG2_SIZE = Log2Size.wrap(37);\\n\\n /// @notice Unwrap `s` into its underlying uint64 value.\\n /// @param s Base-2 logarithm of some number of bytes\\n function uint64OfSize(Log2Size s) internal pure returns (uint64) {\\n return Log2Size.unwrap(s);\\n }\\n\\n /// @notice Return the position of an intra memory range on a memory range\\n /// with contents with the same size.\\n /// @param index Index of intra memory range\\n /// @param log2Size Base-2 logarithm of intra memory range size\\n function getIntraMemoryRangePosition(\\n uint64 index,\\n Log2Size log2Size\\n ) internal pure returns (uint64) {\\n return index << Log2Size.unwrap(log2Size);\\n }\\n}\\n\",\"keccak256\":\"0x97cdce56cdb4f0b4164e6be3a72e50469a3124e4716e753a1792aa70eac614f5\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/common/OutputEncoding.sol\":{\"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 Output Encoding Library\\n///\\n/// @notice Defines the encoding of outputs generated by the off-chain machine.\\nlibrary OutputEncoding {\\n /// @notice Encode a notice.\\n /// @param notice The notice\\n /// @return The encoded output\\n function encodeNotice(\\n bytes calldata notice\\n ) internal pure returns (bytes memory) {\\n return abi.encode(notice);\\n }\\n\\n /// @notice Encode a voucher.\\n /// @param destination The address that will receive the payload through a message call\\n /// @param payload The payload, which\\u2014in the case of Solidity contracts\\u2014encodes a function call\\n /// @return The encoded output\\n function encodeVoucher(\\n address destination,\\n bytes calldata payload\\n ) internal pure returns (bytes memory) {\\n return abi.encode(destination, payload);\\n }\\n}\\n\",\"keccak256\":\"0xfbf8bd40a11aeb380c77910ef7a8c3a4b358dddbd8bc795529de39c955dd6f60\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/IConsensus.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @title Consensus interface\\n///\\n/// @notice This contract defines a generic interface for consensuses.\\n/// We use the word \\\"consensus\\\" to designate a contract that provides claims\\n/// in the base layer regarding the state of off-chain machines running in\\n/// the execution layer. How this contract is able to reach consensus, who is\\n/// able to submit claims, and how are claims stored in the base layer are\\n/// some of the implementation details left unspecified by this interface.\\n///\\n/// From the point of view of a DApp, these claims are necessary to validate\\n/// on-chain action allowed by the off-chain machine in the form of vouchers\\n/// and notices. Each claim is composed of three parts: an epoch hash, a first\\n/// index, and a last index. We'll explain each of these parts below.\\n///\\n/// First, let us define the word \\\"epoch\\\". For finality reasons, we need to\\n/// divide the stream of inputs being fed into the off-chain machine into\\n/// batches of inputs, which we call \\\"epoches\\\". At the end of every epoch,\\n/// we summarize the state of the off-chain machine in a single hash, called\\n/// \\\"epoch hash\\\". Please note that this interface does not define how this\\n/// stream of inputs is being chopped up into epoches.\\n///\\n/// The other two parts are simply the indices of the first and last inputs\\n/// accepted during the epoch. Logically, the first index MUST BE less than\\n/// or equal to the last index. As a result, every epoch MUST accept at least\\n/// one input. This assumption stems from the fact that the state of a machine\\n/// can only change after an input is fed into it.\\n///\\n/// Examples of possible implementations of this interface include:\\n///\\n/// * An authority consensus, controlled by a single address who has full\\n/// control over epoch boundaries, claim submission, asset management, etc.\\n///\\n/// * A quorum consensus, controlled by a limited set of validators, that\\n/// vote on the state of the machine at the end of every epoch. Also, epoch\\n/// boundaries are determined by the timestamp in the base layer, and assets\\n/// are split equally amongst the validators.\\n///\\n/// * An NxN consensus, which allows anyone to submit and dispute claims\\n/// in the base layer. Epoch boundaries are determined in the same fashion\\n/// as in the quorum example.\\n///\\ninterface IConsensus {\\n /// @notice An application has joined the consensus' validation set.\\n /// @param application The application\\n /// @dev MUST be triggered on a successful call to `join`.\\n event ApplicationJoined(address application);\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// The encoding of `_proofContext` might vary\\n /// depending on the implementation.\\n /// @param _dapp The DApp address\\n /// @param _proofContext Data for retrieving the desired claim\\n /// @return epochHash_ The claimed epoch hash\\n /// @return firstInputIndex_ The index of the first input of the epoch in the input box\\n /// @return lastInputIndex_ The index of the last input of the epoch in the input box\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n )\\n external\\n view\\n returns (\\n bytes32 epochHash_,\\n uint256 firstInputIndex_,\\n uint256 lastInputIndex_\\n );\\n\\n /// @notice Signal the consensus that the message sender wants to join its validation set.\\n /// @dev MUST fire an `ApplicationJoined` event with the message sender as argument.\\n function join() external;\\n}\\n\",\"keccak256\":\"0xc9d295fada66eb0602e0f1e2e236708e52f959927abb4ab6b04173a98b92ac16\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/CartesiDApp.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {ICartesiDApp, Proof} from \\\"./ICartesiDApp.sol\\\";\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\nimport {LibOutputValidation, OutputValidityProof} from \\\"../library/LibOutputValidation.sol\\\";\\nimport {Bitmask} from \\\"@cartesi/util/contracts/Bitmask.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/security/ReentrancyGuard.sol\\\";\\n\\n/// @title Cartesi DApp\\n///\\n/// @notice This contract acts as the base layer incarnation of a DApp running on the execution layer.\\n/// The DApp is hereby able to interact with other smart contracts through the execution of vouchers\\n/// and the validation of notices. These outputs are generated by the DApp backend on the execution\\n/// layer and can be proven in the base layer thanks to claims submitted by a consensus contract.\\n///\\n/// A voucher is a one-time message call to another contract. It can encode asset transfers, approvals,\\n/// or any other message call that doesn't require Ether to be sent along. A voucher will only be consumed\\n/// if the underlying message call succeeds (that is, it doesn't revert). Furthermore, the return data of\\n/// the message call is discarded entirely. As a protective measure against reentrancy attacks, nested\\n/// voucher executions are prohibited.\\n///\\n/// A notice, on the other hand, constitutes an arbitrary piece of data that can be proven any number of times.\\n/// On their own, they do not trigger any type of contract-to-contract interaction.\\n/// Rather, they merely serve to attest off-chain results, e.g. which player won a particular chess match.\\n///\\n/// Every DApp is subscribed to a consensus contract, and governed by a single address, the owner.\\n/// The consensus has the power of submitting claims, which, in turn, are used to validate vouchers and notices.\\n/// Meanwhile, the owner has complete power over the DApp, as it can replace the consensus at any time.\\n/// Therefore, the users of a DApp must trust both the consensus and the DApp owner.\\n///\\n/// The DApp developer can choose whichever ownership and consensus models it wants.\\n///\\n/// Examples of DApp ownership models include:\\n///\\n/// * no owner (address zero)\\n/// * individual signer (externally-owned account)\\n/// * multiple signers (multi-sig)\\n/// * DAO (decentralized autonomous organization)\\n/// * self-owned DApp (off-chain governance logic)\\n///\\n/// See `IConsensus` for examples of consensus models.\\n///\\n/// This contract inherits the following OpenZeppelin contracts.\\n/// For more information, please consult OpenZeppelin's official documentation.\\n///\\n/// * `Ownable`\\n/// * `ERC721Holder`\\n/// * `ERC1155Holder`\\n/// * `ReentrancyGuard`\\n///\\ncontract CartesiDApp is\\n ICartesiDApp,\\n Ownable,\\n ERC721Holder,\\n ERC1155Holder,\\n ReentrancyGuard\\n{\\n using Bitmask for mapping(uint256 => uint256);\\n using LibOutputValidation for OutputValidityProof;\\n\\n /// @notice Raised when executing an already executed voucher.\\n error VoucherReexecutionNotAllowed();\\n\\n /// @notice Raised when the transfer fails.\\n error EtherTransferFailed();\\n\\n /// @notice Raised when a mehtod is not called by DApp itself.\\n error OnlyDApp();\\n\\n /// @notice The initial machine state hash.\\n /// @dev See the `getTemplateHash` function.\\n bytes32 internal immutable templateHash;\\n\\n /// @notice The executed voucher bitmask, which keeps track of which vouchers\\n /// were executed already in order to avoid re-execution.\\n /// @dev See the `wasVoucherExecuted` function.\\n mapping(uint256 => uint256) internal voucherBitmask;\\n\\n /// @notice The current consensus contract.\\n /// @dev See the `getConsensus` and `migrateToConsensus` functions.\\n IConsensus internal consensus;\\n\\n /// @notice Creates a `CartesiDApp` contract.\\n /// @param _consensus The initial consensus contract\\n /// @param _owner The initial DApp owner\\n /// @param _templateHash The initial machine state hash\\n /// @dev Calls the `join` function on `_consensus`.\\n constructor(IConsensus _consensus, address _owner, bytes32 _templateHash) {\\n transferOwnership(_owner);\\n templateHash = _templateHash;\\n consensus = _consensus;\\n\\n _consensus.join();\\n }\\n\\n function executeVoucher(\\n address _destination,\\n bytes calldata _payload,\\n Proof calldata _proof\\n ) external override nonReentrant returns (bool) {\\n bytes32 epochHash;\\n uint256 firstInputIndex;\\n uint256 lastInputIndex;\\n uint256 inputIndex;\\n\\n // query the current consensus for the desired claim\\n (epochHash, firstInputIndex, lastInputIndex) = getClaim(_proof.context);\\n\\n // validate input index range and calculate the input index\\n // based on the input index range provided by the consensus\\n inputIndex = _proof.validity.validateInputIndexRange(\\n firstInputIndex,\\n lastInputIndex\\n );\\n\\n // reverts if proof isn't valid\\n _proof.validity.validateVoucher(_destination, _payload, epochHash);\\n\\n uint256 voucherPosition = LibOutputValidation.getBitMaskPosition(\\n _proof.validity.outputIndexWithinInput,\\n inputIndex\\n );\\n\\n // check if voucher has been executed\\n if (_wasVoucherExecuted(voucherPosition)) {\\n revert VoucherReexecutionNotAllowed();\\n }\\n\\n // execute voucher\\n (bool succ, ) = _destination.call(_payload);\\n\\n // if properly executed, mark it as executed and emit event\\n if (succ) {\\n voucherBitmask.setBit(voucherPosition, true);\\n emit VoucherExecuted(voucherPosition);\\n }\\n\\n return succ;\\n }\\n\\n function wasVoucherExecuted(\\n uint256 _inputIndex,\\n uint256 _outputIndexWithinInput\\n ) external view override returns (bool) {\\n uint256 voucherPosition = LibOutputValidation.getBitMaskPosition(\\n _outputIndexWithinInput,\\n _inputIndex\\n );\\n return _wasVoucherExecuted(voucherPosition);\\n }\\n\\n function _wasVoucherExecuted(\\n uint256 _voucherPosition\\n ) internal view returns (bool) {\\n return voucherBitmask.getBit(_voucherPosition);\\n }\\n\\n function validateNotice(\\n bytes calldata _notice,\\n Proof calldata _proof\\n ) external view override returns (bool) {\\n bytes32 epochHash;\\n uint256 firstInputIndex;\\n uint256 lastInputIndex;\\n\\n // query the current consensus for the desired claim\\n (epochHash, firstInputIndex, lastInputIndex) = getClaim(_proof.context);\\n\\n // validate the epoch input index based on the input index range\\n // provided by the consensus\\n _proof.validity.validateInputIndexRange(\\n firstInputIndex,\\n lastInputIndex\\n );\\n\\n // reverts if proof isn't valid\\n _proof.validity.validateNotice(_notice, epochHash);\\n\\n return true;\\n }\\n\\n /// @notice Retrieve a claim about the DApp from the current consensus.\\n /// The encoding of `_proofContext` might vary depending on the implementation.\\n /// @param _proofContext Data for retrieving the desired claim\\n /// @return The claimed epoch hash\\n /// @return The index of the first input of the epoch in the input box\\n /// @return The index of the last input of the epoch in the input box\\n function getClaim(\\n bytes calldata _proofContext\\n ) internal view returns (bytes32, uint256, uint256) {\\n return consensus.getClaim(address(this), _proofContext);\\n }\\n\\n function migrateToConsensus(\\n IConsensus _newConsensus\\n ) external override onlyOwner {\\n consensus = _newConsensus;\\n\\n _newConsensus.join();\\n\\n emit NewConsensus(_newConsensus);\\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 /// @notice Accept Ether transfers.\\n /// @dev If you wish to transfer Ether to a DApp while informing\\n /// the DApp backend of it, then please do so through the Ether portal contract.\\n receive() external payable {}\\n\\n /// @notice Transfer some amount of Ether to some recipient.\\n /// @param _receiver The address which will receive the amount of Ether\\n /// @param _value The amount of Ether to be transferred in Wei\\n /// @dev This function can only be called by the DApp itself through vouchers.\\n /// If this method is not called by DApp itself, `OnlyDApp` error is raised.\\n /// If the transfer fails, `EtherTransferFailed` error is raised.\\n function withdrawEther(address _receiver, uint256 _value) external {\\n if (msg.sender != address(this)) {\\n revert OnlyDApp();\\n }\\n\\n (bool sent, ) = _receiver.call{value: _value}(\\\"\\\");\\n\\n if (!sent) {\\n revert EtherTransferFailed();\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe54766db1afcbb9578fffc1a87927d95673f1a630d88a7889941878a89761128\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/CartesiDAppFactory.sol\":{\"content\":\"// (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 {ICartesiDAppFactory} from \\\"./ICartesiDAppFactory.sol\\\";\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\nimport {CartesiDApp} from \\\"./CartesiDApp.sol\\\";\\n\\n/// @title Cartesi DApp Factory\\n/// @notice Allows anyone to reliably deploy a new `CartesiDApp` contract.\\ncontract CartesiDAppFactory is ICartesiDAppFactory {\\n function newApplication(\\n IConsensus _consensus,\\n address _dappOwner,\\n bytes32 _templateHash\\n ) external override returns (CartesiDApp) {\\n CartesiDApp application = new CartesiDApp(\\n _consensus,\\n _dappOwner,\\n _templateHash\\n );\\n\\n emit ApplicationCreated(\\n _consensus,\\n _dappOwner,\\n _templateHash,\\n application\\n );\\n\\n return application;\\n }\\n\\n function newApplication(\\n IConsensus _consensus,\\n address _dappOwner,\\n bytes32 _templateHash,\\n bytes32 _salt\\n ) external override returns (CartesiDApp) {\\n CartesiDApp application = new CartesiDApp{salt: _salt}(\\n _consensus,\\n _dappOwner,\\n _templateHash\\n );\\n\\n emit ApplicationCreated(\\n _consensus,\\n _dappOwner,\\n _templateHash,\\n application\\n );\\n\\n return application;\\n }\\n\\n function calculateApplicationAddress(\\n IConsensus _consensus,\\n address _dappOwner,\\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(CartesiDApp).creationCode,\\n abi.encode(_consensus, _dappOwner, _templateHash)\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0xd5f93d28a69df7dc63205026dc5a1865ee989a683f3e648812ded6cefb35f10d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/ICartesiDApp.sol\":{\"content\":\"// (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 \\\"../consensus/IConsensus.sol\\\";\\nimport {OutputValidityProof} from \\\"../library/LibOutputValidation.sol\\\";\\n\\n/// @notice Data for validating outputs.\\n/// @param validity A validity proof for the output\\n/// @param context Data for querying the right claim from the current consensus contract\\n/// @dev The encoding of `context` might vary depending on the implementation of the consensus contract.\\nstruct Proof {\\n OutputValidityProof validity;\\n bytes context;\\n}\\n\\n/// @title Cartesi DApp interface\\ninterface ICartesiDApp {\\n // Events\\n\\n /// @notice The DApp has migrated to another consensus contract.\\n /// @param newConsensus The new consensus contract\\n /// @dev MUST be triggered on a successful call to `migrateToConsensus`.\\n event NewConsensus(IConsensus newConsensus);\\n\\n /// @notice A voucher was executed from the DApp.\\n /// @param voucherId A number that uniquely identifies the voucher\\n /// amongst all vouchers emitted by this DApp\\n event VoucherExecuted(uint256 voucherId);\\n\\n // Permissioned functions\\n\\n /// @notice Migrate the DApp to a new consensus.\\n /// @param _newConsensus The new consensus\\n /// @dev Can only be called by the DApp owner.\\n function migrateToConsensus(IConsensus _newConsensus) external;\\n\\n // Permissionless functions\\n\\n /// @notice Try to execute a voucher.\\n ///\\n /// Reverts if voucher was already successfully executed.\\n ///\\n /// @param _destination The address that will receive the payload through a message call\\n /// @param _payload The payload, which\\u2014in the case of Solidity contracts\\u2014encodes a function call\\n /// @param _proof The proof used to validate the voucher against\\n /// a claim submitted by the current consensus contract\\n /// @return Whether the execution was successful or not\\n /// @dev On a successful execution, emits a `VoucherExecuted` event.\\n /// Execution of already executed voucher will raise a `VoucherReexecutionNotAllowed` error.\\n function executeVoucher(\\n address _destination,\\n bytes calldata _payload,\\n Proof calldata _proof\\n ) external returns (bool);\\n\\n /// @notice Check whether a voucher has been executed.\\n /// @param _inputIndex The index of the input in the input box\\n /// @param _outputIndexWithinInput The index of output emitted by the input\\n /// @return Whether the voucher has been executed before\\n function wasVoucherExecuted(\\n uint256 _inputIndex,\\n uint256 _outputIndexWithinInput\\n ) external view returns (bool);\\n\\n /// @notice Validate a notice.\\n /// @param _notice The notice\\n /// @param _proof Data for validating outputs\\n /// @return Whether the notice is valid or not\\n function validateNotice(\\n bytes calldata _notice,\\n Proof calldata _proof\\n ) external view returns (bool);\\n\\n /// @notice Get the DApp's template hash.\\n /// @return The DApp'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\":\"0x7bb375a4deb593af06955bbf1d88e096f4288f25fa032349796f93705d29386f\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/ICartesiDAppFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {CartesiDApp} from \\\"./CartesiDApp.sol\\\";\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\n\\n/// @title Cartesi DApp Factory interface\\ninterface ICartesiDAppFactory {\\n // Events\\n\\n /// @notice A new application was deployed.\\n /// @param consensus The initial consensus contract\\n /// @param dappOwner The initial DApp owner\\n /// @param templateHash The initial machine state hash\\n /// @param application The application\\n /// @dev MUST be triggered on a successful call to `newApplication`.\\n event ApplicationCreated(\\n IConsensus indexed consensus,\\n address dappOwner,\\n bytes32 templateHash,\\n CartesiDApp application\\n );\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new application.\\n /// @param _consensus The initial consensus contract\\n /// @param _dappOwner The initial DApp owner\\n /// @param _templateHash The initial machine state hash\\n /// @return The application\\n /// @dev On success, MUST emit an `ApplicationCreated` event.\\n function newApplication(\\n IConsensus _consensus,\\n address _dappOwner,\\n bytes32 _templateHash\\n ) external returns (CartesiDApp);\\n\\n /// @notice Deploy a new application deterministically.\\n /// @param _consensus The initial consensus contract\\n /// @param _dappOwner The initial DApp owner\\n /// @param _templateHash The initial machine state hash\\n /// @param _salt The salt used to deterministically generate the DApp address\\n /// @return The application\\n /// @dev On success, MUST emit an `ApplicationCreated` event.\\n function newApplication(\\n IConsensus _consensus,\\n address _dappOwner,\\n bytes32 _templateHash,\\n bytes32 _salt\\n ) external returns (CartesiDApp);\\n\\n /// @notice Calculate the address of an application to be deployed deterministically.\\n /// @param _consensus The initial consensus contract\\n /// @param _dappOwner The initial DApp owner\\n /// @param _templateHash The initial machine state hash\\n /// @param _salt The salt used to deterministically generate the DApp address\\n /// @return The deterministic application 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 _dappOwner,\\n bytes32 _templateHash,\\n bytes32 _salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0xb6d6ae44b2195f54a5c5ac85dc1c33801036878982c6b9aafe8fb66a3103517b\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/library/LibOutputValidation.sol\":{\"content\":\"// (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 {MerkleV2} from \\\"@cartesi/util/contracts/MerkleV2.sol\\\";\\nimport {OutputEncoding} from \\\"../common/OutputEncoding.sol\\\";\\n\\n/// @param inputIndexWithinEpoch Which input, inside the epoch, the output belongs to\\n/// @param outputIndexWithinInput Index of output emitted by the input\\n/// @param outputHashesRootHash Merkle root of hashes of outputs emitted by the input\\n/// @param vouchersEpochRootHash Merkle root of all epoch's voucher metadata hashes\\n/// @param noticesEpochRootHash Merkle root of all epoch's notice metadata hashes\\n/// @param machineStateHash Hash of the machine state claimed this epoch\\n/// @param outputHashInOutputHashesSiblings Proof that this output metadata is in metadata memory range\\n/// @param outputHashesInEpochSiblings Proof that this output metadata is in epoch's output memory range\\nstruct OutputValidityProof {\\n uint64 inputIndexWithinEpoch;\\n uint64 outputIndexWithinInput;\\n bytes32 outputHashesRootHash;\\n bytes32 vouchersEpochRootHash;\\n bytes32 noticesEpochRootHash;\\n bytes32 machineStateHash;\\n bytes32[] outputHashInOutputHashesSiblings;\\n bytes32[] outputHashesInEpochSiblings;\\n}\\n\\n/// @title Output Validation Library\\nlibrary LibOutputValidation {\\n using CanonicalMachine for CanonicalMachine.Log2Size;\\n\\n /// @notice Raised when some `OutputValidityProof` variables does not match\\n /// the presented finalized epoch.\\n error IncorrectEpochHash();\\n\\n /// @notice Raised when `OutputValidityProof` metadata memory range is NOT\\n /// contained in epoch's output memory range.\\n error IncorrectOutputsEpochRootHash();\\n\\n /// @notice Raised when Merkle root of output hash is NOT contained\\n /// in the output metadata array memory range.\\n error IncorrectOutputHashesRootHash();\\n\\n /// @notice Raised when epoch input index is NOT compatible with the\\n /// provided input index range.\\n error InputIndexOutOfClaimBounds();\\n\\n /// @notice Make sure the output proof is valid, otherwise revert.\\n /// @param v The output validity proof\\n /// @param encodedOutput The encoded output\\n /// @param epochHash The hash of the epoch in which the output was generated\\n /// @param outputsEpochRootHash Either `v.vouchersEpochRootHash` (for vouchers)\\n /// or `v.noticesEpochRootHash` (for notices)\\n /// @param outputEpochLog2Size Either `EPOCH_VOUCHER_LOG2_SIZE` (for vouchers)\\n /// or `EPOCH_NOTICE_LOG2_SIZE` (for notices)\\n /// @param outputHashesLog2Size Either `VOUCHER_METADATA_LOG2_SIZE` (for vouchers)\\n /// or `NOTICE_METADATA_LOG2_SIZE` (for notices)\\n function validateEncodedOutput(\\n OutputValidityProof calldata v,\\n bytes memory encodedOutput,\\n bytes32 epochHash,\\n bytes32 outputsEpochRootHash,\\n uint256 outputEpochLog2Size,\\n uint256 outputHashesLog2Size\\n ) internal pure {\\n // prove that outputs hash is represented in a finalized epoch\\n if (\\n keccak256(\\n abi.encodePacked(\\n v.vouchersEpochRootHash,\\n v.noticesEpochRootHash,\\n v.machineStateHash\\n )\\n ) != epochHash\\n ) {\\n revert IncorrectEpochHash();\\n }\\n\\n // prove that output metadata memory range is contained in epoch's output memory range\\n if (\\n MerkleV2.getRootAfterReplacementInDrive(\\n CanonicalMachine.getIntraMemoryRangePosition(\\n v.inputIndexWithinEpoch,\\n CanonicalMachine.KECCAK_LOG2_SIZE\\n ),\\n CanonicalMachine.KECCAK_LOG2_SIZE.uint64OfSize(),\\n outputEpochLog2Size,\\n v.outputHashesRootHash,\\n v.outputHashesInEpochSiblings\\n ) != outputsEpochRootHash\\n ) {\\n revert IncorrectOutputsEpochRootHash();\\n }\\n\\n // The hash of the output is converted to bytes (abi.encode) and\\n // treated as data. The metadata output memory range stores that data while\\n // being indifferent to its contents. To prove that the received\\n // output is contained in the metadata output memory range we need to\\n // prove that x, where:\\n // x = keccak(\\n // keccak(\\n // keccak(hashOfOutput[0:7]),\\n // keccak(hashOfOutput[8:15])\\n // ),\\n // keccak(\\n // keccak(hashOfOutput[16:23]),\\n // keccak(hashOfOutput[24:31])\\n // )\\n // )\\n // is contained in it. We can't simply use hashOfOutput because the\\n // log2size of the leaf is three (8 bytes) not five (32 bytes)\\n bytes32 merkleRootOfHashOfOutput = MerkleV2.getMerkleRootFromBytes(\\n abi.encodePacked(keccak256(encodedOutput)),\\n CanonicalMachine.KECCAK_LOG2_SIZE.uint64OfSize()\\n );\\n\\n // prove that Merkle root of bytes(hashOfOutput) is contained\\n // in the output metadata array memory range\\n if (\\n MerkleV2.getRootAfterReplacementInDrive(\\n CanonicalMachine.getIntraMemoryRangePosition(\\n v.outputIndexWithinInput,\\n CanonicalMachine.KECCAK_LOG2_SIZE\\n ),\\n CanonicalMachine.KECCAK_LOG2_SIZE.uint64OfSize(),\\n outputHashesLog2Size,\\n merkleRootOfHashOfOutput,\\n v.outputHashInOutputHashesSiblings\\n ) != v.outputHashesRootHash\\n ) {\\n revert IncorrectOutputHashesRootHash();\\n }\\n }\\n\\n /// @notice Make sure the output proof is valid, otherwise revert.\\n /// @param v The output validity proof\\n /// @param destination The address that will receive the payload through a message call\\n /// @param payload The payload, which\\u2014in the case of Solidity contracts\\u2014encodes a function call\\n /// @param epochHash The hash of the epoch in which the output was generated\\n function validateVoucher(\\n OutputValidityProof calldata v,\\n address destination,\\n bytes calldata payload,\\n bytes32 epochHash\\n ) internal pure {\\n bytes memory encodedVoucher = OutputEncoding.encodeVoucher(\\n destination,\\n payload\\n );\\n validateEncodedOutput(\\n v,\\n encodedVoucher,\\n epochHash,\\n v.vouchersEpochRootHash,\\n CanonicalMachine.EPOCH_VOUCHER_LOG2_SIZE.uint64OfSize(),\\n CanonicalMachine.VOUCHER_METADATA_LOG2_SIZE.uint64OfSize()\\n );\\n }\\n\\n /// @notice Make sure the output proof is valid, otherwise revert.\\n /// @param v The output validity proof\\n /// @param notice The notice\\n /// @param epochHash The hash of the epoch in which the output was generated\\n function validateNotice(\\n OutputValidityProof calldata v,\\n bytes calldata notice,\\n bytes32 epochHash\\n ) internal pure {\\n bytes memory encodedNotice = OutputEncoding.encodeNotice(notice);\\n validateEncodedOutput(\\n v,\\n encodedNotice,\\n epochHash,\\n v.noticesEpochRootHash,\\n CanonicalMachine.EPOCH_NOTICE_LOG2_SIZE.uint64OfSize(),\\n CanonicalMachine.NOTICE_METADATA_LOG2_SIZE.uint64OfSize()\\n );\\n }\\n\\n /// @notice Get the position of a voucher on the bit mask.\\n /// @param voucher The index of voucher from those generated by such input\\n /// @param input The index of the input in the DApp's input box\\n /// @return Position of the voucher on the bit mask\\n function getBitMaskPosition(\\n uint256 voucher,\\n uint256 input\\n ) internal pure returns (uint256) {\\n // voucher * 2 ** 128 + input\\n // this shouldn't overflow because it is impossible to have > 2**128 vouchers\\n // and because we are assuming there will be < 2 ** 128 inputs on the input box\\n return (((voucher << 128) | input));\\n }\\n\\n /// @notice Validate input index range and get the input index.\\n /// @param v The output validity proof\\n /// @param firstInputIndex The index of the first input of the epoch in the input box\\n /// @param lastInputIndex The index of the last input of the epoch in the input box\\n /// @return The index of the input in the DApp's input box\\n /// @dev Reverts if epoch input index is not compatible with the provided input index range.\\n function validateInputIndexRange(\\n OutputValidityProof calldata v,\\n uint256 firstInputIndex,\\n uint256 lastInputIndex\\n ) internal pure returns (uint256) {\\n uint256 inputIndex = firstInputIndex + v.inputIndexWithinEpoch;\\n\\n if (inputIndex > lastInputIndex) {\\n revert InputIndexOutOfClaimBounds();\\n }\\n\\n return inputIndex;\\n }\\n}\\n\",\"keccak256\":\"0x874ef478bd265acc94f2480a97191da907f05c6b46dc9e901c534b6acab14e03\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50611af9806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80630e1a07f5146100465780633648bfb514610075578063bd4f121914610088575b600080fd5b6100596100543660046102df565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b610059610083366004610325565b610148565b6100596100963660046102df565b6101ef565b600080828686866040516100ae906102ba565b6001600160a01b03938416815292909116602083015260408201526060018190604051809103906000f59050801580156100ec573d6000803e3d6000fd5b50604080516001600160a01b03888116825260208201889052838116828401529151929350908816917fe73165c2d277daf8713fd08b40845cb6bb7a20b2b543f3d35324a475660fcebd9181900360600190a295945050505050565b60008084848460405161015a906102ba565b6001600160a01b0393841681529290911660208301526040820152606001604051809103906000f080158015610194573d6000803e3d6000fd5b50604080516001600160a01b03878116825260208201879052838116828401529151929350908716917fe73165c2d277daf8713fd08b40845cb6bb7a20b2b543f3d35324a475660fcebd9181900360600190a2949350505050565b60006102738260405180602001610205906102ba565b601f1982820381018352601f9091011660408181526001600160a01b038a811660208401528916908201526060810187905260800160408051601f19818403018152908290526102589291602001610396565b6040516020818303038152906040528051906020012061027c565b95945050505050565b6000610289838330610290565b9392505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b611710806103b483390190565b6001600160a01b03811681146102dc57600080fd5b50565b600080600080608085870312156102f557600080fd5b8435610300816102c7565b93506020850135610310816102c7565b93969395505050506040820135916060013590565b60008060006060848603121561033a57600080fd5b8335610345816102c7565b92506020840135610355816102c7565b929592945050506040919091013590565b6000815160005b81811015610387576020818501810151868301520161036d565b50600093019283525090919050565b60006103ab6103a58386610366565b84610366565b94935050505056fe60a06040523480156200001157600080fd5b506040516200171038038062001710833981016040819052620000349162000212565b6200003f33620000cb565b600180556200004e826200011b565b6080819052600380546001600160a01b0319166001600160a01b0385169081179091556040805163b688a36360e01b8152905163b688a3639160048082019260009290919082900301818387803b158015620000a957600080fd5b505af1158015620000be573d6000803e3d6000fd5b505050505050506200025a565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b620001256200019e565b6001600160a01b038116620001905760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6200019b81620000cb565b50565b6000546001600160a01b03163314620001fa5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000187565b565b6001600160a01b03811681146200019b57600080fd5b6000806000606084860312156200022857600080fd5b83516200023581620001fc565b60208501519093506200024881620001fc565b80925050604084015190509250925092565b60805161149a6200027660003960006101ec015261149a6000f3fe6080604052600436106100e15760003560e01c80638da5cb5b1161007f578063bc197c8111610059578063bc197c8114610288578063f23a6e61146102b4578063f2fde38b146102e0578063fc4116831461030057600080fd5b80638da5cb5b1461022a57806396487d46146102485780639d9b11451461026857600080fd5b8063179e740b116100bb578063179e740b14610186578063522f6815146101b857806361b12c66146101da578063715018a61461021557600080fd5b806301ffc9a7146100ed5780631250482f14610122578063150b7a021461014257600080fd5b366100e857005b600080fd5b3480156100f957600080fd5b5061010d610108366004610d2a565b610320565b60405190151581526020015b60405180910390f35b34801561012e57600080fd5b5061010d61013d366004610dd0565b610357565b34801561014e57600080fd5b5061016d61015d366004610f00565b630a85bd0160e11b949350505050565b6040516001600160e01b03199091168152602001610119565b34801561019257600080fd5b506003546001600160a01b03165b6040516001600160a01b039091168152602001610119565b3480156101c457600080fd5b506101d86101d3366004610f5f565b61053c565b005b3480156101e657600080fd5b506040517f00000000000000000000000000000000000000000000000000000000000000008152602001610119565b34801561022157600080fd5b506101d86105d5565b34801561023657600080fd5b506000546001600160a01b03166101a0565b34801561025457600080fd5b5061010d610263366004610f8b565b6105e9565b34801561027457600080fd5b5061010d610283366004610ff3565b61063a565b34801561029457600080fd5b5061016d6102a3366004611094565b63bc197c8160e01b95945050505050565b3480156102c057600080fd5b5061016d6102cf366004611141565b63f23a6e6160e01b95945050505050565b3480156102ec57600080fd5b506101d86102fb3660046111a9565b61064c565b34801561030c57600080fd5b506101d861031b3660046111a9565b6106ca565b60006001600160e01b03198216630271189760e51b148061035157506301ffc9a760e01b6001600160e01b03198316145b92915050565b600061036161077f565b600080808061037b61037660208801886111c6565b6107d8565b919550935091506103988383610391898061120c565b919061085f565b90506103b4898989876103ab8b8061120c565b939291906108a5565b60006103e86103c3888061120c565b6103d490604081019060200161122c565b6001600160401b03168360809190911b1790565b90506103f3816108da565b15610411576040516370de22b760e01b815260040160405180910390fd5b60008a6001600160a01b03168a8a60405161042d929190611255565b6000604051808303816000865af19150503d806000811461046a576040519150601f19603f3d011682016040523d82523d6000602084013e61046f565b606091505b505090508015610524576040516306449da160e41b815260026004820152602481018390526001604482015273F5B2d8c81cDE4D6238bBf20D3D77DB37df13f73590636449da109060640160006040518083038186803b1580156104d257600080fd5b505af41580156104e6573d6000803e3d6000fd5b505050507f0eb7ee080f865f1cadc4f54daf58cc3b8879e888832867d13351edcec0fbdc548260405161051b91815260200190565b60405180910390a15b9550505050505061053460018055565b949350505050565b33301461055c5760405163a08d601d60e01b815260040160405180910390fd5b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146105a9576040519150601f19603f3d011682016040523d82523d6000602084013e6105ae565b606091505b50509050806105d057604051630ce8f45160e31b815260040160405180910390fd5b505050565b6105dd610958565b6105e760006109b2565b565b60008080806105fe61037660208701876111c6565b919450925090506106148282610391888061120c565b5061062d878785610625898061120c565b929190610a02565b5060019695505050505050565b6000608082901b8317610534816108da565b610654610958565b6001600160a01b0381166106be5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6106c7816109b2565b50565b6106d2610958565b600380546001600160a01b0319166001600160a01b0383169081179091556040805163b688a36360e01b8152905163b688a3639160048082019260009290919082900301818387803b15801561072757600080fd5b505af115801561073b573d6000803e3d6000fd5b50506040516001600160a01b03841681527f4991c6f37185659e276ff918a96f3e20e6c5abcd8c9aab450dc19c2f7ad35cb59250602001905060405180910390a150565b6002600154036107d15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016106b5565b6002600155565b60035460405163035e6a0960e61b8152600091829182916001600160a01b03169063d79a8240906108119030908990899060040161128e565b606060405180830381865afa15801561082e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085291906112bc565b9250925092509250925092565b60008061086f602086018661122c565b610882906001600160401b0316856112ea565b9050828111156105345760405163fd9ae91f60e01b815260040160405180910390fd5b60006108b2858585610a29565b90506108d2868284606083013560255b6001600160401b03166015610a58565b505050505050565b6040516303fbaf7360e01b8152600260048201526024810182905260009073F5B2d8c81cDE4D6238bBf20D3D77DB37df13f735906303fbaf7390604401602060405180830381865af4158015610934573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610351919061130b565b6000546001600160a01b031633146105e75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106b5565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610a0e8484610cfe565b9050610a22858284608083013560256108c2565b5050505050565b6060838383604051602001610a409392919061128e565b60405160208183030381529060405290509392505050565b6040805160608089013560208301526080808a01359383019390935260a0890135908201528591016040516020818303038152906040528051906020012014610ab457604051636fbd3b7160e11b815260040160405180910390fd5b827333436035441927Df1a73FE3AAC5906854632e53d6379de4601610af0610adf60208b018b61122c565b60051b681fffffffffffffffe01690565b60058660408c0135610b0560e08e018e61132d565b6040518763ffffffff1660e01b8152600401610b2696959493929190611376565b602060405180830381865af4158015610b43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6791906113d9565b14610b8557604051634371daa160e11b815260040160405180910390fd5b60007333436035441927Df1a73FE3AAC5906854632e53d63c84583a18780519060200120604051602001610bbb91815260200190565b60408051601f19818403018152908290526001600160e01b031960e084901b168252610bec916005906004016113f2565b602060405180830381865af4158015610c09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2d91906113d9565b905086604001357333436035441927Df1a73FE3AAC5906854632e53d6379de4601610c648a6020016020810190610adf919061122c565b60058686610c7560c08f018f61132d565b6040518763ffffffff1660e01b8152600401610c9696959493929190611376565b602060405180830381865af4158015610cb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd791906113d9565b14610cf55760405163017c689560e61b815260040160405180910390fd5b50505050505050565b60608282604051602001610d13929190611450565b604051602081830303815290604052905092915050565b600060208284031215610d3c57600080fd5b81356001600160e01b031981168114610d5457600080fd5b9392505050565b6001600160a01b03811681146106c757600080fd5b60008083601f840112610d8257600080fd5b5081356001600160401b03811115610d9957600080fd5b602083019150836020828501011115610db157600080fd5b9250929050565b600060408284031215610dca57600080fd5b50919050565b60008060008060608587031215610de657600080fd5b8435610df181610d5b565b935060208501356001600160401b0380821115610e0d57600080fd5b610e1988838901610d70565b90955093506040870135915080821115610e3257600080fd5b50610e3f87828801610db8565b91505092959194509250565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715610e8957610e89610e4b565b604052919050565b600082601f830112610ea257600080fd5b81356001600160401b03811115610ebb57610ebb610e4b565b610ece601f8201601f1916602001610e61565b818152846020838601011115610ee357600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215610f1657600080fd5b8435610f2181610d5b565b93506020850135610f3181610d5b565b92506040850135915060608501356001600160401b03811115610f5357600080fd5b610e3f87828801610e91565b60008060408385031215610f7257600080fd5b8235610f7d81610d5b565b946020939093013593505050565b600080600060408486031215610fa057600080fd5b83356001600160401b0380821115610fb757600080fd5b610fc387838801610d70565b90955093506020860135915080821115610fdc57600080fd5b50610fe986828701610db8565b9150509250925092565b6000806040838503121561100657600080fd5b50508035926020909101359150565b600082601f83011261102657600080fd5b813560206001600160401b0382111561104157611041610e4b565b8160051b611050828201610e61565b928352848101820192828101908785111561106a57600080fd5b83870192505b8483101561108957823582529183019190830190611070565b979650505050505050565b600080600080600060a086880312156110ac57600080fd5b85356110b781610d5b565b945060208601356110c781610d5b565b935060408601356001600160401b03808211156110e357600080fd5b6110ef89838a01611015565b9450606088013591508082111561110557600080fd5b61111189838a01611015565b9350608088013591508082111561112757600080fd5b5061113488828901610e91565b9150509295509295909350565b600080600080600060a0868803121561115957600080fd5b853561116481610d5b565b9450602086013561117481610d5b565b9350604086013592506060860135915060808601356001600160401b0381111561119d57600080fd5b61113488828901610e91565b6000602082840312156111bb57600080fd5b8135610d5481610d5b565b6000808335601e198436030181126111dd57600080fd5b8301803591506001600160401b038211156111f757600080fd5b602001915036819003821315610db157600080fd5b6000823560fe1983360301811261122257600080fd5b9190910192915050565b60006020828403121561123e57600080fd5b81356001600160401b0381168114610d5457600080fd5b8183823760009101908152919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03841681526040602082018190526000906112b39083018486611265565b95945050505050565b6000806000606084860312156112d157600080fd5b8351925060208401519150604084015190509250925092565b8082018082111561035157634e487b7160e01b600052601160045260246000fd5b60006020828403121561131d57600080fd5b81518015158114610d5457600080fd5b6000808335601e1984360301811261134457600080fd5b8301803591506001600160401b0382111561135e57600080fd5b6020019150600581901b3603821315610db157600080fd5b6001600160401b03878116825286166020820152604081018590526060810184905260a060808201819052810182905260006001600160fb1b038311156113bc57600080fd5b8260051b808560c08501379190910160c001979650505050505050565b6000602082840312156113eb57600080fd5b5051919050565b604081526000835180604084015260005b818110156114205760208187018101516060868401015201611403565b506000606082850101526060601f19601f8301168401019150506001600160401b03831660208301529392505050565b60208152600061053460208301848661126556fea2646970667358221220981835fbbf44aedaeb41e0c0c9001ffe55187a0b5606db0cdbf7500fc7c5e30e64736f6c63430008130033a2646970667358221220a12c770ef21751c306949fd9ed57ed453446a67f2dfb1d63d08c918461eca99764736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80630e1a07f5146100465780633648bfb514610075578063bd4f121914610088575b600080fd5b6100596100543660046102df565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b610059610083366004610325565b610148565b6100596100963660046102df565b6101ef565b600080828686866040516100ae906102ba565b6001600160a01b03938416815292909116602083015260408201526060018190604051809103906000f59050801580156100ec573d6000803e3d6000fd5b50604080516001600160a01b03888116825260208201889052838116828401529151929350908816917fe73165c2d277daf8713fd08b40845cb6bb7a20b2b543f3d35324a475660fcebd9181900360600190a295945050505050565b60008084848460405161015a906102ba565b6001600160a01b0393841681529290911660208301526040820152606001604051809103906000f080158015610194573d6000803e3d6000fd5b50604080516001600160a01b03878116825260208201879052838116828401529151929350908716917fe73165c2d277daf8713fd08b40845cb6bb7a20b2b543f3d35324a475660fcebd9181900360600190a2949350505050565b60006102738260405180602001610205906102ba565b601f1982820381018352601f9091011660408181526001600160a01b038a811660208401528916908201526060810187905260800160408051601f19818403018152908290526102589291602001610396565b6040516020818303038152906040528051906020012061027c565b95945050505050565b6000610289838330610290565b9392505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b611710806103b483390190565b6001600160a01b03811681146102dc57600080fd5b50565b600080600080608085870312156102f557600080fd5b8435610300816102c7565b93506020850135610310816102c7565b93969395505050506040820135916060013590565b60008060006060848603121561033a57600080fd5b8335610345816102c7565b92506020840135610355816102c7565b929592945050506040919091013590565b6000815160005b81811015610387576020818501810151868301520161036d565b50600093019283525090919050565b60006103ab6103a58386610366565b84610366565b94935050505056fe60a06040523480156200001157600080fd5b506040516200171038038062001710833981016040819052620000349162000212565b6200003f33620000cb565b600180556200004e826200011b565b6080819052600380546001600160a01b0319166001600160a01b0385169081179091556040805163b688a36360e01b8152905163b688a3639160048082019260009290919082900301818387803b158015620000a957600080fd5b505af1158015620000be573d6000803e3d6000fd5b505050505050506200025a565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b620001256200019e565b6001600160a01b038116620001905760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6200019b81620000cb565b50565b6000546001600160a01b03163314620001fa5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000187565b565b6001600160a01b03811681146200019b57600080fd5b6000806000606084860312156200022857600080fd5b83516200023581620001fc565b60208501519093506200024881620001fc565b80925050604084015190509250925092565b60805161149a6200027660003960006101ec015261149a6000f3fe6080604052600436106100e15760003560e01c80638da5cb5b1161007f578063bc197c8111610059578063bc197c8114610288578063f23a6e61146102b4578063f2fde38b146102e0578063fc4116831461030057600080fd5b80638da5cb5b1461022a57806396487d46146102485780639d9b11451461026857600080fd5b8063179e740b116100bb578063179e740b14610186578063522f6815146101b857806361b12c66146101da578063715018a61461021557600080fd5b806301ffc9a7146100ed5780631250482f14610122578063150b7a021461014257600080fd5b366100e857005b600080fd5b3480156100f957600080fd5b5061010d610108366004610d2a565b610320565b60405190151581526020015b60405180910390f35b34801561012e57600080fd5b5061010d61013d366004610dd0565b610357565b34801561014e57600080fd5b5061016d61015d366004610f00565b630a85bd0160e11b949350505050565b6040516001600160e01b03199091168152602001610119565b34801561019257600080fd5b506003546001600160a01b03165b6040516001600160a01b039091168152602001610119565b3480156101c457600080fd5b506101d86101d3366004610f5f565b61053c565b005b3480156101e657600080fd5b506040517f00000000000000000000000000000000000000000000000000000000000000008152602001610119565b34801561022157600080fd5b506101d86105d5565b34801561023657600080fd5b506000546001600160a01b03166101a0565b34801561025457600080fd5b5061010d610263366004610f8b565b6105e9565b34801561027457600080fd5b5061010d610283366004610ff3565b61063a565b34801561029457600080fd5b5061016d6102a3366004611094565b63bc197c8160e01b95945050505050565b3480156102c057600080fd5b5061016d6102cf366004611141565b63f23a6e6160e01b95945050505050565b3480156102ec57600080fd5b506101d86102fb3660046111a9565b61064c565b34801561030c57600080fd5b506101d861031b3660046111a9565b6106ca565b60006001600160e01b03198216630271189760e51b148061035157506301ffc9a760e01b6001600160e01b03198316145b92915050565b600061036161077f565b600080808061037b61037660208801886111c6565b6107d8565b919550935091506103988383610391898061120c565b919061085f565b90506103b4898989876103ab8b8061120c565b939291906108a5565b60006103e86103c3888061120c565b6103d490604081019060200161122c565b6001600160401b03168360809190911b1790565b90506103f3816108da565b15610411576040516370de22b760e01b815260040160405180910390fd5b60008a6001600160a01b03168a8a60405161042d929190611255565b6000604051808303816000865af19150503d806000811461046a576040519150601f19603f3d011682016040523d82523d6000602084013e61046f565b606091505b505090508015610524576040516306449da160e41b815260026004820152602481018390526001604482015273__$f57eb21c11c6dae369da3ca36f4f48eb77$__90636449da109060640160006040518083038186803b1580156104d257600080fd5b505af41580156104e6573d6000803e3d6000fd5b505050507f0eb7ee080f865f1cadc4f54daf58cc3b8879e888832867d13351edcec0fbdc548260405161051b91815260200190565b60405180910390a15b9550505050505061053460018055565b949350505050565b33301461055c5760405163a08d601d60e01b815260040160405180910390fd5b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146105a9576040519150601f19603f3d011682016040523d82523d6000602084013e6105ae565b606091505b50509050806105d057604051630ce8f45160e31b815260040160405180910390fd5b505050565b6105dd610958565b6105e760006109b2565b565b60008080806105fe61037660208701876111c6565b919450925090506106148282610391888061120c565b5061062d878785610625898061120c565b929190610a02565b5060019695505050505050565b6000608082901b8317610534816108da565b610654610958565b6001600160a01b0381166106be5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6106c7816109b2565b50565b6106d2610958565b600380546001600160a01b0319166001600160a01b0383169081179091556040805163b688a36360e01b8152905163b688a3639160048082019260009290919082900301818387803b15801561072757600080fd5b505af115801561073b573d6000803e3d6000fd5b50506040516001600160a01b03841681527f4991c6f37185659e276ff918a96f3e20e6c5abcd8c9aab450dc19c2f7ad35cb59250602001905060405180910390a150565b6002600154036107d15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016106b5565b6002600155565b60035460405163035e6a0960e61b8152600091829182916001600160a01b03169063d79a8240906108119030908990899060040161128e565b606060405180830381865afa15801561082e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085291906112bc565b9250925092509250925092565b60008061086f602086018661122c565b610882906001600160401b0316856112ea565b9050828111156105345760405163fd9ae91f60e01b815260040160405180910390fd5b60006108b2858585610a29565b90506108d2868284606083013560255b6001600160401b03166015610a58565b505050505050565b6040516303fbaf7360e01b8152600260048201526024810182905260009073__$f57eb21c11c6dae369da3ca36f4f48eb77$__906303fbaf7390604401602060405180830381865af4158015610934573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610351919061130b565b6000546001600160a01b031633146105e75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106b5565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610a0e8484610cfe565b9050610a22858284608083013560256108c2565b5050505050565b6060838383604051602001610a409392919061128e565b60405160208183030381529060405290509392505050565b6040805160608089013560208301526080808a01359383019390935260a0890135908201528591016040516020818303038152906040528051906020012014610ab457604051636fbd3b7160e11b815260040160405180910390fd5b8273__$2a7ef22e717e9afc55afc95d018bf1a85b$__6379de4601610af0610adf60208b018b61122c565b60051b681fffffffffffffffe01690565b60058660408c0135610b0560e08e018e61132d565b6040518763ffffffff1660e01b8152600401610b2696959493929190611376565b602060405180830381865af4158015610b43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6791906113d9565b14610b8557604051634371daa160e11b815260040160405180910390fd5b600073__$2a7ef22e717e9afc55afc95d018bf1a85b$__63c84583a18780519060200120604051602001610bbb91815260200190565b60408051601f19818403018152908290526001600160e01b031960e084901b168252610bec916005906004016113f2565b602060405180830381865af4158015610c09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2d91906113d9565b9050866040013573__$2a7ef22e717e9afc55afc95d018bf1a85b$__6379de4601610c648a6020016020810190610adf919061122c565b60058686610c7560c08f018f61132d565b6040518763ffffffff1660e01b8152600401610c9696959493929190611376565b602060405180830381865af4158015610cb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd791906113d9565b14610cf55760405163017c689560e61b815260040160405180910390fd5b50505050505050565b60608282604051602001610d13929190611450565b604051602081830303815290604052905092915050565b600060208284031215610d3c57600080fd5b81356001600160e01b031981168114610d5457600080fd5b9392505050565b6001600160a01b03811681146106c757600080fd5b60008083601f840112610d8257600080fd5b5081356001600160401b03811115610d9957600080fd5b602083019150836020828501011115610db157600080fd5b9250929050565b600060408284031215610dca57600080fd5b50919050565b60008060008060608587031215610de657600080fd5b8435610df181610d5b565b935060208501356001600160401b0380821115610e0d57600080fd5b610e1988838901610d70565b90955093506040870135915080821115610e3257600080fd5b50610e3f87828801610db8565b91505092959194509250565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715610e8957610e89610e4b565b604052919050565b600082601f830112610ea257600080fd5b81356001600160401b03811115610ebb57610ebb610e4b565b610ece601f8201601f1916602001610e61565b818152846020838601011115610ee357600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215610f1657600080fd5b8435610f2181610d5b565b93506020850135610f3181610d5b565b92506040850135915060608501356001600160401b03811115610f5357600080fd5b610e3f87828801610e91565b60008060408385031215610f7257600080fd5b8235610f7d81610d5b565b946020939093013593505050565b600080600060408486031215610fa057600080fd5b83356001600160401b0380821115610fb757600080fd5b610fc387838801610d70565b90955093506020860135915080821115610fdc57600080fd5b50610fe986828701610db8565b9150509250925092565b6000806040838503121561100657600080fd5b50508035926020909101359150565b600082601f83011261102657600080fd5b813560206001600160401b0382111561104157611041610e4b565b8160051b611050828201610e61565b928352848101820192828101908785111561106a57600080fd5b83870192505b8483101561108957823582529183019190830190611070565b979650505050505050565b600080600080600060a086880312156110ac57600080fd5b85356110b781610d5b565b945060208601356110c781610d5b565b935060408601356001600160401b03808211156110e357600080fd5b6110ef89838a01611015565b9450606088013591508082111561110557600080fd5b61111189838a01611015565b9350608088013591508082111561112757600080fd5b5061113488828901610e91565b9150509295509295909350565b600080600080600060a0868803121561115957600080fd5b853561116481610d5b565b9450602086013561117481610d5b565b9350604086013592506060860135915060808601356001600160401b0381111561119d57600080fd5b61113488828901610e91565b6000602082840312156111bb57600080fd5b8135610d5481610d5b565b6000808335601e198436030181126111dd57600080fd5b8301803591506001600160401b038211156111f757600080fd5b602001915036819003821315610db157600080fd5b6000823560fe1983360301811261122257600080fd5b9190910192915050565b60006020828403121561123e57600080fd5b81356001600160401b0381168114610d5457600080fd5b8183823760009101908152919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03841681526040602082018190526000906112b39083018486611265565b95945050505050565b6000806000606084860312156112d157600080fd5b8351925060208401519150604084015190509250925092565b8082018082111561035157634e487b7160e01b600052601160045260246000fd5b60006020828403121561131d57600080fd5b81518015158114610d5457600080fd5b6000808335601e1984360301811261134457600080fd5b8301803591506001600160401b0382111561135e57600080fd5b6020019150600581901b3603821315610db157600080fd5b6001600160401b03878116825286166020820152604081018590526060810184905260a060808201819052810182905260006001600160fb1b038311156113bc57600080fd5b8260051b808560c08501379190910160c001979650505050505050565b6000602082840312156113eb57600080fd5b5051919050565b604081526000835180604084015260005b818110156114205760208187018101516060868401015201611403565b506000606082850101526060601f19601f8301168401019150506001600160401b03831660208301529392505050565b60208152600061053460208301848661126556fea2646970667358221220981835fbbf44aedaeb41e0c0c9001ffe55187a0b5606db0cdbf7500fc7c5e30e64736f6c63430008130033a2646970667358221220a12c770ef21751c306949fd9ed57ed453446a67f2dfb1d63d08c918461eca99764736f6c63430008130033", - "libraries": { - "Bitmask": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", - "MerkleV2": "0x33436035441927Df1a73FE3AAC5906854632e53d" - }, - "devdoc": { - "events": { - "ApplicationCreated(address,address,bytes32,address)": { - "details": "MUST be triggered on a successful call to `newApplication`.", - "params": { - "application": "The application", - "consensus": "The initial consensus contract", - "dappOwner": "The initial DApp owner", - "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": { - "_consensus": "The initial consensus contract", - "_dappOwner": "The initial DApp owner", - "_salt": "The salt used to deterministically generate the DApp address", - "_templateHash": "The initial machine state hash" - }, - "returns": { - "_0": "The deterministic application address" - } - }, - "newApplication(address,address,bytes32)": { - "details": "On success, MUST emit an `ApplicationCreated` event.", - "params": { - "_consensus": "The initial consensus contract", - "_dappOwner": "The initial DApp owner", - "_templateHash": "The initial machine state hash" - }, - "returns": { - "_0": "The application" - } - }, - "newApplication(address,address,bytes32,bytes32)": { - "details": "On success, MUST emit an `ApplicationCreated` event.", - "params": { - "_consensus": "The initial consensus contract", - "_dappOwner": "The initial DApp owner", - "_salt": "The salt used to deterministically generate the DApp address", - "_templateHash": "The initial machine state hash" - }, - "returns": { - "_0": "The application" - } - } - }, - "title": "Cartesi DApp 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 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 `CartesiDApp` contract.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/deployments/optimism/ERC1155BatchPortal.json b/deployments/optimism/ERC1155BatchPortal.json deleted file mode 100644 index 032617a46..000000000 --- a/deployments/optimism/ERC1155BatchPortal.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "address": "0xedB53860A6B52bbb7561Ad596416ee9965B055Aa", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC1155", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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": "0xadf833f9dcfe517990afa0380f16166fa475a0e2a41a1e5079f35ddd56216715", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 16, - "gasUsed": "370846", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xb804b51294d0ad3ce1fe4f0118e2690c42891cd2d932a7e48031352f15aedb7b", - "transactionHash": "0xadf833f9dcfe517990afa0380f16166fa475a0e2a41a1e5079f35ddd56216715", - "logs": [], - "blockNumber": 107433008, - "cumulativeGasUsed": "3106011", - "status": 1, - "byzantium": true - }, - "args": [ - "0x59b22D57D4f067708AB0c00552767405926dc768" - ], - "numDeployments": 1, - "solcInputHash": "d2696284402b6703b2d41170c93ef3b7", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"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\":\"_dapp\",\"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 `_tokenIds` and `_values` have the same length.\",\"params\":{\"_baseLayerData\":\"Additional data to be interpreted by the base layer\",\"_dapp\":\"The address of the DApp\",\"_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 to a DApp and add an input to the DApp'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 input relay.\"}},\"notice\":\"This contract allows anyone to perform batch transfers of ERC-1155 tokens to a DApp 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 v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token 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 amount 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 `amount` tokens of token type `id` from `from` to `to`.\\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 `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 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` 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 amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon 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 caller.\\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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"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 and relays.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Ether being sent in Wei\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\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 ret The return value of `transferFrom`\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param amount The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\n function encodeERC20Deposit(\\n bool ret,\\n IERC20 token,\\n address sender,\\n uint256 amount,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n ret, // 1B\\n token, // 20B\\n sender, // 20B\\n amount, // 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\\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\\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\\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 /// @notice Encode a DApp address relay.\\n /// @param dapp The DApp address\\n /// @return The encoded input\\n function encodeDAppAddressRelay(\\n address dapp\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n dapp // 20B\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5dce266a7b70ba86adf6a728c7667255d3e2b20f1789a951150a1d05439b7019\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputRelay.sol\":{\"content\":\"// (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 \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay interface\\ninterface IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this input relay.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x8c9316c43cc2c7754fbd5abccfcdbc5ed09a2f1228d993240eac6c41ea531521\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/InputRelay.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputRelay} from \\\"./IInputRelay.sol\\\";\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay\\n/// @notice This contract serves as a base for all the other input relays.\\ncontract InputRelay is IInputRelay {\\n /// @notice The input box used by the input relay.\\n IInputBox internal immutable inputBox;\\n\\n /// @notice Constructs the input relay.\\n /// @param _inputBox The input box used by the input relay\\n constructor(IInputBox _inputBox) {\\n inputBox = _inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return inputBox;\\n }\\n}\\n\",\"keccak256\":\"0xbb489f157a0bd7a9da29b0bf3c47c4b4051d90ccd252abc3f81c8e897329e590\",\"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 {InputRelay} from \\\"../inputs/InputRelay.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 a DApp while informing the off-chain machine.\\ncontract ERC1155BatchPortal is InputRelay, IERC1155BatchPortal {\\n /// @notice Constructs the portal.\\n /// @param _inputBox The input box used by the portal\\n constructor(IInputBox _inputBox) InputRelay(_inputBox) {}\\n\\n function depositBatchERC1155Token(\\n IERC1155 _token,\\n address _dapp,\\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 _dapp,\\n _tokenIds,\\n _values,\\n _baseLayerData\\n );\\n\\n bytes memory input = InputEncoding.encodeBatchERC1155Deposit(\\n _token,\\n msg.sender,\\n _tokenIds,\\n _values,\\n _baseLayerData,\\n _execLayerData\\n );\\n\\n inputBox.addInput(_dapp, input);\\n }\\n}\\n\",\"keccak256\":\"0x8aab3384ab673cf9dd34da33b2a1c9efbbfb4960acaee44c7d50c63344237d86\",\"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 {IInputRelay} from \\\"../inputs/IInputRelay.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title ERC-1155 Batch Transfer Portal interface\\ninterface IERC1155BatchPortal is IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Transfer a batch of ERC-1155 tokens to a DApp and add an input to\\n /// the DApp'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 _dapp The address of the DApp\\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 `_tokenIds` and `_values` have the same length.\\n function depositBatchERC1155Token(\\n IERC1155 _token,\\n address _dapp,\\n uint256[] calldata _tokenIds,\\n uint256[] calldata _values,\\n bytes calldata _baseLayerData,\\n bytes calldata _execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0xfd76007f27ca0b4886d477eabdbda517e6a4a139c2b044cd8b59debf4894016d\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b5060405161064538038061064583398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516105b461009160003960008181603c015261012601526105b46000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806324d15c6714610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a6100853660046102c1565b61008c565b005b604051631759616b60e11b81526001600160a01b038b1690632eb2c2d6906100c69033908d908d908d908d908d908d908d90600401610404565b600060405180830381600087803b1580156100e057600080fd5b505af11580156100f4573d6000803e3d6000fd5b50505050600061010c8b338b8b8b8b8b8b8b8b6101ae565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061015d908d90859060040161048c565b6020604051808303816000875af115801561017c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a091906104ce565b505050505050505050505050565b6060600089898989898989896040516020016101d19897969594939291906104e7565b60405160208183030381529060405290508b8b826040516020016101f793929190610538565b6040516020818303038152906040529150509a9950505050505050505050565b80356001600160a01b038116811461022e57600080fd5b919050565b60008083601f84011261024557600080fd5b50813567ffffffffffffffff81111561025d57600080fd5b6020830191508360208260051b850101111561027857600080fd5b9250929050565b60008083601f84011261029157600080fd5b50813567ffffffffffffffff8111156102a957600080fd5b60208301915083602082850101111561027857600080fd5b60008060008060008060008060008060c08b8d0312156102e057600080fd5b6102e98b610217565b99506102f760208c01610217565b985060408b013567ffffffffffffffff8082111561031457600080fd5b6103208e838f01610233565b909a50985060608d013591508082111561033957600080fd5b6103458e838f01610233565b909850965060808d013591508082111561035e57600080fd5b61036a8e838f0161027f565b909650945060a08d013591508082111561038357600080fd5b506103908d828e0161027f565b915080935050809150509295989b9194979a5092959850565b81835260006001600160fb1b038311156103c257600080fd5b8260051b80836020870137939093016020019392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0389811682528816602082015260a060408201819052600090610431908301888a6103a9565b82810360608401526104448187896103a9565b905082810360808401526104598185876103db565b9b9a5050505050505050505050565b60005b8381101561048357818101518382015260200161046b565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526104b9816060850160208701610468565b601f01601f1916919091016060019392505050565b6000602082840312156104e057600080fd5b5051919050565b6080815260006104fb608083018a8c6103a9565b828103602084015261050e81898b6103a9565b905082810360408401526105238187896103db565b905082810360608401526104598185876103db565b60006bffffffffffffffffffffffff19808660601b168352808560601b16601484015250825161056f816028850160208701610468565b9190910160280194935050505056fea2646970667358221220b1261ceaf7c0f69c5d0d611864ae36802a7987738f02b3c9f93c1843357f32eb64736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806324d15c6714610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a6100853660046102c1565b61008c565b005b604051631759616b60e11b81526001600160a01b038b1690632eb2c2d6906100c69033908d908d908d908d908d908d908d90600401610404565b600060405180830381600087803b1580156100e057600080fd5b505af11580156100f4573d6000803e3d6000fd5b50505050600061010c8b338b8b8b8b8b8b8b8b6101ae565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061015d908d90859060040161048c565b6020604051808303816000875af115801561017c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a091906104ce565b505050505050505050505050565b6060600089898989898989896040516020016101d19897969594939291906104e7565b60405160208183030381529060405290508b8b826040516020016101f793929190610538565b6040516020818303038152906040529150509a9950505050505050505050565b80356001600160a01b038116811461022e57600080fd5b919050565b60008083601f84011261024557600080fd5b50813567ffffffffffffffff81111561025d57600080fd5b6020830191508360208260051b850101111561027857600080fd5b9250929050565b60008083601f84011261029157600080fd5b50813567ffffffffffffffff8111156102a957600080fd5b60208301915083602082850101111561027857600080fd5b60008060008060008060008060008060c08b8d0312156102e057600080fd5b6102e98b610217565b99506102f760208c01610217565b985060408b013567ffffffffffffffff8082111561031457600080fd5b6103208e838f01610233565b909a50985060608d013591508082111561033957600080fd5b6103458e838f01610233565b909850965060808d013591508082111561035e57600080fd5b61036a8e838f0161027f565b909650945060a08d013591508082111561038357600080fd5b506103908d828e0161027f565b915080935050809150509295989b9194979a5092959850565b81835260006001600160fb1b038311156103c257600080fd5b8260051b80836020870137939093016020019392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0389811682528816602082015260a060408201819052600090610431908301888a6103a9565b82810360608401526104448187896103a9565b905082810360808401526104598185876103db565b9b9a5050505050505050505050565b60005b8381101561048357818101518382015260200161046b565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526104b9816060850160208701610468565b601f01601f1916919091016060019392505050565b6000602082840312156104e057600080fd5b5051919050565b6080815260006104fb608083018a8c6103a9565b828103602084015261050e81898b6103a9565b905082810360408401526105238187896103db565b905082810360608401526104598185876103db565b60006bffffffffffffffffffffffff19808660601b168352808560601b16601484015250825161056f816028850160208701610468565b9190910160280194935050505056fea2646970667358221220b1261ceaf7c0f69c5d0d611864ae36802a7987738f02b3c9f93c1843357f32eb64736f6c63430008130033", - "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 `_tokenIds` and `_values` have the same length.", - "params": { - "_baseLayerData": "Additional data to be interpreted by the base layer", - "_dapp": "The address of the DApp", - "_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 to a DApp and add an input to the DApp'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 input relay." - } - }, - "notice": "This contract allows anyone to perform batch transfers of ERC-1155 tokens to a DApp while informing the off-chain machine.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/deployments/optimism/ERC1155SinglePortal.json b/deployments/optimism/ERC1155SinglePortal.json deleted file mode 100644 index a8efea0ba..000000000 --- a/deployments/optimism/ERC1155SinglePortal.json +++ /dev/null @@ -1,138 +0,0 @@ -{ - "address": "0x7CFB0193Ca87eB6e48056885E026552c3A941FC4", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC1155", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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": "0x840ce0b8cf486bcacf5467f5a5440ce532f47504acbb8dcf6740040e9cd3ca2c", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 14, - "gasUsed": "317454", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x69830ed824e0c1a06c5a6b17579c54a8e822ca8970ad723443e9d43f649a3153", - "transactionHash": "0x840ce0b8cf486bcacf5467f5a5440ce532f47504acbb8dcf6740040e9cd3ca2c", - "logs": [], - "blockNumber": 107433006, - "cumulativeGasUsed": "3127686", - "status": 1, - "byzantium": true - }, - "args": [ - "0x59b22D57D4f067708AB0c00552767405926dc768" - ], - "numDeployments": 1, - "solcInputHash": "d2696284402b6703b2d41170c93ef3b7", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"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\":\"_dapp\",\"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\":{\"_baseLayerData\":\"Additional data to be interpreted by the base layer\",\"_dapp\":\"The address of the DApp\",\"_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 an ERC-1155 token to a DApp and add an input to the DApp'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 input relay.\"}},\"notice\":\"This contract allows anyone to perform single transfers of ERC-1155 tokens to a DApp 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 v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token 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 amount 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 `amount` tokens of token type `id` from `from` to `to`.\\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 `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 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` 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 amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon 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 caller.\\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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"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 and relays.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Ether being sent in Wei\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\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 ret The return value of `transferFrom`\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param amount The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\n function encodeERC20Deposit(\\n bool ret,\\n IERC20 token,\\n address sender,\\n uint256 amount,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n ret, // 1B\\n token, // 20B\\n sender, // 20B\\n amount, // 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\\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\\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\\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 /// @notice Encode a DApp address relay.\\n /// @param dapp The DApp address\\n /// @return The encoded input\\n function encodeDAppAddressRelay(\\n address dapp\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n dapp // 20B\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5dce266a7b70ba86adf6a728c7667255d3e2b20f1789a951150a1d05439b7019\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputRelay.sol\":{\"content\":\"// (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 \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay interface\\ninterface IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this input relay.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x8c9316c43cc2c7754fbd5abccfcdbc5ed09a2f1228d993240eac6c41ea531521\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/InputRelay.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputRelay} from \\\"./IInputRelay.sol\\\";\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay\\n/// @notice This contract serves as a base for all the other input relays.\\ncontract InputRelay is IInputRelay {\\n /// @notice The input box used by the input relay.\\n IInputBox internal immutable inputBox;\\n\\n /// @notice Constructs the input relay.\\n /// @param _inputBox The input box used by the input relay\\n constructor(IInputBox _inputBox) {\\n inputBox = _inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return inputBox;\\n }\\n}\\n\",\"keccak256\":\"0xbb489f157a0bd7a9da29b0bf3c47c4b4051d90ccd252abc3f81c8e897329e590\",\"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 {InputRelay} from \\\"../inputs/InputRelay.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 a DApp while informing the off-chain machine.\\ncontract ERC1155SinglePortal is InputRelay, IERC1155SinglePortal {\\n /// @notice Constructs the portal.\\n /// @param _inputBox The input box used by the portal\\n constructor(IInputBox _inputBox) InputRelay(_inputBox) {}\\n\\n function depositSingleERC1155Token(\\n IERC1155 _token,\\n address _dapp,\\n uint256 _tokenId,\\n uint256 _value,\\n bytes calldata _baseLayerData,\\n bytes calldata _execLayerData\\n ) external override {\\n _token.safeTransferFrom(\\n msg.sender,\\n _dapp,\\n _tokenId,\\n _value,\\n _baseLayerData\\n );\\n\\n bytes memory input = InputEncoding.encodeSingleERC1155Deposit(\\n _token,\\n msg.sender,\\n _tokenId,\\n _value,\\n _baseLayerData,\\n _execLayerData\\n );\\n\\n inputBox.addInput(_dapp, input);\\n }\\n}\\n\",\"keccak256\":\"0x1647752c6abb80e283258cc863425845d31f3b2a53f85bc4d1db91853416b434\",\"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 {IInputRelay} from \\\"../inputs/IInputRelay.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title ERC-1155 Single Transfer Portal interface\\ninterface IERC1155SinglePortal is IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Transfer an ERC-1155 token to a DApp and add an input to\\n /// the DApp'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 _dapp The address of the DApp\\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 _dapp,\\n uint256 _tokenId,\\n uint256 _value,\\n bytes calldata _baseLayerData,\\n bytes calldata _execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0x1d3c93c70d81ede71436b43dfecbfa9f644010ca08f4197bfb966831451dab6d\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b5060405161054e38038061054e83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516104bd61009160003960008181603c015261012001526104bd6000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a578063dec07dca14610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a61008536600461026a565b61008c565b005b604051637921219560e11b81526001600160a01b0389169063f242432a906100c29033908b908b908b908b908b9060040161033b565b600060405180830381600087803b1580156100dc57600080fd5b505af11580156100f0573d6000803e3d6000fd5b50505050600061010689338989898989896101a6565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd6390610157908b9085906004016103a6565b6020604051808303816000875af1158015610176573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019a91906103e8565b50505050505050505050565b60606000858585856040516020016101c19493929190610401565b604051602081830303815290604052905089898989846040516020016101eb959493929190610433565b60405160208183030381529060405291505098975050505050505050565b6001600160a01b038116811461021e57600080fd5b50565b60008083601f84011261023357600080fd5b50813567ffffffffffffffff81111561024b57600080fd5b60208301915083602082850101111561026357600080fd5b9250929050565b60008060008060008060008060c0898b03121561028657600080fd5b883561029181610209565b975060208901356102a181610209565b96506040890135955060608901359450608089013567ffffffffffffffff808211156102cc57600080fd5b6102d88c838d01610221565b909650945060a08b01359150808211156102f157600080fd5b506102fe8b828c01610221565b999c989b5096995094979396929594505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03878116825286166020820152604081018590526060810184905260a0608082018190526000906103769083018486610312565b98975050505050505050565b60005b8381101561039d578181015183820152602001610385565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526103d3816060850160208701610382565b601f01601f1916919091016060019392505050565b6000602082840312156103fa57600080fd5b5051919050565b604081526000610415604083018688610312565b8281036020840152610428818587610312565b979650505050505050565b60006bffffffffffffffffffffffff19808860601b168352808760601b166014840152508460288301528360488301528251610476816068850160208701610382565b91909101606801969550505050505056fea26469706673582212208a2be17b506fdeea2c29cef703e184884f695e71e9147dce06da5055620ed53364736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a578063dec07dca14610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a61008536600461026a565b61008c565b005b604051637921219560e11b81526001600160a01b0389169063f242432a906100c29033908b908b908b908b908b9060040161033b565b600060405180830381600087803b1580156100dc57600080fd5b505af11580156100f0573d6000803e3d6000fd5b50505050600061010689338989898989896101a6565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd6390610157908b9085906004016103a6565b6020604051808303816000875af1158015610176573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019a91906103e8565b50505050505050505050565b60606000858585856040516020016101c19493929190610401565b604051602081830303815290604052905089898989846040516020016101eb959493929190610433565b60405160208183030381529060405291505098975050505050505050565b6001600160a01b038116811461021e57600080fd5b50565b60008083601f84011261023357600080fd5b50813567ffffffffffffffff81111561024b57600080fd5b60208301915083602082850101111561026357600080fd5b9250929050565b60008060008060008060008060c0898b03121561028657600080fd5b883561029181610209565b975060208901356102a181610209565b96506040890135955060608901359450608089013567ffffffffffffffff808211156102cc57600080fd5b6102d88c838d01610221565b909650945060a08b01359150808211156102f157600080fd5b506102fe8b828c01610221565b999c989b5096995094979396929594505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03878116825286166020820152604081018590526060810184905260a0608082018190526000906103769083018486610312565b98975050505050505050565b60005b8381101561039d578181015183820152602001610385565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526103d3816060850160208701610382565b601f01601f1916919091016060019392505050565b6000602082840312156103fa57600080fd5b5051919050565b604081526000610415604083018688610312565b8281036020840152610428818587610312565b979650505050505050565b60006bffffffffffffffffffffffff19808860601b168352808760601b166014840152508460288301528360488301528251610476816068850160208701610382565b91909101606801969550505050505056fea26469706673582212208a2be17b506fdeea2c29cef703e184884f695e71e9147dce06da5055620ed53364736f6c63430008130033", - "devdoc": { - "kind": "dev", - "methods": { - "constructor": { - "params": { - "_inputBox": "The input box used by the portal" - } - }, - "depositSingleERC1155Token(address,address,uint256,uint256,bytes,bytes)": { - "params": { - "_baseLayerData": "Additional data to be interpreted by the base layer", - "_dapp": "The address of the DApp", - "_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 an ERC-1155 token to a DApp and add an input to the DApp'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 input relay." - } - }, - "notice": "This contract allows anyone to perform single transfers of ERC-1155 tokens to a DApp while informing the off-chain machine.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/deployments/optimism/ERC20Portal.json b/deployments/optimism/ERC20Portal.json deleted file mode 100644 index a272df229..000000000 --- a/deployments/optimism/ERC20Portal.json +++ /dev/null @@ -1,126 +0,0 @@ -{ - "address": "0x9C21AEb2093C32DDbC53eEF24B873BDCd1aDa1DB", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC20", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "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": "0xdc2ab58fdd720f3ced92e786584375732d214944c905bcbb98906e4f8e850178", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 10, - "gasUsed": "265762", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xd199adb90aacab58b1d2daa9efcb6b3d5c45ad466c7474525b4a4984ff24a94c", - "transactionHash": "0xdc2ab58fdd720f3ced92e786584375732d214944c905bcbb98906e4f8e850178", - "logs": [], - "blockNumber": 107432999, - "cumulativeGasUsed": "1323077", - "status": 1, - "byzantium": true - }, - "args": [ - "0x59b22D57D4f067708AB0c00552767405926dc768" - ], - "numDeployments": 1, - "solcInputHash": "d2696284402b6703b2d41170c93ef3b7", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"_inputBox\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_dapp\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"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\":{\"_amount\":\"The amount of tokens to be transferred\",\"_dapp\":\"The address of the DApp\",\"_execLayerData\":\"Additional data to be interpreted by the execution layer\",\"_token\":\"The ERC-20 token contract\"}},\"getInputBox()\":{\"returns\":{\"_0\":\"The input box\"}}},\"title\":\"ERC-20 Portal\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs the portal.\"},\"depositERC20Tokens(address,address,uint256,bytes)\":{\"notice\":\"Transfer ERC-20 tokens to a DApp and add an input to the DApp's input box to signal such operation. The caller must allow the portal to withdraw at least `_amount` tokens from their account beforehand, by calling the `approve` function in the token contract.\"},\"getInputBox()\":{\"notice\":\"Get the input box used by this input relay.\"}},\"notice\":\"This contract allows anyone to perform transfers of ERC-20 tokens to a DApp 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 v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token 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 amount 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 `amount` tokens of token type `id` from `from` to `to`.\\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 `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 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` 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 amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon 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 caller.\\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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"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 and relays.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Ether being sent in Wei\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\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 ret The return value of `transferFrom`\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param amount The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\n function encodeERC20Deposit(\\n bool ret,\\n IERC20 token,\\n address sender,\\n uint256 amount,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n ret, // 1B\\n token, // 20B\\n sender, // 20B\\n amount, // 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\\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\\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\\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 /// @notice Encode a DApp address relay.\\n /// @param dapp The DApp address\\n /// @return The encoded input\\n function encodeDAppAddressRelay(\\n address dapp\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n dapp // 20B\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5dce266a7b70ba86adf6a728c7667255d3e2b20f1789a951150a1d05439b7019\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputRelay.sol\":{\"content\":\"// (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 \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay interface\\ninterface IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this input relay.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x8c9316c43cc2c7754fbd5abccfcdbc5ed09a2f1228d993240eac6c41ea531521\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/InputRelay.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputRelay} from \\\"./IInputRelay.sol\\\";\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay\\n/// @notice This contract serves as a base for all the other input relays.\\ncontract InputRelay is IInputRelay {\\n /// @notice The input box used by the input relay.\\n IInputBox internal immutable inputBox;\\n\\n /// @notice Constructs the input relay.\\n /// @param _inputBox The input box used by the input relay\\n constructor(IInputBox _inputBox) {\\n inputBox = _inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return inputBox;\\n }\\n}\\n\",\"keccak256\":\"0xbb489f157a0bd7a9da29b0bf3c47c4b4051d90ccd252abc3f81c8e897329e590\",\"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 {InputRelay} from \\\"../inputs/InputRelay.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 a DApp while informing the off-chain machine.\\ncontract ERC20Portal is InputRelay, IERC20Portal {\\n /// @notice Constructs the portal.\\n /// @param _inputBox The input box used by the portal\\n constructor(IInputBox _inputBox) InputRelay(_inputBox) {}\\n\\n function depositERC20Tokens(\\n IERC20 _token,\\n address _dapp,\\n uint256 _amount,\\n bytes calldata _execLayerData\\n ) external override {\\n bool success = _token.transferFrom(msg.sender, _dapp, _amount);\\n\\n bytes memory input = InputEncoding.encodeERC20Deposit(\\n success,\\n _token,\\n msg.sender,\\n _amount,\\n _execLayerData\\n );\\n\\n inputBox.addInput(_dapp, input);\\n }\\n}\\n\",\"keccak256\":\"0x0de20df5988c4cda715ff1b1fbf30119822b850d2541d9a7119b8d44907da31f\",\"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 {IInputRelay} from \\\"../inputs/IInputRelay.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title ERC-20 Portal interface\\ninterface IERC20Portal is IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Transfer ERC-20 tokens to a DApp and add an input to\\n /// the DApp's input box to signal such operation.\\n ///\\n /// The caller must allow the portal to withdraw at least `_amount` 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 _dapp The address of the DApp\\n /// @param _amount 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 _dapp,\\n uint256 _amount,\\n bytes calldata _execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0xaeacb82606f1a687170c230eb169094cb3eea8ddc4838dc13f4830721fb5234b\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b5060405161045f38038061045f83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516103ce61009160003960008181603c015261013501526103ce6000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806395854b8114610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a610085366004610209565b61008c565b005b6040516323b872dd60e01b81523360048201526001600160a01b03858116602483015260448201859052600091908716906323b872dd906064016020604051808303816000875af11580156100e5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061010991906102a8565b9050600061011b8288338888886101b9565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061016c90899085906004016102d1565b6020604051808303816000875af115801561018b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101af919061032f565b5050505050505050565b60608686868686866040516020016101d696959493929190610348565b60405160208183030381529060405290509695505050505050565b6001600160a01b038116811461020657600080fd5b50565b60008060008060006080868803121561022157600080fd5b853561022c816101f1565b9450602086013561023c816101f1565b935060408601359250606086013567ffffffffffffffff8082111561026057600080fd5b818801915088601f83011261027457600080fd5b81358181111561028357600080fd5b89602082850101111561029557600080fd5b9699959850939650602001949392505050565b6000602082840312156102ba57600080fd5b815180151581146102ca57600080fd5b9392505050565b60018060a01b038316815260006020604081840152835180604085015260005b8181101561030d578581018301518582016060015282016102f1565b506000606082860101526060601f19601f830116850101925050509392505050565b60006020828403121561034157600080fd5b5051919050565b86151560f81b815260006bffffffffffffffffffffffff19808860601b166001840152808760601b166015840152508460298301528284604984013750600091016049019081529594505050505056fea26469706673582212205635c4a24e9e9f5e128a69b633d53f24838d8833b76e4fca1f3bf3b490e380c664736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806395854b8114610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a610085366004610209565b61008c565b005b6040516323b872dd60e01b81523360048201526001600160a01b03858116602483015260448201859052600091908716906323b872dd906064016020604051808303816000875af11580156100e5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061010991906102a8565b9050600061011b8288338888886101b9565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061016c90899085906004016102d1565b6020604051808303816000875af115801561018b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101af919061032f565b5050505050505050565b60608686868686866040516020016101d696959493929190610348565b60405160208183030381529060405290509695505050505050565b6001600160a01b038116811461020657600080fd5b50565b60008060008060006080868803121561022157600080fd5b853561022c816101f1565b9450602086013561023c816101f1565b935060408601359250606086013567ffffffffffffffff8082111561026057600080fd5b818801915088601f83011261027457600080fd5b81358181111561028357600080fd5b89602082850101111561029557600080fd5b9699959850939650602001949392505050565b6000602082840312156102ba57600080fd5b815180151581146102ca57600080fd5b9392505050565b60018060a01b038316815260006020604081840152835180604085015260005b8181101561030d578581018301518582016060015282016102f1565b506000606082860101526060601f19601f830116850101925050509392505050565b60006020828403121561034157600080fd5b5051919050565b86151560f81b815260006bffffffffffffffffffffffff19808860601b166001840152808760601b166015840152508460298301528284604984013750600091016049019081529594505050505056fea26469706673582212205635c4a24e9e9f5e128a69b633d53f24838d8833b76e4fca1f3bf3b490e380c664736f6c63430008130033", - "devdoc": { - "kind": "dev", - "methods": { - "constructor": { - "params": { - "_inputBox": "The input box used by the portal" - } - }, - "depositERC20Tokens(address,address,uint256,bytes)": { - "params": { - "_amount": "The amount of tokens to be transferred", - "_dapp": "The address of the DApp", - "_execLayerData": "Additional data to be interpreted by the execution layer", - "_token": "The ERC-20 token contract" - } - }, - "getInputBox()": { - "returns": { - "_0": "The input box" - } - } - }, - "title": "ERC-20 Portal", - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "constructor": { - "notice": "Constructs the portal." - }, - "depositERC20Tokens(address,address,uint256,bytes)": { - "notice": "Transfer ERC-20 tokens to a DApp and add an input to the DApp's input box to signal such operation. The caller must allow the portal to withdraw at least `_amount` tokens from their account beforehand, by calling the `approve` function in the token contract." - }, - "getInputBox()": { - "notice": "Get the input box used by this input relay." - } - }, - "notice": "This contract allows anyone to perform transfers of ERC-20 tokens to a DApp while informing the off-chain machine.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/deployments/optimism/ERC721Portal.json b/deployments/optimism/ERC721Portal.json deleted file mode 100644 index ff6028082..000000000 --- a/deployments/optimism/ERC721Portal.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "address": "0x237F8DD094C0e47f4236f12b4Fa01d6Dae89fb87", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC721", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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": "0x6cf072c987bab5143b99aae08c5c4b3ee4c91f71cde9c979bca5567a2eeb901a", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 14, - "gasUsed": "308364", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x9da13e1f85c178135a379f7ff96cdc4df71a99ed657419e2bad73f7d6dcada23", - "transactionHash": "0x6cf072c987bab5143b99aae08c5c4b3ee4c91f71cde9c979bca5567a2eeb901a", - "logs": [], - "blockNumber": 107433003, - "cumulativeGasUsed": "2036486", - "status": 1, - "byzantium": true - }, - "args": [ - "0x59b22D57D4f067708AB0c00552767405926dc768" - ], - "numDeployments": 1, - "solcInputHash": "d2696284402b6703b2d41170c93ef3b7", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"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\":\"_dapp\",\"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\":{\"_baseLayerData\":\"Additional data to be interpreted by the base layer\",\"_dapp\":\"The address of the DApp\",\"_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 a DApp and add an input to the DApp'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 input relay.\"}},\"notice\":\"This contract allows anyone to perform transfers of ERC-721 tokens to a DApp 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 v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token 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 amount 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 `amount` tokens of token type `id` from `from` to `to`.\\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 `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 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` 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 amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon 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 caller.\\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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"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 and relays.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Ether being sent in Wei\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\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 ret The return value of `transferFrom`\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param amount The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\n function encodeERC20Deposit(\\n bool ret,\\n IERC20 token,\\n address sender,\\n uint256 amount,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n ret, // 1B\\n token, // 20B\\n sender, // 20B\\n amount, // 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\\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\\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\\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 /// @notice Encode a DApp address relay.\\n /// @param dapp The DApp address\\n /// @return The encoded input\\n function encodeDAppAddressRelay(\\n address dapp\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n dapp // 20B\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5dce266a7b70ba86adf6a728c7667255d3e2b20f1789a951150a1d05439b7019\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputRelay.sol\":{\"content\":\"// (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 \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay interface\\ninterface IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this input relay.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x8c9316c43cc2c7754fbd5abccfcdbc5ed09a2f1228d993240eac6c41ea531521\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/InputRelay.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputRelay} from \\\"./IInputRelay.sol\\\";\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay\\n/// @notice This contract serves as a base for all the other input relays.\\ncontract InputRelay is IInputRelay {\\n /// @notice The input box used by the input relay.\\n IInputBox internal immutable inputBox;\\n\\n /// @notice Constructs the input relay.\\n /// @param _inputBox The input box used by the input relay\\n constructor(IInputBox _inputBox) {\\n inputBox = _inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return inputBox;\\n }\\n}\\n\",\"keccak256\":\"0xbb489f157a0bd7a9da29b0bf3c47c4b4051d90ccd252abc3f81c8e897329e590\",\"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 {InputRelay} from \\\"../inputs/InputRelay.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 a DApp while informing the off-chain machine.\\ncontract ERC721Portal is InputRelay, IERC721Portal {\\n /// @notice Constructs the portal.\\n /// @param _inputBox The input box used by the portal\\n constructor(IInputBox _inputBox) InputRelay(_inputBox) {}\\n\\n function depositERC721Token(\\n IERC721 _token,\\n address _dapp,\\n uint256 _tokenId,\\n bytes calldata _baseLayerData,\\n bytes calldata _execLayerData\\n ) external override {\\n _token.safeTransferFrom(msg.sender, _dapp, _tokenId, _baseLayerData);\\n\\n bytes memory input = InputEncoding.encodeERC721Deposit(\\n _token,\\n msg.sender,\\n _tokenId,\\n _baseLayerData,\\n _execLayerData\\n );\\n\\n inputBox.addInput(_dapp, input);\\n }\\n}\\n\",\"keccak256\":\"0xe402b9ad4394ceb4e6bc0a0fe9df7fa0f9ee46709b8046ed50fe2f83ab259a9e\",\"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 {IInputRelay} from \\\"../inputs/IInputRelay.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title ERC-721 Portal interface\\ninterface IERC721Portal is IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Transfer an ERC-721 token to a DApp and add an input to\\n /// the DApp'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 _dapp The address of the DApp\\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 _dapp,\\n uint256 _tokenId,\\n bytes calldata _baseLayerData,\\n bytes calldata _execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0x9da43aa0b2c19659dd96c244ce260760d7c1c675aaec85feacd322d35b8e1844\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b5060405161052438038061052483398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b60805161049361009160003960008181603c015261011d01526104936000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806328911e8314610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a610085366004610263565b61008c565b005b604051635c46a7ef60e11b81526001600160a01b0388169063b88d4fde906100c09033908a908a908a908a9060040161032b565b600060405180830381600087803b1580156100da57600080fd5b505af11580156100ee573d6000803e3d6000fd5b505050506000610103883388888888886101a2565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd6390610154908a90859060040161038e565b6020604051808303816000875af1158015610173573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019791906103d0565b505050505050505050565b60606000858585856040516020016101bd94939291906103e9565b6040516020818303038152906040529050888888836040516020016101e59493929190610410565b604051602081830303815290604052915050979650505050505050565b6001600160a01b038116811461021757600080fd5b50565b60008083601f84011261022c57600080fd5b50813567ffffffffffffffff81111561024457600080fd5b60208301915083602082850101111561025c57600080fd5b9250929050565b600080600080600080600060a0888a03121561027e57600080fd5b873561028981610202565b9650602088013561029981610202565b955060408801359450606088013567ffffffffffffffff808211156102bd57600080fd5b6102c98b838c0161021a565b909650945060808a01359150808211156102e257600080fd5b506102ef8a828b0161021a565b989b979a50959850939692959293505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038681168252851660208201526040810184905260806060820181905260009061035f9083018486610302565b979650505050505050565b60005b8381101561038557818101518382015260200161036d565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526103bb81606085016020870161036a565b601f01601f1916919091016060019392505050565b6000602082840312156103e257600080fd5b5051919050565b6040815260006103fd604083018688610302565b828103602084015261035f818587610302565b60006bffffffffffffffffffffffff19808760601b168352808660601b16601484015250836028830152825161044d81604885016020870161036a565b919091016048019594505050505056fea2646970667358221220c2c237b79e46918de25850a3a3944f2f3cce2d65223f9c2c4e6fefb21e70609864736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806328911e8314610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a610085366004610263565b61008c565b005b604051635c46a7ef60e11b81526001600160a01b0388169063b88d4fde906100c09033908a908a908a908a9060040161032b565b600060405180830381600087803b1580156100da57600080fd5b505af11580156100ee573d6000803e3d6000fd5b505050506000610103883388888888886101a2565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd6390610154908a90859060040161038e565b6020604051808303816000875af1158015610173573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019791906103d0565b505050505050505050565b60606000858585856040516020016101bd94939291906103e9565b6040516020818303038152906040529050888888836040516020016101e59493929190610410565b604051602081830303815290604052915050979650505050505050565b6001600160a01b038116811461021757600080fd5b50565b60008083601f84011261022c57600080fd5b50813567ffffffffffffffff81111561024457600080fd5b60208301915083602082850101111561025c57600080fd5b9250929050565b600080600080600080600060a0888a03121561027e57600080fd5b873561028981610202565b9650602088013561029981610202565b955060408801359450606088013567ffffffffffffffff808211156102bd57600080fd5b6102c98b838c0161021a565b909650945060808a01359150808211156102e257600080fd5b506102ef8a828b0161021a565b989b979a50959850939692959293505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038681168252851660208201526040810184905260806060820181905260009061035f9083018486610302565b979650505050505050565b60005b8381101561038557818101518382015260200161036d565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526103bb81606085016020870161036a565b601f01601f1916919091016060019392505050565b6000602082840312156103e257600080fd5b5051919050565b6040815260006103fd604083018688610302565b828103602084015261035f818587610302565b60006bffffffffffffffffffffffff19808760601b168352808660601b16601484015250836028830152825161044d81604885016020870161036a565b919091016048019594505050505056fea2646970667358221220c2c237b79e46918de25850a3a3944f2f3cce2d65223f9c2c4e6fefb21e70609864736f6c63430008130033", - "devdoc": { - "kind": "dev", - "methods": { - "constructor": { - "params": { - "_inputBox": "The input box used by the portal" - } - }, - "depositERC721Token(address,address,uint256,bytes,bytes)": { - "params": { - "_baseLayerData": "Additional data to be interpreted by the base layer", - "_dapp": "The address of the DApp", - "_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 a DApp and add an input to the DApp'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 input relay." - } - }, - "notice": "This contract allows anyone to perform transfers of ERC-721 tokens to a DApp while informing the off-chain machine.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/deployments/optimism/EtherPortal.json b/deployments/optimism/EtherPortal.json deleted file mode 100644 index 9bda376ca..000000000 --- a/deployments/optimism/EtherPortal.json +++ /dev/null @@ -1,127 +0,0 @@ -{ - "address": "0xFfdbe43d4c855BF7e0f105c400A50857f53AB044", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "EtherTransferFailed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "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": "0x367cbf4b242de854c9ee7bbfb8cc8de3872b6d356919f50de7a8e32ac7a5fb1f", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 9, - "gasUsed": "237862", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xcdf013237d4e5af480e9406afb800cc92cec6d46fecfc227ed09a069f1055671", - "transactionHash": "0x367cbf4b242de854c9ee7bbfb8cc8de3872b6d356919f50de7a8e32ac7a5fb1f", - "logs": [], - "blockNumber": 107432995, - "cumulativeGasUsed": "2118400", - "status": 1, - "byzantium": true - }, - "args": [ - "0x59b22D57D4f067708AB0c00552767405926dc768" - ], - "numDeployments": 1, - "solcInputHash": "d2696284402b6703b2d41170c93ef3b7", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"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\":\"_dapp\",\"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\":\"All the value sent through this function is forwarded to the DApp. If the transfer fails, `EtherTransferFailed` error is raised.\",\"params\":{\"_dapp\":\"The address of the DApp\",\"_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\":\"Raised when the Ether transfer fails.\"}]},\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs the portal.\"},\"depositEther(address,bytes)\":{\"notice\":\"Transfer Ether to a DApp and add an input to the DApp's input box to signal such operation. All the value sent through this function is forwarded to the DApp.\"},\"getInputBox()\":{\"notice\":\"Get the input box used by this input relay.\"}},\"notice\":\"This contract allows anyone to perform transfers of Ether to a DApp 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 v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token 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 amount 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 `amount` tokens of token type `id` from `from` to `to`.\\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 `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 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` 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 amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon 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 caller.\\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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"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 and relays.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Ether being sent in Wei\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\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 ret The return value of `transferFrom`\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param amount The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\n function encodeERC20Deposit(\\n bool ret,\\n IERC20 token,\\n address sender,\\n uint256 amount,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n ret, // 1B\\n token, // 20B\\n sender, // 20B\\n amount, // 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\\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\\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\\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 /// @notice Encode a DApp address relay.\\n /// @param dapp The DApp address\\n /// @return The encoded input\\n function encodeDAppAddressRelay(\\n address dapp\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n dapp // 20B\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5dce266a7b70ba86adf6a728c7667255d3e2b20f1789a951150a1d05439b7019\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputRelay.sol\":{\"content\":\"// (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 \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay interface\\ninterface IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this input relay.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x8c9316c43cc2c7754fbd5abccfcdbc5ed09a2f1228d993240eac6c41ea531521\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/InputRelay.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputRelay} from \\\"./IInputRelay.sol\\\";\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay\\n/// @notice This contract serves as a base for all the other input relays.\\ncontract InputRelay is IInputRelay {\\n /// @notice The input box used by the input relay.\\n IInputBox internal immutable inputBox;\\n\\n /// @notice Constructs the input relay.\\n /// @param _inputBox The input box used by the input relay\\n constructor(IInputBox _inputBox) {\\n inputBox = _inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return inputBox;\\n }\\n}\\n\",\"keccak256\":\"0xbb489f157a0bd7a9da29b0bf3c47c4b4051d90ccd252abc3f81c8e897329e590\",\"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 {InputRelay} from \\\"../inputs/InputRelay.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 a DApp while informing the off-chain machine.\\ncontract EtherPortal is InputRelay, IEtherPortal {\\n /// @notice Raised when the Ether transfer fails.\\n error EtherTransferFailed();\\n\\n /// @notice Constructs the portal.\\n /// @param _inputBox The input box used by the portal\\n constructor(IInputBox _inputBox) InputRelay(_inputBox) {}\\n\\n function depositEther(\\n address _dapp,\\n bytes calldata _execLayerData\\n ) external payable override {\\n // We used to call `transfer()` but it's not considered safe,\\n // as it assumes gas costs are immutable (they are not).\\n (bool success, ) = _dapp.call{value: msg.value}(\\\"\\\");\\n\\n if (!success) {\\n revert EtherTransferFailed();\\n }\\n\\n bytes memory input = InputEncoding.encodeEtherDeposit(\\n msg.sender,\\n msg.value,\\n _execLayerData\\n );\\n\\n inputBox.addInput(_dapp, input);\\n }\\n}\\n\",\"keccak256\":\"0x47950c335ae2d0dd03b680d6fcd9cb26aa1333ecf6772b1f3a71a80100b8b34c\",\"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 {IInputRelay} from \\\"../inputs/IInputRelay.sol\\\";\\n\\n/// @title Ether Portal interface\\ninterface IEtherPortal is IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Transfer Ether to a DApp and add an input to\\n /// the DApp's input box to signal such operation.\\n ///\\n /// All the value sent through this function is forwarded to the DApp.\\n ///\\n /// @param _dapp The address of the DApp\\n /// @param _execLayerData Additional data to be interpreted by the execution layer\\n /// @dev All the value sent through this function is forwarded to the DApp.\\n /// If the transfer fails, `EtherTransferFailed` error is raised.\\n function depositEther(\\n address _dapp,\\n bytes calldata _execLayerData\\n ) external payable;\\n}\\n\",\"keccak256\":\"0xa8bdb1f91935db3d7ba158935164e61f042da26a9abe872edccbff28614d9143\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b506040516103de3803806103de83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b60805161034d61009160003960008181603c0152610128015261034d6000f3fe6080604052600436106100285760003560e01c8062aace9a1461002d578063938c054f14610077575b600080fd5b34801561003957600080fd5b507f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a6100853660046101dc565b61008c565b005b6000836001600160a01b03163460405160006040518083038185875af1925050503d80600081146100d9576040519150601f19603f3d011682016040523d82523d6000602084013e6100de565b606091505b505090508061010057604051630ce8f45160e31b815260040160405180910390fd5b600061010e333486866101aa565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061015f908890859060040161026d565b6020604051808303816000875af115801561017e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a291906102cb565b505050505050565b6060848484846040516020016101c394939291906102e4565b6040516020818303038152906040529050949350505050565b6000806000604084860312156101f157600080fd5b83356001600160a01b038116811461020857600080fd5b9250602084013567ffffffffffffffff8082111561022557600080fd5b818601915086601f83011261023957600080fd5b81358181111561024857600080fd5b87602082850101111561025a57600080fd5b6020830194508093505050509250925092565b60018060a01b038316815260006020604081840152835180604085015260005b818110156102a95785810183015185820160600152820161028d565b506000606082860101526060601f19601f830116850101925050509392505050565b6000602082840312156102dd57600080fd5b5051919050565b6bffffffffffffffffffffffff198560601b1681528360148201528183603483013760009101603401908152939250505056fea26469706673582212203555bb6cf9b2020729bb19c561673a225f367cd3219906075930d8b9f3fb219864736f6c63430008130033", - "deployedBytecode": "0x6080604052600436106100285760003560e01c8062aace9a1461002d578063938c054f14610077575b600080fd5b34801561003957600080fd5b507f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a6100853660046101dc565b61008c565b005b6000836001600160a01b03163460405160006040518083038185875af1925050503d80600081146100d9576040519150601f19603f3d011682016040523d82523d6000602084013e6100de565b606091505b505090508061010057604051630ce8f45160e31b815260040160405180910390fd5b600061010e333486866101aa565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061015f908890859060040161026d565b6020604051808303816000875af115801561017e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a291906102cb565b505050505050565b6060848484846040516020016101c394939291906102e4565b6040516020818303038152906040529050949350505050565b6000806000604084860312156101f157600080fd5b83356001600160a01b038116811461020857600080fd5b9250602084013567ffffffffffffffff8082111561022557600080fd5b818601915086601f83011261023957600080fd5b81358181111561024857600080fd5b87602082850101111561025a57600080fd5b6020830194508093505050509250925092565b60018060a01b038316815260006020604081840152835180604085015260005b818110156102a95785810183015185820160600152820161028d565b506000606082860101526060601f19601f830116850101925050509392505050565b6000602082840312156102dd57600080fd5b5051919050565b6bffffffffffffffffffffffff198560601b1681528360148201528183603483013760009101603401908152939250505056fea26469706673582212203555bb6cf9b2020729bb19c561673a225f367cd3219906075930d8b9f3fb219864736f6c63430008130033", - "devdoc": { - "kind": "dev", - "methods": { - "constructor": { - "params": { - "_inputBox": "The input box used by the portal" - } - }, - "depositEther(address,bytes)": { - "details": "All the value sent through this function is forwarded to the DApp. If the transfer fails, `EtherTransferFailed` error is raised.", - "params": { - "_dapp": "The address of the DApp", - "_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": "Raised when the Ether transfer fails." - } - ] - }, - "kind": "user", - "methods": { - "constructor": { - "notice": "Constructs the portal." - }, - "depositEther(address,bytes)": { - "notice": "Transfer Ether to a DApp and add an input to the DApp's input box to signal such operation. All the value sent through this function is forwarded to the DApp." - }, - "getInputBox()": { - "notice": "Get the input box used by this input relay." - } - }, - "notice": "This contract allows anyone to perform transfers of Ether to a DApp while informing the off-chain machine.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/deployments/optimism/InputBox.json b/deployments/optimism/InputBox.json deleted file mode 100644 index e15a05ba1..000000000 --- a/deployments/optimism/InputBox.json +++ /dev/null @@ -1,246 +0,0 @@ -{ - "address": "0x59b22D57D4f067708AB0c00552767405926dc768", - "abi": [ - { - "inputs": [], - "name": "InputSizeExceedsLimit", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "dapp", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "inputIndex", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "input", - "type": "bytes" - } - ], - "name": "InputAdded", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_input", - "type": "bytes" - } - ], - "name": "addInput", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "getInputHash", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - } - ], - "name": "getNumberOfInputs", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "transactionHash": "0x63a4610a6398bc58d678b784e13100150ceecd3f0a5a7f38e766982949d39698", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", - "contractAddress": null, - "transactionIndex": 15, - "gasUsed": "260666", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xae3feec1e9e116817662638782707bb689f8645796dde15b29f4ed8efb11afe4", - "transactionHash": "0x63a4610a6398bc58d678b784e13100150ceecd3f0a5a7f38e766982949d39698", - "logs": [], - "blockNumber": 107432991, - "cumulativeGasUsed": "2369502", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 1, - "solcInputHash": "d2696284402b6703b2d41170c93ef3b7", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"InputSizeExceedsLimit\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"dapp\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"inputIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"input\",\"type\":\"bytes\"}],\"name\":\"InputAdded\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_dapp\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_input\",\"type\":\"bytes\"}],\"name\":\"addInput\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_dapp\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"getInputHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_dapp\",\"type\":\"address\"}],\"name\":\"getNumberOfInputs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"InputAdded(address,uint256,address,bytes)\":{\"details\":\"MUST be triggered on a successful call to `addInput`.\",\"params\":{\"dapp\":\"The address of the DApp\",\"input\":\"The contents of the input\",\"inputIndex\":\"The index of the input in the input box\",\"sender\":\"The address that sent the input\"}}},\"kind\":\"dev\",\"methods\":{\"addInput(address,bytes)\":{\"details\":\"MUST fire an `InputAdded` event accordingly. Input larger than machine limit will raise `InputSizeExceedsLimit` error.\",\"params\":{\"_dapp\":\"The address of the DApp\",\"_input\":\"The contents of the input\"},\"returns\":{\"_0\":\"The hash of the input plus some extra metadata\"}},\"getInputHash(address,uint256)\":{\"details\":\"`_index` MUST be in the interval `[0,n)` where `n` is the number of inputs in the DApp's input box. See the `getNumberOfInputs` function.\",\"params\":{\"_dapp\":\"The address of the DApp\",\"_index\":\"The index of the input in the DApp's input box\"},\"returns\":{\"_0\":\"The hash of the input at the provided index in the DApp's input box\"}},\"getNumberOfInputs(address)\":{\"params\":{\"_dapp\":\"The address of the DApp\"},\"returns\":{\"_0\":\"Number of inputs in the DApp's input box\"}}},\"stateVariables\":{\"inputBoxes\":{\"details\":\"See the `getNumberOfInputs`, `getInputHash` and `addInput` functions.\"}},\"title\":\"Input Box\",\"version\":1},\"userdoc\":{\"errors\":{\"InputSizeExceedsLimit()\":[{\"notice\":\"Raised when input is larger than the machine limit.\"}]},\"events\":{\"InputAdded(address,uint256,address,bytes)\":{\"notice\":\"Emitted when an input is added to a DApp's input box.\"}},\"kind\":\"user\",\"methods\":{\"addInput(address,bytes)\":{\"notice\":\"Add an input to a DApp's input box.\"},\"getInputHash(address,uint256)\":{\"notice\":\"Get the hash of an input in a DApp's input box.\"},\"getNumberOfInputs(address)\":{\"notice\":\"Get the number of inputs in a DApp's input box.\"}},\"notice\":\"Trustless and permissionless contract that receives arbitrary blobs (called \\\"inputs\\\") from anyone and adds a compound hash to an append-only list (called \\\"input box\\\"). Each DApp has its own input box. The hash that is stored on-chain is composed by the hash of the input blob, the block number and timestamp, the input sender address, and the input index. Data availability is guaranteed by the emission of `InputAdded` events on every successful call to `addInput`. This ensures that inputs can be retrieved by anyone at any time, without having to rely on centralized data providers. From the perspective of this contract, inputs are encoding-agnostic byte arrays. It is up to the DApp to interpret, validate and act upon inputs.\",\"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 Base-2 logarithm of number of bytes.\\n type Log2Size is uint64;\\n\\n /// @notice Machine word size (8 bytes).\\n Log2Size constant WORD_LOG2_SIZE = Log2Size.wrap(3);\\n\\n /// @notice Machine address space size (2^64 bytes).\\n Log2Size constant MACHINE_LOG2_SIZE = Log2Size.wrap(64);\\n\\n /// @notice Keccak-256 output size (32 bytes).\\n Log2Size constant KECCAK_LOG2_SIZE = Log2Size.wrap(5);\\n\\n /// @notice Maximum input size (~2 megabytes).\\n /// @dev The offset and size fields use up the extra 64 bytes.\\n uint256 constant INPUT_MAX_SIZE = (1 << 21) - 64;\\n\\n /// @notice Maximum voucher metadata memory range (2 megabytes).\\n Log2Size constant VOUCHER_METADATA_LOG2_SIZE = Log2Size.wrap(21);\\n\\n /// @notice Maximum notice metadata memory range (2 megabytes).\\n Log2Size constant NOTICE_METADATA_LOG2_SIZE = Log2Size.wrap(21);\\n\\n /// @notice Maximum epoch voucher memory range (128 megabytes).\\n Log2Size constant EPOCH_VOUCHER_LOG2_SIZE = Log2Size.wrap(37);\\n\\n /// @notice Maximum epoch notice memory range (128 megabytes).\\n Log2Size constant EPOCH_NOTICE_LOG2_SIZE = Log2Size.wrap(37);\\n\\n /// @notice Unwrap `s` into its underlying uint64 value.\\n /// @param s Base-2 logarithm of some number of bytes\\n function uint64OfSize(Log2Size s) internal pure returns (uint64) {\\n return Log2Size.unwrap(s);\\n }\\n\\n /// @notice Return the position of an intra memory range on a memory range\\n /// with contents with the same size.\\n /// @param index Index of intra memory range\\n /// @param log2Size Base-2 logarithm of intra memory range size\\n function getIntraMemoryRangePosition(\\n uint64 index,\\n Log2Size log2Size\\n ) internal pure returns (uint64) {\\n return index << Log2Size.unwrap(log2Size);\\n }\\n}\\n\",\"keccak256\":\"0x97cdce56cdb4f0b4164e6be3a72e50469a3124e4716e753a1792aa70eac614f5\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"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.8;\\n\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\nimport {LibInput} from \\\"../library/LibInput.sol\\\";\\n\\n/// @title Input Box\\n///\\n/// @notice Trustless and permissionless contract that receives arbitrary blobs\\n/// (called \\\"inputs\\\") from anyone and adds a compound hash to an append-only list\\n/// (called \\\"input box\\\"). Each DApp has its own input box.\\n///\\n/// The hash that is stored on-chain is composed by the hash of the input blob,\\n/// the block number and timestamp, the input sender address, and the input index.\\n///\\n/// Data availability is guaranteed by the emission of `InputAdded` events\\n/// on every successful call to `addInput`. This ensures that inputs can be\\n/// retrieved by anyone at any time, without having to rely on centralized data\\n/// providers.\\n///\\n/// From the perspective of this contract, inputs are encoding-agnostic byte\\n/// arrays. It is up to the DApp to interpret, validate and act upon inputs.\\ncontract InputBox is IInputBox {\\n /// @notice Mapping from DApp address to list of input hashes.\\n /// @dev See the `getNumberOfInputs`, `getInputHash` and `addInput` functions.\\n mapping(address => bytes32[]) internal inputBoxes;\\n\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external override returns (bytes32) {\\n bytes32[] storage inputBox = inputBoxes[_dapp];\\n uint256 inputIndex = inputBox.length;\\n\\n bytes32 inputHash = LibInput.computeInputHash(\\n msg.sender,\\n block.number,\\n block.timestamp,\\n _input,\\n inputIndex\\n );\\n\\n // add input to the input box\\n inputBox.push(inputHash);\\n\\n // block.number and timestamp can be retrieved by the event metadata itself\\n emit InputAdded(_dapp, inputIndex, msg.sender, _input);\\n\\n return inputHash;\\n }\\n\\n function getNumberOfInputs(\\n address _dapp\\n ) external view override returns (uint256) {\\n return inputBoxes[_dapp].length;\\n }\\n\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view override returns (bytes32) {\\n return inputBoxes[_dapp][_index];\\n }\\n}\\n\",\"keccak256\":\"0x83d36baf0bda5a63ea5eae7e021b80eabb30f9ace14fcdb5936f0e27b779fccb\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/library/LibInput.sol\":{\"content\":\"// (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\\\";\\n\\n/// @title Input Library\\nlibrary LibInput {\\n using CanonicalMachine for CanonicalMachine.Log2Size;\\n\\n /// @notice Raised when input is larger than the machine limit.\\n error InputSizeExceedsLimit();\\n\\n /// @notice Summarize input data in a single hash.\\n /// @param sender `msg.sender`\\n /// @param blockNumber `block.number`\\n /// @param blockTimestamp `block.timestamp`\\n /// @param input The input blob\\n /// @param inputIndex The index of the input in the input box\\n /// @return The input hash\\n function computeInputHash(\\n address sender,\\n uint256 blockNumber,\\n uint256 blockTimestamp,\\n bytes calldata input,\\n uint256 inputIndex\\n ) internal pure returns (bytes32) {\\n if (input.length > CanonicalMachine.INPUT_MAX_SIZE) {\\n revert InputSizeExceedsLimit();\\n }\\n\\n bytes32 keccakMetadata = keccak256(\\n abi.encode(\\n sender,\\n blockNumber,\\n blockTimestamp,\\n 0, //TODO decide how to deal with epoch index\\n inputIndex // input index in the input box\\n )\\n );\\n\\n bytes32 keccakInput = keccak256(input);\\n\\n return keccak256(abi.encode(keccakMetadata, keccakInput));\\n }\\n}\\n\",\"keccak256\":\"0x27f2fe9efc2f6fc85687ea78e5c79a090c46ece27e7bb26e0c184a3fef62317a\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506103be806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80631789cd631461004657806361a93c871461006b578063677087c914610094575b600080fd5b610059610054366004610253565b6100a7565b60405190815260200160405180910390f35b6100596100793660046102d6565b6001600160a01b031660009081526020819052604090205490565b6100596100a23660046102f8565b61013b565b6001600160a01b03831660009081526020819052604081208054826100d0334342898987610178565b83546001810185556000858152602090200181905560405190915082906001600160a01b038916907f6aaa400068bf4ca337265e2a1e1e841f66b8597fd5b452fdc52a44bed28a0784906101299033908b908b90610322565b60405180910390a39695505050505050565b6001600160a01b038216600090815260208190526040812080548390811061016557610165610362565b9060005260206000200154905092915050565b6000621fffc083111561019e57604051634273a49560e11b815260040160405180910390fd5b604080516001600160a01b03891660208201529081018790526060810186905260006080820181905260a082018490529060c001604051602081830303815290604052805190602001209050600085856040516101fc929190610378565b604080519182900382206020808401959095528282015280518083038201815260609092019052805192019190912098975050505050505050565b80356001600160a01b038116811461024e57600080fd5b919050565b60008060006040848603121561026857600080fd5b61027184610237565b9250602084013567ffffffffffffffff8082111561028e57600080fd5b818601915086601f8301126102a257600080fd5b8135818111156102b157600080fd5b8760208285010111156102c357600080fd5b6020830194508093505050509250925092565b6000602082840312156102e857600080fd5b6102f182610237565b9392505050565b6000806040838503121561030b57600080fd5b61031483610237565b946020939093013593505050565b6001600160a01b03841681526040602082018190528101829052818360608301376000818301606090810191909152601f909201601f1916010192915050565b634e487b7160e01b600052603260045260246000fd5b818382376000910190815291905056fea264697066735822122043b0a58952371efb5f75573ec65e82305da7154e6338f4e9c00f5cc07f92c4af64736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80631789cd631461004657806361a93c871461006b578063677087c914610094575b600080fd5b610059610054366004610253565b6100a7565b60405190815260200160405180910390f35b6100596100793660046102d6565b6001600160a01b031660009081526020819052604090205490565b6100596100a23660046102f8565b61013b565b6001600160a01b03831660009081526020819052604081208054826100d0334342898987610178565b83546001810185556000858152602090200181905560405190915082906001600160a01b038916907f6aaa400068bf4ca337265e2a1e1e841f66b8597fd5b452fdc52a44bed28a0784906101299033908b908b90610322565b60405180910390a39695505050505050565b6001600160a01b038216600090815260208190526040812080548390811061016557610165610362565b9060005260206000200154905092915050565b6000621fffc083111561019e57604051634273a49560e11b815260040160405180910390fd5b604080516001600160a01b03891660208201529081018790526060810186905260006080820181905260a082018490529060c001604051602081830303815290604052805190602001209050600085856040516101fc929190610378565b604080519182900382206020808401959095528282015280518083038201815260609092019052805192019190912098975050505050505050565b80356001600160a01b038116811461024e57600080fd5b919050565b60008060006040848603121561026857600080fd5b61027184610237565b9250602084013567ffffffffffffffff8082111561028e57600080fd5b818601915086601f8301126102a257600080fd5b8135818111156102b157600080fd5b8760208285010111156102c357600080fd5b6020830194508093505050509250925092565b6000602082840312156102e857600080fd5b6102f182610237565b9392505050565b6000806040838503121561030b57600080fd5b61031483610237565b946020939093013593505050565b6001600160a01b03841681526040602082018190528101829052818360608301376000818301606090810191909152601f909201601f1916010192915050565b634e487b7160e01b600052603260045260246000fd5b818382376000910190815291905056fea264697066735822122043b0a58952371efb5f75573ec65e82305da7154e6338f4e9c00f5cc07f92c4af64736f6c63430008130033", - "devdoc": { - "events": { - "InputAdded(address,uint256,address,bytes)": { - "details": "MUST be triggered on a successful call to `addInput`.", - "params": { - "dapp": "The address of the DApp", - "input": "The contents of the input", - "inputIndex": "The index of the input in the input box", - "sender": "The address that sent the input" - } - } - }, - "kind": "dev", - "methods": { - "addInput(address,bytes)": { - "details": "MUST fire an `InputAdded` event accordingly. Input larger than machine limit will raise `InputSizeExceedsLimit` error.", - "params": { - "_dapp": "The address of the DApp", - "_input": "The contents of the input" - }, - "returns": { - "_0": "The hash of the input plus some extra metadata" - } - }, - "getInputHash(address,uint256)": { - "details": "`_index` MUST be in the interval `[0,n)` where `n` is the number of inputs in the DApp's input box. See the `getNumberOfInputs` function.", - "params": { - "_dapp": "The address of the DApp", - "_index": "The index of the input in the DApp's input box" - }, - "returns": { - "_0": "The hash of the input at the provided index in the DApp's input box" - } - }, - "getNumberOfInputs(address)": { - "params": { - "_dapp": "The address of the DApp" - }, - "returns": { - "_0": "Number of inputs in the DApp's input box" - } - } - }, - "stateVariables": { - "inputBoxes": { - "details": "See the `getNumberOfInputs`, `getInputHash` and `addInput` functions." - } - }, - "title": "Input Box", - "version": 1 - }, - "userdoc": { - "errors": { - "InputSizeExceedsLimit()": [ - { - "notice": "Raised when input is larger than the machine limit." - } - ] - }, - "events": { - "InputAdded(address,uint256,address,bytes)": { - "notice": "Emitted when an input is added to a DApp's input box." - } - }, - "kind": "user", - "methods": { - "addInput(address,bytes)": { - "notice": "Add an input to a DApp's input box." - }, - "getInputHash(address,uint256)": { - "notice": "Get the hash of an input in a DApp's input box." - }, - "getNumberOfInputs(address)": { - "notice": "Get the number of inputs in a DApp's input box." - } - }, - "notice": "Trustless and permissionless contract that receives arbitrary blobs (called \"inputs\") from anyone and adds a compound hash to an append-only list (called \"input box\"). Each DApp has its own input box. The hash that is stored on-chain is composed by the hash of the input blob, the block number and timestamp, the input sender address, and the input index. Data availability is guaranteed by the emission of `InputAdded` events on every successful call to `addInput`. This ensures that inputs can be retrieved by anyone at any time, without having to rely on centralized data providers. From the perspective of this contract, inputs are encoding-agnostic byte arrays. It is up to the DApp to interpret, validate and act upon inputs.", - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 3451, - "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/.chainId b/deployments/optimism_sepolia/.chainId deleted file mode 100644 index 03f37de82..000000000 --- a/deployments/optimism_sepolia/.chainId +++ /dev/null @@ -1 +0,0 @@ -11155420 \ No newline at end of file diff --git a/deployments/optimism_sepolia/AuthorityFactory.json b/deployments/optimism_sepolia/AuthorityFactory.json deleted file mode 100644 index 4ea820594..000000000 --- a/deployments/optimism_sepolia/AuthorityFactory.json +++ /dev/null @@ -1,183 +0,0 @@ -{ - "address": "0xf26a5b278C25D8D41A136d22Ad719EACEd9c3e63", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "authorityOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract Authority", - "name": "authority", - "type": "address" - } - ], - "name": "AuthorityCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateAuthorityAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newAuthority", - "outputs": [ - { - "internalType": "contract Authority", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - } - ], - "name": "newAuthority", - "outputs": [ - { - "internalType": "contract Authority", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0xa8591350469def6b934a306aadf0d71fc8b4a50c8d06d434008a50c76e2e0aaf", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", - "contractAddress": null, - "transactionIndex": 1, - "gasUsed": "756894", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xcd7b104c89742d48b86e39747e8bc767ff1e1b8f078429a0a19920969c41e6b7", - "transactionHash": "0xa8591350469def6b934a306aadf0d71fc8b4a50c8d06d434008a50c76e2e0aaf", - "logs": [], - "blockNumber": 5401110, - "cumulativeGasUsed": "820895", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 1, - "solcInputHash": "54ee33aea592269e6046663615f287b6", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"authorityOwner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract Authority\",\"name\":\"authority\",\"type\":\"address\"}],\"name\":\"AuthorityCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"calculateAuthorityAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"newAuthority\",\"outputs\":[{\"internalType\":\"contract Authority\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authorityOwner\",\"type\":\"address\"}],\"name\":\"newAuthority\",\"outputs\":[{\"internalType\":\"contract Authority\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"AuthorityCreated(address,address)\":{\"details\":\"MUST be triggered on a successful call to `newAuthority`.\",\"params\":{\"authority\":\"The authority\",\"authorityOwner\":\"The initial authority owner\"}}},\"kind\":\"dev\",\"methods\":{\"calculateAuthorityAddress(address,bytes32)\":{\"details\":\"Beware that only the `newAuthority` function with the `_salt` parameter is able to deterministically deploy an authority.\",\"params\":{\"_authorityOwner\":\"The initial authority owner\",\"_salt\":\"The salt used to deterministically generate the authority address\"},\"returns\":{\"_0\":\"The deterministic authority address\"}},\"newAuthority(address)\":{\"details\":\"On success, MUST emit an `AuthorityCreated` event.\",\"params\":{\"_authorityOwner\":\"The initial authority owner\"},\"returns\":{\"_0\":\"The authority\"}},\"newAuthority(address,bytes32)\":{\"details\":\"On success, MUST emit an `AuthorityCreated` event.\",\"params\":{\"_authorityOwner\":\"The initial authority owner\",\"_salt\":\"The salt used to deterministically generate the authority address\"},\"returns\":{\"_0\":\"The authority\"}}},\"title\":\"Authority Factory\",\"version\":1},\"userdoc\":{\"events\":{\"AuthorityCreated(address,address)\":{\"notice\":\"A new authority was deployed.\"}},\"kind\":\"user\",\"methods\":{\"calculateAuthorityAddress(address,bytes32)\":{\"notice\":\"Calculate the address of an authority to be deployed deterministically.\"},\"newAuthority(address)\":{\"notice\":\"Deploy a new authority.\"},\"newAuthority(address,bytes32)\":{\"notice\":\"Deploy a new authority deterministically.\"}},\"notice\":\"Allows anyone to reliably deploy a new `Authority` contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/consensus/authority/AuthorityFactory.sol\":\"AuthorityFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\\n require(address(this).balance >= amount, \\\"Create2: insufficient balance\\\");\\n require(bytecode.length != 0, \\\"Create2: bytecode length is zero\\\");\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n require(addr != address(0), \\\"Create2: Failed on deploy\\\");\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6e00f269073ffc4350e56b7e8153c9092d5f70bfba423299990514183101ef89\",\"license\":\"MIT\"},\"contracts/consensus/AbstractConsensus.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IConsensus} from \\\"./IConsensus.sol\\\";\\n\\n/// @title Abstract Consensus\\n/// @notice An abstract contract that partially implements `IConsensus`.\\nabstract contract AbstractConsensus is IConsensus {\\n /// @notice Emits an `ApplicationJoined` event with the message sender.\\n function join() external override {\\n emit ApplicationJoined(msg.sender);\\n }\\n}\\n\",\"keccak256\":\"0xced9c940ccbbe81fbfcf3bc087c04b9ae90325d6bba68a8cee9ebfa3dd9d231d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/IConsensus.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @title Consensus interface\\n///\\n/// @notice This contract defines a generic interface for consensuses.\\n/// We use the word \\\"consensus\\\" to designate a contract that provides claims\\n/// in the base layer regarding the state of off-chain machines running in\\n/// the execution layer. How this contract is able to reach consensus, who is\\n/// able to submit claims, and how are claims stored in the base layer are\\n/// some of the implementation details left unspecified by this interface.\\n///\\n/// From the point of view of a DApp, these claims are necessary to validate\\n/// on-chain action allowed by the off-chain machine in the form of vouchers\\n/// and notices. Each claim is composed of three parts: an epoch hash, a first\\n/// index, and a last index. We'll explain each of these parts below.\\n///\\n/// First, let us define the word \\\"epoch\\\". For finality reasons, we need to\\n/// divide the stream of inputs being fed into the off-chain machine into\\n/// batches of inputs, which we call \\\"epoches\\\". At the end of every epoch,\\n/// we summarize the state of the off-chain machine in a single hash, called\\n/// \\\"epoch hash\\\". Please note that this interface does not define how this\\n/// stream of inputs is being chopped up into epoches.\\n///\\n/// The other two parts are simply the indices of the first and last inputs\\n/// accepted during the epoch. Logically, the first index MUST BE less than\\n/// or equal to the last index. As a result, every epoch MUST accept at least\\n/// one input. This assumption stems from the fact that the state of a machine\\n/// can only change after an input is fed into it.\\n///\\n/// Examples of possible implementations of this interface include:\\n///\\n/// * An authority consensus, controlled by a single address who has full\\n/// control over epoch boundaries, claim submission, asset management, etc.\\n///\\n/// * A quorum consensus, controlled by a limited set of validators, that\\n/// vote on the state of the machine at the end of every epoch. Also, epoch\\n/// boundaries are determined by the timestamp in the base layer, and assets\\n/// are split equally amongst the validators.\\n///\\n/// * An NxN consensus, which allows anyone to submit and dispute claims\\n/// in the base layer. Epoch boundaries are determined in the same fashion\\n/// as in the quorum example.\\n///\\ninterface IConsensus {\\n /// @notice An application has joined the consensus' validation set.\\n /// @param application The application\\n /// @dev MUST be triggered on a successful call to `join`.\\n event ApplicationJoined(address application);\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// The encoding of `_proofContext` might vary\\n /// depending on the implementation.\\n /// @param _dapp The DApp address\\n /// @param _proofContext Data for retrieving the desired claim\\n /// @return epochHash_ The claimed epoch hash\\n /// @return firstInputIndex_ The index of the first input of the epoch in the input box\\n /// @return lastInputIndex_ The index of the last input of the epoch in the input box\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n )\\n external\\n view\\n returns (\\n bytes32 epochHash_,\\n uint256 firstInputIndex_,\\n uint256 lastInputIndex_\\n );\\n\\n /// @notice Signal the consensus that the message sender wants to join its validation set.\\n /// @dev MUST fire an `ApplicationJoined` event with the message sender as argument.\\n function join() external;\\n}\\n\",\"keccak256\":\"0xc9d295fada66eb0602e0f1e2e236708e52f959927abb4ab6b04173a98b92ac16\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/Authority.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {IConsensus} from \\\"../IConsensus.sol\\\";\\nimport {AbstractConsensus} from \\\"../AbstractConsensus.sol\\\";\\nimport {IHistory} from \\\"../../history/IHistory.sol\\\";\\n\\n/// @title Authority consensus\\n/// @notice A consensus model controlled by a single address, the owner.\\n/// Claims are stored in an auxiliary contract called `History`.\\n/// @dev This contract inherits `AbstractConsensus` and OpenZeppelin's `Ownable` contract.\\n/// For more information on `Ownable`, please consult OpenZeppelin's official documentation.\\ncontract Authority is AbstractConsensus, Ownable {\\n /// @notice The current history contract.\\n /// @dev See the `getHistory` and `setHistory` functions.\\n IHistory internal history;\\n\\n /// @notice A new history contract is used to store claims.\\n /// @param history The new history contract\\n /// @dev MUST be triggered on a successful call to `setHistory`.\\n event NewHistory(IHistory history);\\n\\n /// @notice Raised when a transfer of tokens from an authority to a recipient fails.\\n error AuthorityWithdrawalFailed();\\n\\n /// @notice Constructs an `Authority` contract.\\n /// @param _owner The initial contract owner\\n constructor(address _owner) {\\n // constructor in Ownable already called `transferOwnership(msg.sender)`, so\\n // we only need to call `transferOwnership(_owner)` if _owner != msg.sender\\n if (msg.sender != _owner) {\\n transferOwnership(_owner);\\n }\\n }\\n\\n /// @notice Submits a claim to the current history contract.\\n /// The encoding of `_claimData` might vary depending on the\\n /// implementation of the current history contract.\\n /// @param _claimData Data for submitting a claim\\n /// @dev Can only be called by the `Authority` owner,\\n /// and the `Authority` contract must have ownership over\\n /// its current history contract.\\n function submitClaim(bytes calldata _claimData) external onlyOwner {\\n history.submitClaim(_claimData);\\n }\\n\\n /// @notice Transfer ownership over the current history contract to `_consensus`.\\n /// @param _consensus The new owner of the current history contract\\n /// @dev Can only be called by the `Authority` owner,\\n /// and the `Authority` contract must have ownership over\\n /// its current history contract.\\n function migrateHistoryToConsensus(address _consensus) external onlyOwner {\\n history.migrateToConsensus(_consensus);\\n }\\n\\n /// @notice Make `Authority` point to another history contract.\\n /// @param _history The new history contract\\n /// @dev Emits a `NewHistory` event.\\n /// Can only be called by the `Authority` owner.\\n function setHistory(IHistory _history) external onlyOwner {\\n history = _history;\\n emit NewHistory(_history);\\n }\\n\\n /// @notice Get the current history contract.\\n /// @return The current history contract\\n function getHistory() external view returns (IHistory) {\\n return history;\\n }\\n\\n /// @notice Get a claim from the current history.\\n /// The encoding of `_proofContext` might vary depending on the\\n /// implementation of the current history contract.\\n /// @inheritdoc IConsensus\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n ) external view override returns (bytes32, uint256, uint256) {\\n return history.getClaim(_dapp, _proofContext);\\n }\\n\\n /// @notice Transfer some amount of ERC-20 tokens to a recipient.\\n /// @param _token The token contract\\n /// @param _recipient The recipient address\\n /// @param _amount The amount of tokens to be withdrawn\\n /// @dev Can only be called by the `Authority` owner.\\n function withdrawERC20Tokens(\\n IERC20 _token,\\n address _recipient,\\n uint256 _amount\\n ) external onlyOwner {\\n bool success = _token.transfer(_recipient, _amount);\\n\\n if (!success) {\\n revert AuthorityWithdrawalFailed();\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc71ea13163833684ce576861fbb19dc40e7096a022c6976b61a99dfc9e1c0903\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/AuthorityFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Create2} from \\\"@openzeppelin/contracts/utils/Create2.sol\\\";\\n\\nimport {IAuthorityFactory} from \\\"./IAuthorityFactory.sol\\\";\\nimport {Authority} from \\\"./Authority.sol\\\";\\n\\n/// @title Authority Factory\\n/// @notice Allows anyone to reliably deploy a new `Authority` contract.\\ncontract AuthorityFactory is IAuthorityFactory {\\n function newAuthority(\\n address _authorityOwner\\n ) external override returns (Authority) {\\n Authority authority = new Authority(_authorityOwner);\\n\\n emit AuthorityCreated(_authorityOwner, authority);\\n\\n return authority;\\n }\\n\\n function newAuthority(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external override returns (Authority) {\\n Authority authority = new Authority{salt: _salt}(_authorityOwner);\\n\\n emit AuthorityCreated(_authorityOwner, authority);\\n\\n return authority;\\n }\\n\\n function calculateAuthorityAddress(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external view override returns (address) {\\n return\\n Create2.computeAddress(\\n _salt,\\n keccak256(\\n abi.encodePacked(\\n type(Authority).creationCode,\\n abi.encode(_authorityOwner)\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x1b78c9693cfd7df3833c6ea1c18d767a10167f4bf6ac8ea883c74e7da281f418\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/IAuthorityFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Authority} from \\\"./Authority.sol\\\";\\n\\n/// @title Authority Factory interface\\ninterface IAuthorityFactory {\\n // Events\\n\\n /// @notice A new authority was deployed.\\n /// @param authorityOwner The initial authority owner\\n /// @param authority The authority\\n /// @dev MUST be triggered on a successful call to `newAuthority`.\\n event AuthorityCreated(address authorityOwner, Authority authority);\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new authority.\\n /// @param _authorityOwner The initial authority owner\\n /// @return The authority\\n /// @dev On success, MUST emit an `AuthorityCreated` event.\\n function newAuthority(address _authorityOwner) external returns (Authority);\\n\\n /// @notice Deploy a new authority deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority address\\n /// @return The authority\\n /// @dev On success, MUST emit an `AuthorityCreated` event.\\n function newAuthority(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external returns (Authority);\\n\\n /// @notice Calculate the address of an authority to be deployed deterministically.\\n /// @param _authorityOwner The initial authority owner\\n /// @param _salt The salt used to deterministically generate the authority address\\n /// @return The deterministic authority address\\n /// @dev Beware that only the `newAuthority` function with the `_salt` parameter\\n /// is able to deterministically deploy an authority.\\n function calculateAuthorityAddress(\\n address _authorityOwner,\\n bytes32 _salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x149bcdf9641b337836263196aabb655e69902212ede21becedd9c08b5b304717\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/history/IHistory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @title History interface\\ninterface IHistory {\\n // Permissioned functions\\n\\n /// @notice Submit a claim.\\n /// The encoding of `_claimData` might vary\\n /// depending on the history implementation.\\n /// @param _claimData Data for submitting a claim\\n /// @dev Should have access control.\\n function submitClaim(bytes calldata _claimData) external;\\n\\n /// @notice Transfer ownership to another consensus.\\n /// @param _consensus The new consensus\\n /// @dev Should have access control.\\n function migrateToConsensus(address _consensus) external;\\n\\n // Permissionless functions\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// The encoding of `_proofContext` might vary\\n /// depending on the history implementation.\\n /// @param _dapp The DApp address\\n /// @param _proofContext Data for retrieving the desired claim\\n /// @return epochHash_ The claimed epoch hash\\n /// @return firstInputIndex_ The index of the first input of the epoch in the input box\\n /// @return lastInputIndex_ The index of the last input of the epoch in the input box\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n )\\n external\\n view\\n returns (\\n bytes32 epochHash_,\\n uint256 firstInputIndex_,\\n uint256 lastInputIndex_\\n );\\n}\\n\",\"keccak256\":\"0x1378cbc831833abae8e2a565b88899d6416ea1208aa9724bd4df28e74848ffcf\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50610cb5806100206000396000f3fe608060405234801561001057600080fd5b50600436106100405760003560e01c80629c5784146100455780635a3f27d314610074578063b3a51b8414610087575b600080fd5b610058610053366004610288565b61009a565b6040516001600160a01b03909116815260200160405180910390f35b610058610082366004610288565b610115565b6100586100953660046102b2565b6101a4565b600061010e82604051806020016100b09061025f565b601f1982820381018352601f9091011660408181526001600160a01b03881660208301520160408051601f19818403018152908290526100f392916020016102fd565b6040516020818303038152906040528051906020012061022d565b9392505050565b60008082846040516101269061025f565b6001600160a01b0390911681526020018190604051809103906000f5905080158015610156573d6000803e3d6000fd5b50604080516001600160a01b038088168252831660208201529192507f0fb2d916aa6a78060ff9e89d89d62797c6668818dec04969013c5098754380ec910160405180910390a19392505050565b600080826040516101b49061025f565b6001600160a01b039091168152602001604051809103906000f0801580156101e0573d6000803e3d6000fd5b50604080516001600160a01b038087168252831660208201529192507f0fb2d916aa6a78060ff9e89d89d62797c6668818dec04969013c5098754380ec910160405180910390a192915050565b600061010e8383306000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b6109658061031b83390190565b80356001600160a01b038116811461028357600080fd5b919050565b6000806040838503121561029b57600080fd5b6102a48361026c565b946020939093013593505050565b6000602082840312156102c457600080fd5b61010e8261026c565b6000815160005b818110156102ee57602081850181015186830152016102d4565b50600093019283525090919050565b600061031261030c83866102cd565b846102cd565b94935050505056fe608060405234801561001057600080fd5b5060405161096538038061096583398101604081905261002f91610181565b61003833610057565b336001600160a01b0382161461005157610051816100a7565b506101b1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6100af610125565b6001600160a01b0381166101195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61012281610057565b50565b6000546001600160a01b0316331461017f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610110565b565b60006020828403121561019357600080fd5b81516001600160a01b03811681146101aa57600080fd5b9392505050565b6107a5806101c06000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063b688a36311610066578063b688a3631461010e578063bcdd1e1314610116578063d79a824014610129578063ddfdfbb014610157578063f2fde38b1461016a57600080fd5b8063159c5ea1146100a3578063715018a6146100b85780638da5cb5b146100c05780639368a3d3146100ea578063aa15efc8146100fd575b600080fd5b6100b66100b1366004610567565b61017d565b005b6100b66101d9565b6000546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b6100b66100f8366004610567565b6101ed565b6001546001600160a01b03166100cd565b6100b6610257565b6100b661012436600461058b565b61028c565b61013c610137366004610615565b610331565b604080519384526020840192909252908201526060016100e1565b6100b661016536600461066a565b6103ba565b6100b6610178366004610567565b61042a565b6101856104a8565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f2bcd43869347a1d42f97ac6042f3d129817abd05a6125f9750fe3724e321d23e9060200160405180910390a150565b6101e16104a8565b6101eb6000610502565b565b6101f56104a8565b60015460405163fc41168360e01b81526001600160a01b0383811660048301529091169063fc41168390602401600060405180830381600087803b15801561023c57600080fd5b505af1158015610250573d6000803e3d6000fd5b5050505050565b6040513381527f27c2b702d3bff195a18baca2daf00b20a986177c5f1449af4e2d46a3c3e02ce59060200160405180910390a1565b6102946104a8565b60405163a9059cbb60e01b81526001600160a01b038381166004830152602482018390526000919085169063a9059cbb906044016020604051808303816000875af11580156102e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030b91906106ac565b90508061032b5760405163099e1ca760e11b815260040160405180910390fd5b50505050565b60015460405163035e6a0960e61b8152600091829182916001600160a01b03169063d79a82409061036a908990899089906004016106f7565b606060405180830381865afa158015610387573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ab9190610725565b92509250925093509350939050565b6103c26104a8565b600154604051630ddfdfbb60e41b81526001600160a01b039091169063ddfdfbb0906103f49085908590600401610753565b600060405180830381600087803b15801561040e57600080fd5b505af1158015610422573d6000803e3d6000fd5b505050505050565b6104326104a8565b6001600160a01b03811661049c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6104a581610502565b50565b6000546001600160a01b031633146101eb5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610493565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146104a557600080fd5b60006020828403121561057957600080fd5b813561058481610552565b9392505050565b6000806000606084860312156105a057600080fd5b83356105ab81610552565b925060208401356105bb81610552565b929592945050506040919091013590565b60008083601f8401126105de57600080fd5b50813567ffffffffffffffff8111156105f657600080fd5b60208301915083602082850101111561060e57600080fd5b9250929050565b60008060006040848603121561062a57600080fd5b833561063581610552565b9250602084013567ffffffffffffffff81111561065157600080fd5b61065d868287016105cc565b9497909650939450505050565b6000806020838503121561067d57600080fd5b823567ffffffffffffffff81111561069457600080fd5b6106a0858286016105cc565b90969095509350505050565b6000602082840312156106be57600080fd5b8151801515811461058457600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038416815260406020820181905260009061071c90830184866106ce565b95945050505050565b60008060006060848603121561073a57600080fd5b8351925060208401519150604084015190509250925092565b6020815260006107676020830184866106ce565b94935050505056fea2646970667358221220c0785a1cc37ffa8f096145bce62f62d9cae719c200dba5e33a279c7f0894965164736f6c63430008130033a26469706673582212202de7e9a1b007ca2f3a7a6c53b2972dc3f889e83efde5ce289389b45306e1fe7864736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100405760003560e01c80629c5784146100455780635a3f27d314610074578063b3a51b8414610087575b600080fd5b610058610053366004610288565b61009a565b6040516001600160a01b03909116815260200160405180910390f35b610058610082366004610288565b610115565b6100586100953660046102b2565b6101a4565b600061010e82604051806020016100b09061025f565b601f1982820381018352601f9091011660408181526001600160a01b03881660208301520160408051601f19818403018152908290526100f392916020016102fd565b6040516020818303038152906040528051906020012061022d565b9392505050565b60008082846040516101269061025f565b6001600160a01b0390911681526020018190604051809103906000f5905080158015610156573d6000803e3d6000fd5b50604080516001600160a01b038088168252831660208201529192507f0fb2d916aa6a78060ff9e89d89d62797c6668818dec04969013c5098754380ec910160405180910390a19392505050565b600080826040516101b49061025f565b6001600160a01b039091168152602001604051809103906000f0801580156101e0573d6000803e3d6000fd5b50604080516001600160a01b038087168252831660208201529192507f0fb2d916aa6a78060ff9e89d89d62797c6668818dec04969013c5098754380ec910160405180910390a192915050565b600061010e8383306000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b6109658061031b83390190565b80356001600160a01b038116811461028357600080fd5b919050565b6000806040838503121561029b57600080fd5b6102a48361026c565b946020939093013593505050565b6000602082840312156102c457600080fd5b61010e8261026c565b6000815160005b818110156102ee57602081850181015186830152016102d4565b50600093019283525090919050565b600061031261030c83866102cd565b846102cd565b94935050505056fe608060405234801561001057600080fd5b5060405161096538038061096583398101604081905261002f91610181565b61003833610057565b336001600160a01b0382161461005157610051816100a7565b506101b1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6100af610125565b6001600160a01b0381166101195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61012281610057565b50565b6000546001600160a01b0316331461017f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610110565b565b60006020828403121561019357600080fd5b81516001600160a01b03811681146101aa57600080fd5b9392505050565b6107a5806101c06000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063b688a36311610066578063b688a3631461010e578063bcdd1e1314610116578063d79a824014610129578063ddfdfbb014610157578063f2fde38b1461016a57600080fd5b8063159c5ea1146100a3578063715018a6146100b85780638da5cb5b146100c05780639368a3d3146100ea578063aa15efc8146100fd575b600080fd5b6100b66100b1366004610567565b61017d565b005b6100b66101d9565b6000546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b6100b66100f8366004610567565b6101ed565b6001546001600160a01b03166100cd565b6100b6610257565b6100b661012436600461058b565b61028c565b61013c610137366004610615565b610331565b604080519384526020840192909252908201526060016100e1565b6100b661016536600461066a565b6103ba565b6100b6610178366004610567565b61042a565b6101856104a8565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f2bcd43869347a1d42f97ac6042f3d129817abd05a6125f9750fe3724e321d23e9060200160405180910390a150565b6101e16104a8565b6101eb6000610502565b565b6101f56104a8565b60015460405163fc41168360e01b81526001600160a01b0383811660048301529091169063fc41168390602401600060405180830381600087803b15801561023c57600080fd5b505af1158015610250573d6000803e3d6000fd5b5050505050565b6040513381527f27c2b702d3bff195a18baca2daf00b20a986177c5f1449af4e2d46a3c3e02ce59060200160405180910390a1565b6102946104a8565b60405163a9059cbb60e01b81526001600160a01b038381166004830152602482018390526000919085169063a9059cbb906044016020604051808303816000875af11580156102e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030b91906106ac565b90508061032b5760405163099e1ca760e11b815260040160405180910390fd5b50505050565b60015460405163035e6a0960e61b8152600091829182916001600160a01b03169063d79a82409061036a908990899089906004016106f7565b606060405180830381865afa158015610387573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ab9190610725565b92509250925093509350939050565b6103c26104a8565b600154604051630ddfdfbb60e41b81526001600160a01b039091169063ddfdfbb0906103f49085908590600401610753565b600060405180830381600087803b15801561040e57600080fd5b505af1158015610422573d6000803e3d6000fd5b505050505050565b6104326104a8565b6001600160a01b03811661049c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6104a581610502565b50565b6000546001600160a01b031633146101eb5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610493565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146104a557600080fd5b60006020828403121561057957600080fd5b813561058481610552565b9392505050565b6000806000606084860312156105a057600080fd5b83356105ab81610552565b925060208401356105bb81610552565b929592945050506040919091013590565b60008083601f8401126105de57600080fd5b50813567ffffffffffffffff8111156105f657600080fd5b60208301915083602082850101111561060e57600080fd5b9250929050565b60008060006040848603121561062a57600080fd5b833561063581610552565b9250602084013567ffffffffffffffff81111561065157600080fd5b61065d868287016105cc565b9497909650939450505050565b6000806020838503121561067d57600080fd5b823567ffffffffffffffff81111561069457600080fd5b6106a0858286016105cc565b90969095509350505050565b6000602082840312156106be57600080fd5b8151801515811461058457600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038416815260406020820181905260009061071c90830184866106ce565b95945050505050565b60008060006060848603121561073a57600080fd5b8351925060208401519150604084015190509250925092565b6020815260006107676020830184866106ce565b94935050505056fea2646970667358221220c0785a1cc37ffa8f096145bce62f62d9cae719c200dba5e33a279c7f0894965164736f6c63430008130033a26469706673582212202de7e9a1b007ca2f3a7a6c53b2972dc3f889e83efde5ce289389b45306e1fe7864736f6c63430008130033", - "devdoc": { - "events": { - "AuthorityCreated(address,address)": { - "details": "MUST be triggered on a successful call to `newAuthority`.", - "params": { - "authority": "The authority", - "authorityOwner": "The initial authority owner" - } - } - }, - "kind": "dev", - "methods": { - "calculateAuthorityAddress(address,bytes32)": { - "details": "Beware that only the `newAuthority` function with the `_salt` parameter is able to deterministically deploy an authority.", - "params": { - "_authorityOwner": "The initial authority owner", - "_salt": "The salt used to deterministically generate the authority address" - }, - "returns": { - "_0": "The deterministic authority address" - } - }, - "newAuthority(address)": { - "details": "On success, MUST emit an `AuthorityCreated` event.", - "params": { - "_authorityOwner": "The initial authority owner" - }, - "returns": { - "_0": "The authority" - } - }, - "newAuthority(address,bytes32)": { - "details": "On success, MUST emit an `AuthorityCreated` event.", - "params": { - "_authorityOwner": "The initial authority owner", - "_salt": "The salt used to deterministically generate the authority address" - }, - "returns": { - "_0": "The authority" - } - } - }, - "title": "Authority Factory", - "version": 1 - }, - "userdoc": { - "events": { - "AuthorityCreated(address,address)": { - "notice": "A new authority was deployed." - } - }, - "kind": "user", - "methods": { - "calculateAuthorityAddress(address,bytes32)": { - "notice": "Calculate the address of an authority to be deployed deterministically." - }, - "newAuthority(address)": { - "notice": "Deploy a new authority." - }, - "newAuthority(address,bytes32)": { - "notice": "Deploy a new authority deterministically." - } - }, - "notice": "Allows anyone to reliably deploy a new `Authority` contract.", - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/deployments/optimism_sepolia/CartesiDAppFactory.json b/deployments/optimism_sepolia/CartesiDAppFactory.json deleted file mode 100644 index 5b7e8a66a..000000000 --- a/deployments/optimism_sepolia/CartesiDAppFactory.json +++ /dev/null @@ -1,237 +0,0 @@ -{ - "address": "0x7122cd1221C20892234186facfE8615e6743Ab02", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "contract IConsensus", - "name": "consensus", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "dappOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "templateHash", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "contract CartesiDApp", - "name": "application", - "type": "address" - } - ], - "name": "ApplicationCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "contract IConsensus", - "name": "_consensus", - "type": "address" - }, - { - "internalType": "address", - "name": "_dappOwner", - "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": "_dappOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_templateHash", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newApplication", - "outputs": [ - { - "internalType": "contract CartesiDApp", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IConsensus", - "name": "_consensus", - "type": "address" - }, - { - "internalType": "address", - "name": "_dappOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_templateHash", - "type": "bytes32" - } - ], - "name": "newApplication", - "outputs": [ - { - "internalType": "contract CartesiDApp", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0x47f578e953a520e7803d06e6f3b78558ec05daad9016534bbeeb37545112b72e", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", - "contractAddress": null, - "transactionIndex": 1, - "gasUsed": "1546312", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xbe02ec2fd9be41d8aae3f9ae604b0078ffe33fcea88dce4d6952b5944f067333", - "transactionHash": "0x47f578e953a520e7803d06e6f3b78558ec05daad9016534bbeeb37545112b72e", - "logs": [], - "blockNumber": 5401222, - "cumulativeGasUsed": "1593201", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 1, - "solcInputHash": "54ee33aea592269e6046663615f287b6", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IConsensus\",\"name\":\"consensus\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"dappOwner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"templateHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"contract CartesiDApp\",\"name\":\"application\",\"type\":\"address\"}],\"name\":\"ApplicationCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"contract IConsensus\",\"name\":\"_consensus\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_dappOwner\",\"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\":\"_dappOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_templateHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"newApplication\",\"outputs\":[{\"internalType\":\"contract CartesiDApp\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IConsensus\",\"name\":\"_consensus\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_dappOwner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_templateHash\",\"type\":\"bytes32\"}],\"name\":\"newApplication\",\"outputs\":[{\"internalType\":\"contract CartesiDApp\",\"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\":{\"application\":\"The application\",\"consensus\":\"The initial consensus contract\",\"dappOwner\":\"The initial DApp owner\",\"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\":{\"_consensus\":\"The initial consensus contract\",\"_dappOwner\":\"The initial DApp owner\",\"_salt\":\"The salt used to deterministically generate the DApp address\",\"_templateHash\":\"The initial machine state hash\"},\"returns\":{\"_0\":\"The deterministic application address\"}},\"newApplication(address,address,bytes32)\":{\"details\":\"On success, MUST emit an `ApplicationCreated` event.\",\"params\":{\"_consensus\":\"The initial consensus contract\",\"_dappOwner\":\"The initial DApp owner\",\"_templateHash\":\"The initial machine state hash\"},\"returns\":{\"_0\":\"The application\"}},\"newApplication(address,address,bytes32,bytes32)\":{\"details\":\"On success, MUST emit an `ApplicationCreated` event.\",\"params\":{\"_consensus\":\"The initial consensus contract\",\"_dappOwner\":\"The initial DApp owner\",\"_salt\":\"The salt used to deterministically generate the DApp address\",\"_templateHash\":\"The initial machine state hash\"},\"returns\":{\"_0\":\"The application\"}}},\"title\":\"Cartesi DApp 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 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 `CartesiDApp` contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dapp/CartesiDAppFactory.sol\":\"CartesiDAppFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@cartesi/util/contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"},\"@cartesi/util/contracts/CartesiMathV2.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\n/// @title CartesiMath\\n/// @author Felipe Argento\\npragma solidity ^0.8.0;\\n\\nlibrary CartesiMathV2 {\\n // mapping values are packed as bytes3 each\\n // see test/TestCartesiMath.ts for decimal values\\n bytes constant log2tableTimes1M =\\n hex\\\"0000000F4240182F421E8480236E082771822AD63A2DC6C0305E8532B04834C96736B3C23876D73A187A3B9D4A3D09003E5EA63FA0C540D17741F28843057D440BA745062945F60246DC1047B917488DC7495ABA4A207C4ADF8A4B98544C4B404CF8AA4DA0E64E44434EE3054F7D6D5013B750A61A5134C851BFF05247BD52CC58534DE753CC8D54486954C19C55384255AC75561E50568DE956FB575766B057D00758376F589CFA5900BA5962BC59C3135A21CA5A7EF15ADA945B34BF5B8D805BE4DF5C3AEA5C8FA95CE3265D356C5D86835DD6735E25455E73005EBFAD5F0B525F55F75F9FA25FE85A60302460770860BD0A61023061467F6189FD61CCAE620E98624FBF62902762CFD5630ECD634D12638AA963C7966403DC643F7F647A8264B4E864EEB56527EC6560906598A365D029660724663D9766738566A8F066DDDA6712476746386779AF67ACAF67DF3A6811526842FA68743268A4FC68D55C6905536934E169640A6992CF69C13169EF326A1CD46A4A186A76FF6AA38C6ACFC0\\\";\\n\\n /// @notice Approximates log2 * 1M\\n /// @param _num number to take log2 * 1M of\\n /// @return approximate log2 times 1M\\n function log2ApproxTimes1M(uint256 _num) public pure returns (uint256) {\\n require(_num > 0, \\\"Number cannot be zero\\\");\\n uint256 leading = 0;\\n\\n if (_num == 1) return 0;\\n\\n while (_num > 128) {\\n _num = _num >> 1;\\n leading += 1;\\n }\\n return (leading * uint256(1000000)) + (getLog2TableTimes1M(_num));\\n }\\n\\n /// @notice navigates log2tableTimes1M\\n /// @param _num number to take log2 of\\n /// @return result after table look-up\\n function getLog2TableTimes1M(uint256 _num) public pure returns (uint256) {\\n bytes3 result = 0;\\n for (uint8 i = 0; i < 3; i++) {\\n bytes3 tempResult = log2tableTimes1M[(_num - 1) * 3 + i];\\n result = result | (tempResult >> (i * 8));\\n }\\n\\n return uint256(uint24(result));\\n }\\n\\n /// @notice get floor of log2 of number\\n /// @param _num number to take floor(log2) of\\n /// @return floor(log2) of _num\\n function getLog2Floor(uint256 _num) public pure returns (uint8) {\\n require(_num != 0, \\\"log of zero is undefined\\\");\\n\\n return uint8(255 - clz(_num));\\n }\\n\\n /// @notice checks if a number is Power of 2\\n /// @param _num number to check\\n /// @return true if number is power of 2, false if not\\n function isPowerOf2(uint256 _num) public pure returns (bool) {\\n if (_num == 0) return false;\\n\\n return _num & (_num - 1) == 0;\\n }\\n\\n /// @notice count trailing zeros\\n /// @param _num number you want the ctz of\\n /// @dev this a binary search implementation\\n function ctz(uint256 _num) public pure returns (uint256) {\\n if (_num == 0) return 256;\\n\\n uint256 n = 0;\\n if (_num & 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF == 0) {\\n n = n + 128;\\n _num = _num >> 128;\\n }\\n if (_num & 0x000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFF == 0) {\\n n = n + 64;\\n _num = _num >> 64;\\n }\\n if (_num & 0x00000000000000000000000000000000000000000000000000000000FFFFFFFF == 0) {\\n n = n + 32;\\n _num = _num >> 32;\\n }\\n if (_num & 0x000000000000000000000000000000000000000000000000000000000000FFFF == 0) {\\n n = n + 16;\\n _num = _num >> 16;\\n }\\n if (_num & 0x00000000000000000000000000000000000000000000000000000000000000FF == 0) {\\n n = n + 8;\\n _num = _num >> 8;\\n }\\n if (_num & 0x000000000000000000000000000000000000000000000000000000000000000F == 0) {\\n n = n + 4;\\n _num = _num >> 4;\\n }\\n if (_num & 0x0000000000000000000000000000000000000000000000000000000000000003 == 0) {\\n n = n + 2;\\n _num = _num >> 2;\\n }\\n if (_num & 0x0000000000000000000000000000000000000000000000000000000000000001 == 0) {\\n n = n + 1;\\n }\\n\\n return n;\\n }\\n\\n /// @notice count leading zeros\\n /// @param _num number you want the clz of\\n /// @dev this a binary search implementation\\n function clz(uint256 _num) public pure returns (uint256) {\\n if (_num == 0) return 256;\\n\\n uint256 n = 0;\\n if (_num & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000 == 0) {\\n n = n + 128;\\n _num = _num << 128;\\n }\\n if (_num & 0xFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 64;\\n _num = _num << 64;\\n }\\n if (_num & 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 32;\\n _num = _num << 32;\\n }\\n if (_num & 0xFFFF000000000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 16;\\n _num = _num << 16;\\n }\\n if (_num & 0xFF00000000000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 8;\\n _num = _num << 8;\\n }\\n if (_num & 0xF000000000000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 4;\\n _num = _num << 4;\\n }\\n if (_num & 0xC000000000000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 2;\\n _num = _num << 2;\\n }\\n if (_num & 0x8000000000000000000000000000000000000000000000000000000000000000 == 0) {\\n n = n + 1;\\n }\\n\\n return n;\\n }\\n}\\n\",\"keccak256\":\"0x98fb8d20c05b7c39c44171b6c524cf023da646749eb90157463538da8b2e13d3\",\"license\":\"Apache-2.0\"},\"@cartesi/util/contracts/MerkleV2.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\n/// @title Library for Merkle proofs\\npragma solidity ^0.8.0;\\n\\nimport \\\"./CartesiMathV2.sol\\\";\\n\\nlibrary MerkleV2 {\\n using CartesiMathV2 for uint256;\\n\\n uint128 constant L_WORD_SIZE = 3; // word = 8 bytes, log = 3\\n // number of hashes in EMPTY_TREE_HASHES\\n uint128 constant EMPTY_TREE_SIZE = 1952; // 61*32=1952. 32 bytes per 61 indexes (64 words)\\n\\n // merkle root hashes of trees of zero concatenated\\n // 32 bytes for each root, first one is keccak(0), second one is\\n // keccak(keccack(0), keccak(0)) and so on\\n\\n bytes constant EMPTY_TREE_HASHES =\\n hex\\\"011b4d03dd8c01f1049143cf9c4c817e4b167f1d1b83e5c6f0f10d89ba1e7bce4d9470a821fbe90117ec357e30bad9305732fb19ddf54a07dd3e29f440619254ae39ce8537aca75e2eff3e38c98011dfe934e700a0967732fc07b430dd656a233fc9a15f5b4869c872f81087bb6104b7d63e6f9ab47f2c43f3535eae7172aa7f17d2dd614cddaa4d879276b11e0672c9560033d3e8453a1d045339d34ba601b9c37b8b13ca95166fb7af16988a70fcc90f38bf9126fd833da710a47fb37a55e68e7a427fa943d9966b389f4f257173676090c6e95f43e2cb6d65f8758111e30930b0b9deb73e155c59740bacf14a6ff04b64bb8e201a506409c3fe381ca4ea90cd5deac729d0fdaccc441d09d7325f41586ba13c801b7eccae0f95d8f3933efed8b96e5b7f6f459e9cb6a2f41bf276c7b85c10cd4662c04cbbb365434726c0a0c9695393027fb106a8153109ac516288a88b28a93817899460d6310b71cf1e6163e8806fa0d4b197a259e8c3ac28864268159d0ac85f8581ca28fa7d2c0c03eb91e3eee5ca7a3da2b3053c9770db73599fb149f620e3facef95e947c0ee860b72122e31e4bbd2b7c783d79cc30f60c6238651da7f0726f767d22747264fdb046f7549f26cc70ed5e18baeb6c81bb0625cb95bb4019aeecd40774ee87ae29ec517a71f6ee264c5d761379b3d7d617ca83677374b49d10aec50505ac087408ca892b573c267a712a52e1d06421fe276a03efb1889f337201110fdc32a81f8e152499af665835aabfdc6740c7e2c3791a31c3cdc9f5ab962f681b12fc092816a62f27d86025599a41233848702f0cfc0437b445682df51147a632a0a083d2d38b5e13e466a8935afff58bb533b3ef5d27fba63ee6b0fd9e67ff20af9d50deee3f8bf065ec220c1fd4ba57e341261d55997f85d66d32152526736872693d2b437a233e2337b715f6ac9a6a272622fdc2d67fcfe1da3459f8dab4ed7e40a657a54c36766c5e8ac9a88b35b05c34747e6507f6b044ab66180dc76ac1a696de03189593fedc0d0dbbd855c8ead673544899b0960e4a5a7ca43b4ef90afe607de7698caefdc242788f654b57a4fb32a71b335ef6ff9a4cc118b282b53bdd6d6192b7a82c3c5126b9c7e33c8e5a5ac9738b8bd31247fb7402054f97b573e8abb9faad219f4fd085aceaa7f542d787ee4196d365f3cc566e7bbcfbfd451230c48d804c017d21e2d8fa914e2559bb72bf0ab78c8ab92f00ef0d0d576eccdd486b64138a4172674857e543d1d5b639058dd908186597e366ad5f3d9c7ceaff44d04d1550b8d33abc751df07437834ba5acb32328a396994aebb3c40f759c2d6d7a3cb5377e55d5d218ef5a296dda8ddc355f3f50c3d0b660a51dfa4d98a6a5a33564556cf83c1373a814641d6a1dcef97b883fee61bb84fe60a3409340217e629cc7e4dcc93b85d8820921ff5826148b60e6939acd7838e1d7f20562bff8ee4b5ec4a05ad997a57b9796fdcb2eda87883c2640b072b140b946bfdf6575cacc066fdae04f6951e63624cbd316a677cad529bbe4e97b9144e4bc06c4afd1de55dd3e1175f90423847a230d34dfb71ed56f2965a7f6c72e6aa33c24c303fd67745d632656c5ef90bec80f4f5d1daa251988826cef375c81c36bf457e09687056f924677cb0bccf98dff81e014ce25f2d132497923e267363963cdf4302c5049d63131dc03fd95f65d8b6aa5934f817252c028c90f56d413b9d5d10d89790707dae2fabb249f649929927c21dd71e3f656826de5451c5da375aadecbd59d5ebf3a31fae65ac1b316a1611f1b276b26530f58d7247df459ce1f86db1d734f6f811932f042cee45d0e455306d01081bc3384f82c5fb2aacaa19d89cdfa46cc916eac61121475ba2e6191b4feecbe1789717021a158ace5d06744b40f551076b67cd63af60007f8c99876e1424883a45ec49d497ddaf808a5521ca74a999ab0b3c7aa9c80f85e93977ec61ce68b20307a1a81f71ca645b568fcd319ccbb5f651e87b707d37c39e15f945ea69e2f7c7d2ccc85b7e654c07e96f0636ae4044fe0e38590b431795ad0f8647bdd613713ada493cc17efd313206380e6a685b8198475bbd021c6e9d94daab2214947127506073e44d5408ba166c512a0b86805d07f5a44d3c41706be2bc15e712e55805248b92e8677d90f6d284d1d6ffaff2c430657042a0e82624fa3717b06cc0a6fd12230ea586dae83019fb9e06034ed2803c98d554b93c9a52348cafff75c40174a91f9ae6b8647854a156029f0b88b83316663ce574a4978277bb6bb27a31085634b6ec78864b6d8201c7e93903d75815067e378289a3d072ae172dafa6a452470f8d645bebfad9779594fc0784bb764a22e3a8181d93db7bf97893c414217a618ccb14caa9e92e8c61673afc9583662e812adba1f87a9c68202d60e909efab43c42c0cb00695fc7f1ffe67c75ca894c3c51e1e5e731360199e600f6ced9a87b2a6a87e70bf251bb5075ab222138288164b2eda727515ea7de12e2496d4fe42ea8d1a120c03cf9c50622c2afe4acb0dad98fd62d07ab4e828a94495f6d1ab973982c7ccbe6c1fae02788e4422ae22282fa49cbdb04ba54a7a238c6fc41187451383460762c06d1c8a72b9cd718866ad4b689e10c9a8c38fe5ef045bd785b01e980fc82c7e3532ce81876b778dd9f1ceeba4478e86411fb6fdd790683916ca832592485093644e8760cd7b4c01dba1ccc82b661bf13f0e3f34acd6b88\\\";\\n\\n /// @notice Gets merkle root hash of drive with a replacement\\n /// @param _position position of _drive\\n /// @param _logSizeOfReplacement log2 of size the replacement\\n /// @param _logSizeOfFullDrive log2 of size the full drive, which can be the entire machine\\n /// @param _replacement hash of the replacement\\n /// @param siblings of replacement that merkle root can be calculated\\n function getRootAfterReplacementInDrive(\\n uint256 _position,\\n uint256 _logSizeOfReplacement,\\n uint256 _logSizeOfFullDrive,\\n bytes32 _replacement,\\n bytes32[] calldata siblings\\n ) public pure returns (bytes32) {\\n require(\\n _logSizeOfFullDrive >= _logSizeOfReplacement && _logSizeOfReplacement >= 3 && _logSizeOfFullDrive <= 64,\\n \\\"3 <= logSizeOfReplacement <= logSizeOfFullDrive <= 64\\\"\\n );\\n\\n uint256 size = 1 << _logSizeOfReplacement;\\n\\n require(((size - 1) & _position) == 0, \\\"Position is not aligned\\\");\\n require(siblings.length == _logSizeOfFullDrive - _logSizeOfReplacement, \\\"Proof length does not match\\\");\\n\\n for (uint256 i; i < siblings.length; i++) {\\n if ((_position & (size << i)) == 0) {\\n _replacement = keccak256(abi.encodePacked(_replacement, siblings[i]));\\n } else {\\n _replacement = keccak256(abi.encodePacked(siblings[i], _replacement));\\n }\\n }\\n\\n return _replacement;\\n }\\n\\n /// @notice Gets precomputed hash of zero in empty tree hashes\\n /// @param _index of hash wanted\\n /// @dev first index is keccak(0), second index is keccak(keccak(0), keccak(0))\\n function getEmptyTreeHashAtIndex(uint256 _index) public pure returns (bytes32) {\\n uint256 start = _index * 32;\\n require(EMPTY_TREE_SIZE >= start + 32, \\\"index out of bounds\\\");\\n bytes32 hashedZeros;\\n bytes memory zeroTree = EMPTY_TREE_HASHES;\\n\\n // first word is length, then skip index words\\n assembly {\\n hashedZeros := mload(add(add(zeroTree, 0x20), start))\\n }\\n return hashedZeros;\\n }\\n\\n /// @notice get merkle root of generic array of bytes\\n /// @param _data array of bytes to be merklelized\\n /// @param _log2Size log2 of total size of the drive\\n /// @dev _data is padded with zeroes until is multiple of 8\\n /// @dev root is completed with zero tree until log2size is complete\\n /// @dev hashes are taken word by word (8 bytes by 8 bytes)\\n function getMerkleRootFromBytes(bytes calldata _data, uint256 _log2Size) public pure returns (bytes32) {\\n require(_log2Size >= 3 && _log2Size <= 64, \\\"range of log2Size: [3,64]\\\");\\n\\n // if _data is empty return pristine drive of size log2size\\n if (_data.length == 0) return getEmptyTreeHashAtIndex(_log2Size - 3);\\n\\n // total size of the drive in words\\n uint256 size = 1 << (_log2Size - 3);\\n require(size << L_WORD_SIZE >= _data.length, \\\"data is bigger than drive\\\");\\n // the stack depth is log2(_data.length / 8) + 2\\n uint256 stack_depth = 2 + ((_data.length) >> L_WORD_SIZE).getLog2Floor();\\n bytes32[] memory stack = new bytes32[](stack_depth);\\n\\n uint256 numOfHashes; // total number of hashes on stack (counting levels)\\n uint256 stackLength; // total length of stack\\n uint256 numOfJoins; // number of hashes of the same level on stack\\n uint256 topStackLevel; // hash level of the top of the stack\\n\\n while (numOfHashes < size) {\\n if ((numOfHashes << L_WORD_SIZE) < _data.length) {\\n // we still have words to hash\\n stack[stackLength] = getHashOfWordAtIndex(_data, numOfHashes);\\n numOfHashes++;\\n\\n numOfJoins = numOfHashes;\\n } else {\\n // since padding happens in hashOfWordAtIndex function\\n // we only need to complete the stack with pre-computed\\n // hash(0), hash(hash(0),hash(0)) and so on\\n topStackLevel = numOfHashes.ctz();\\n\\n stack[stackLength] = getEmptyTreeHashAtIndex(topStackLevel);\\n\\n //Empty Tree Hash summarizes many hashes\\n numOfHashes = numOfHashes + (1 << topStackLevel);\\n numOfJoins = numOfHashes >> topStackLevel;\\n }\\n\\n stackLength++;\\n\\n // while there are joins, hash top of stack together\\n while (numOfJoins & 1 == 0) {\\n bytes32 h2 = stack[stackLength - 1];\\n bytes32 h1 = stack[stackLength - 2];\\n\\n stack[stackLength - 2] = keccak256(abi.encodePacked(h1, h2));\\n stackLength = stackLength - 1; // remove hashes from stack\\n\\n numOfJoins = numOfJoins >> 1;\\n }\\n }\\n require(stackLength == 1, \\\"stack error\\\");\\n\\n return stack[0];\\n }\\n\\n /// @notice Get the hash of a word in an array of bytes\\n /// @param _data array of bytes\\n /// @param _wordIndex index of word inside the bytes to get the hash of\\n /// @dev if word is incomplete (< 8 bytes) it gets padded with zeroes\\n function getHashOfWordAtIndex(bytes calldata _data, uint256 _wordIndex) public pure returns (bytes32) {\\n uint256 start = _wordIndex << L_WORD_SIZE;\\n uint256 end = start + (1 << L_WORD_SIZE);\\n\\n // TODO: in .lua this just returns zero, but this might be more consistent\\n require(start <= _data.length, \\\"word out of bounds\\\");\\n\\n if (end <= _data.length) {\\n return keccak256(abi.encodePacked(_data[start:end]));\\n }\\n\\n // word is incomplete\\n // fill paddedSlice with incomplete words - the rest is going to be bytes(0)\\n bytes memory paddedSlice = new bytes(8);\\n uint256 remaining = _data.length - start;\\n\\n for (uint256 i; i < remaining; i++) {\\n paddedSlice[i] = _data[start + i];\\n }\\n\\n return keccak256(paddedSlice);\\n }\\n\\n /// @notice Calculate the root of Merkle tree from an array of power of 2 elements\\n /// @param hashes The array containing power of 2 elements\\n /// @return byte32 the root hash being calculated\\n function calculateRootFromPowerOfTwo(bytes32[] memory hashes) public pure returns (bytes32) {\\n // revert when the input is not of power of 2\\n require((hashes.length).isPowerOf2(), \\\"array len not power of 2\\\");\\n\\n if (hashes.length == 1) {\\n return hashes[0];\\n } else {\\n bytes32[] memory newHashes = new bytes32[](hashes.length >> 1);\\n\\n for (uint256 i; i < hashes.length; i += 2) {\\n newHashes[i >> 1] = keccak256(abi.encodePacked(hashes[i], hashes[i + 1]));\\n }\\n\\n return calculateRootFromPowerOfTwo(newHashes);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x73d86cb2dfa2ca887987c6da8d193d523c6a65ea89e296d1f47f190ebda7fa9b\",\"license\":\"Apache-2.0\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\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 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 require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\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\":\"0xa535a5df777d44e945dd24aa43a11e44b024140fc340ad0dfe42acf4002aade1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev _Available since v3.1._\\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\":\"0xeb373f1fdc7b755c6a750123a9b9e3a8a02c1470042fd6505d875000a80bde0b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/utils/ERC1155Holder.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./ERC1155Receiver.sol\\\";\\n\\n/**\\n * Simple implementation of `ERC1155Receiver` 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 *\\n * @dev _Available since v3.1._\\n */\\ncontract ERC1155Holder is ERC1155Receiver {\\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\":\"0x2e024ca51ce5abe16c0d34e6992a1104f356e2244eb4ccbec970435e8b3405e3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC1155Receiver.sol\\\";\\nimport \\\"../../../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev _Available since v3.1._\\n */\\nabstract contract ERC1155Receiver 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\",\"keccak256\":\"0x3dd5e1a66a56f30302108a1da97d677a42b1daa60e503696b2bcbbf3e4c95bcb\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\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 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\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/utils/ERC721Holder.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../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 {IERC721-setApprovalForAll}.\\n */\\ncontract 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 override returns (bytes4) {\\n return this.onERC721Received.selector;\\n }\\n}\\n\",\"keccak256\":\"0x67ef46fef257faae47adb630aad49694dda0334e5f7a7c5fb386243b974886b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\\n require(address(this).balance >= amount, \\\"Create2: insufficient balance\\\");\\n require(bytecode.length != 0, \\\"Create2: bytecode length is zero\\\");\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n require(addr != address(0), \\\"Create2: Failed on deploy\\\");\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6e00f269073ffc4350e56b7e8153c9092d5f70bfba423299990514183101ef89\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./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 *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/common/CanonicalMachine.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @title Canonical Machine Constants Library\\n///\\n/// @notice Defines several constants related to the reference implementation\\n/// of the RISC-V machine that runs Linux, also known as the \\\"Cartesi Machine\\\".\\nlibrary CanonicalMachine {\\n /// @notice Base-2 logarithm of number of bytes.\\n type Log2Size is uint64;\\n\\n /// @notice Machine word size (8 bytes).\\n Log2Size constant WORD_LOG2_SIZE = Log2Size.wrap(3);\\n\\n /// @notice Machine address space size (2^64 bytes).\\n Log2Size constant MACHINE_LOG2_SIZE = Log2Size.wrap(64);\\n\\n /// @notice Keccak-256 output size (32 bytes).\\n Log2Size constant KECCAK_LOG2_SIZE = Log2Size.wrap(5);\\n\\n /// @notice Maximum input size (~2 megabytes).\\n /// @dev The offset and size fields use up the extra 64 bytes.\\n uint256 constant INPUT_MAX_SIZE = (1 << 21) - 64;\\n\\n /// @notice Maximum voucher metadata memory range (2 megabytes).\\n Log2Size constant VOUCHER_METADATA_LOG2_SIZE = Log2Size.wrap(21);\\n\\n /// @notice Maximum notice metadata memory range (2 megabytes).\\n Log2Size constant NOTICE_METADATA_LOG2_SIZE = Log2Size.wrap(21);\\n\\n /// @notice Maximum epoch voucher memory range (128 megabytes).\\n Log2Size constant EPOCH_VOUCHER_LOG2_SIZE = Log2Size.wrap(37);\\n\\n /// @notice Maximum epoch notice memory range (128 megabytes).\\n Log2Size constant EPOCH_NOTICE_LOG2_SIZE = Log2Size.wrap(37);\\n\\n /// @notice Unwrap `s` into its underlying uint64 value.\\n /// @param s Base-2 logarithm of some number of bytes\\n function uint64OfSize(Log2Size s) internal pure returns (uint64) {\\n return Log2Size.unwrap(s);\\n }\\n\\n /// @notice Return the position of an intra memory range on a memory range\\n /// with contents with the same size.\\n /// @param index Index of intra memory range\\n /// @param log2Size Base-2 logarithm of intra memory range size\\n function getIntraMemoryRangePosition(\\n uint64 index,\\n Log2Size log2Size\\n ) internal pure returns (uint64) {\\n return index << Log2Size.unwrap(log2Size);\\n }\\n}\\n\",\"keccak256\":\"0x97cdce56cdb4f0b4164e6be3a72e50469a3124e4716e753a1792aa70eac614f5\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/common/OutputEncoding.sol\":{\"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 Output Encoding Library\\n///\\n/// @notice Defines the encoding of outputs generated by the off-chain machine.\\nlibrary OutputEncoding {\\n /// @notice Encode a notice.\\n /// @param notice The notice\\n /// @return The encoded output\\n function encodeNotice(\\n bytes calldata notice\\n ) internal pure returns (bytes memory) {\\n return abi.encode(notice);\\n }\\n\\n /// @notice Encode a voucher.\\n /// @param destination The address that will receive the payload through a message call\\n /// @param payload The payload, which\\u2014in the case of Solidity contracts\\u2014encodes a function call\\n /// @return The encoded output\\n function encodeVoucher(\\n address destination,\\n bytes calldata payload\\n ) internal pure returns (bytes memory) {\\n return abi.encode(destination, payload);\\n }\\n}\\n\",\"keccak256\":\"0xfbf8bd40a11aeb380c77910ef7a8c3a4b358dddbd8bc795529de39c955dd6f60\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/IConsensus.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @title Consensus interface\\n///\\n/// @notice This contract defines a generic interface for consensuses.\\n/// We use the word \\\"consensus\\\" to designate a contract that provides claims\\n/// in the base layer regarding the state of off-chain machines running in\\n/// the execution layer. How this contract is able to reach consensus, who is\\n/// able to submit claims, and how are claims stored in the base layer are\\n/// some of the implementation details left unspecified by this interface.\\n///\\n/// From the point of view of a DApp, these claims are necessary to validate\\n/// on-chain action allowed by the off-chain machine in the form of vouchers\\n/// and notices. Each claim is composed of three parts: an epoch hash, a first\\n/// index, and a last index. We'll explain each of these parts below.\\n///\\n/// First, let us define the word \\\"epoch\\\". For finality reasons, we need to\\n/// divide the stream of inputs being fed into the off-chain machine into\\n/// batches of inputs, which we call \\\"epoches\\\". At the end of every epoch,\\n/// we summarize the state of the off-chain machine in a single hash, called\\n/// \\\"epoch hash\\\". Please note that this interface does not define how this\\n/// stream of inputs is being chopped up into epoches.\\n///\\n/// The other two parts are simply the indices of the first and last inputs\\n/// accepted during the epoch. Logically, the first index MUST BE less than\\n/// or equal to the last index. As a result, every epoch MUST accept at least\\n/// one input. This assumption stems from the fact that the state of a machine\\n/// can only change after an input is fed into it.\\n///\\n/// Examples of possible implementations of this interface include:\\n///\\n/// * An authority consensus, controlled by a single address who has full\\n/// control over epoch boundaries, claim submission, asset management, etc.\\n///\\n/// * A quorum consensus, controlled by a limited set of validators, that\\n/// vote on the state of the machine at the end of every epoch. Also, epoch\\n/// boundaries are determined by the timestamp in the base layer, and assets\\n/// are split equally amongst the validators.\\n///\\n/// * An NxN consensus, which allows anyone to submit and dispute claims\\n/// in the base layer. Epoch boundaries are determined in the same fashion\\n/// as in the quorum example.\\n///\\ninterface IConsensus {\\n /// @notice An application has joined the consensus' validation set.\\n /// @param application The application\\n /// @dev MUST be triggered on a successful call to `join`.\\n event ApplicationJoined(address application);\\n\\n /// @notice Get a specific claim regarding a specific DApp.\\n /// The encoding of `_proofContext` might vary\\n /// depending on the implementation.\\n /// @param _dapp The DApp address\\n /// @param _proofContext Data for retrieving the desired claim\\n /// @return epochHash_ The claimed epoch hash\\n /// @return firstInputIndex_ The index of the first input of the epoch in the input box\\n /// @return lastInputIndex_ The index of the last input of the epoch in the input box\\n function getClaim(\\n address _dapp,\\n bytes calldata _proofContext\\n )\\n external\\n view\\n returns (\\n bytes32 epochHash_,\\n uint256 firstInputIndex_,\\n uint256 lastInputIndex_\\n );\\n\\n /// @notice Signal the consensus that the message sender wants to join its validation set.\\n /// @dev MUST fire an `ApplicationJoined` event with the message sender as argument.\\n function join() external;\\n}\\n\",\"keccak256\":\"0xc9d295fada66eb0602e0f1e2e236708e52f959927abb4ab6b04173a98b92ac16\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/CartesiDApp.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {ICartesiDApp, Proof} from \\\"./ICartesiDApp.sol\\\";\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\nimport {LibOutputValidation, OutputValidityProof} from \\\"../library/LibOutputValidation.sol\\\";\\nimport {Bitmask} from \\\"@cartesi/util/contracts/Bitmask.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/security/ReentrancyGuard.sol\\\";\\n\\n/// @title Cartesi DApp\\n///\\n/// @notice This contract acts as the base layer incarnation of a DApp running on the execution layer.\\n/// The DApp is hereby able to interact with other smart contracts through the execution of vouchers\\n/// and the validation of notices. These outputs are generated by the DApp backend on the execution\\n/// layer and can be proven in the base layer thanks to claims submitted by a consensus contract.\\n///\\n/// A voucher is a one-time message call to another contract. It can encode asset transfers, approvals,\\n/// or any other message call that doesn't require Ether to be sent along. A voucher will only be consumed\\n/// if the underlying message call succeeds (that is, it doesn't revert). Furthermore, the return data of\\n/// the message call is discarded entirely. As a protective measure against reentrancy attacks, nested\\n/// voucher executions are prohibited.\\n///\\n/// A notice, on the other hand, constitutes an arbitrary piece of data that can be proven any number of times.\\n/// On their own, they do not trigger any type of contract-to-contract interaction.\\n/// Rather, they merely serve to attest off-chain results, e.g. which player won a particular chess match.\\n///\\n/// Every DApp is subscribed to a consensus contract, and governed by a single address, the owner.\\n/// The consensus has the power of submitting claims, which, in turn, are used to validate vouchers and notices.\\n/// Meanwhile, the owner has complete power over the DApp, as it can replace the consensus at any time.\\n/// Therefore, the users of a DApp must trust both the consensus and the DApp owner.\\n///\\n/// The DApp developer can choose whichever ownership and consensus models it wants.\\n///\\n/// Examples of DApp ownership models include:\\n///\\n/// * no owner (address zero)\\n/// * individual signer (externally-owned account)\\n/// * multiple signers (multi-sig)\\n/// * DAO (decentralized autonomous organization)\\n/// * self-owned DApp (off-chain governance logic)\\n///\\n/// See `IConsensus` for examples of consensus models.\\n///\\n/// This contract inherits the following OpenZeppelin contracts.\\n/// For more information, please consult OpenZeppelin's official documentation.\\n///\\n/// * `Ownable`\\n/// * `ERC721Holder`\\n/// * `ERC1155Holder`\\n/// * `ReentrancyGuard`\\n///\\ncontract CartesiDApp is\\n ICartesiDApp,\\n Ownable,\\n ERC721Holder,\\n ERC1155Holder,\\n ReentrancyGuard\\n{\\n using Bitmask for mapping(uint256 => uint256);\\n using LibOutputValidation for OutputValidityProof;\\n\\n /// @notice Raised when executing an already executed voucher.\\n error VoucherReexecutionNotAllowed();\\n\\n /// @notice Raised when the transfer fails.\\n error EtherTransferFailed();\\n\\n /// @notice Raised when a mehtod is not called by DApp itself.\\n error OnlyDApp();\\n\\n /// @notice The initial machine state hash.\\n /// @dev See the `getTemplateHash` function.\\n bytes32 internal immutable templateHash;\\n\\n /// @notice The executed voucher bitmask, which keeps track of which vouchers\\n /// were executed already in order to avoid re-execution.\\n /// @dev See the `wasVoucherExecuted` function.\\n mapping(uint256 => uint256) internal voucherBitmask;\\n\\n /// @notice The current consensus contract.\\n /// @dev See the `getConsensus` and `migrateToConsensus` functions.\\n IConsensus internal consensus;\\n\\n /// @notice Creates a `CartesiDApp` contract.\\n /// @param _consensus The initial consensus contract\\n /// @param _owner The initial DApp owner\\n /// @param _templateHash The initial machine state hash\\n /// @dev Calls the `join` function on `_consensus`.\\n constructor(IConsensus _consensus, address _owner, bytes32 _templateHash) {\\n transferOwnership(_owner);\\n templateHash = _templateHash;\\n consensus = _consensus;\\n\\n _consensus.join();\\n }\\n\\n function executeVoucher(\\n address _destination,\\n bytes calldata _payload,\\n Proof calldata _proof\\n ) external override nonReentrant returns (bool) {\\n bytes32 epochHash;\\n uint256 firstInputIndex;\\n uint256 lastInputIndex;\\n uint256 inputIndex;\\n\\n // query the current consensus for the desired claim\\n (epochHash, firstInputIndex, lastInputIndex) = getClaim(_proof.context);\\n\\n // validate input index range and calculate the input index\\n // based on the input index range provided by the consensus\\n inputIndex = _proof.validity.validateInputIndexRange(\\n firstInputIndex,\\n lastInputIndex\\n );\\n\\n // reverts if proof isn't valid\\n _proof.validity.validateVoucher(_destination, _payload, epochHash);\\n\\n uint256 voucherPosition = LibOutputValidation.getBitMaskPosition(\\n _proof.validity.outputIndexWithinInput,\\n inputIndex\\n );\\n\\n // check if voucher has been executed\\n if (_wasVoucherExecuted(voucherPosition)) {\\n revert VoucherReexecutionNotAllowed();\\n }\\n\\n // execute voucher\\n (bool succ, ) = _destination.call(_payload);\\n\\n // if properly executed, mark it as executed and emit event\\n if (succ) {\\n voucherBitmask.setBit(voucherPosition, true);\\n emit VoucherExecuted(voucherPosition);\\n }\\n\\n return succ;\\n }\\n\\n function wasVoucherExecuted(\\n uint256 _inputIndex,\\n uint256 _outputIndexWithinInput\\n ) external view override returns (bool) {\\n uint256 voucherPosition = LibOutputValidation.getBitMaskPosition(\\n _outputIndexWithinInput,\\n _inputIndex\\n );\\n return _wasVoucherExecuted(voucherPosition);\\n }\\n\\n function _wasVoucherExecuted(\\n uint256 _voucherPosition\\n ) internal view returns (bool) {\\n return voucherBitmask.getBit(_voucherPosition);\\n }\\n\\n function validateNotice(\\n bytes calldata _notice,\\n Proof calldata _proof\\n ) external view override returns (bool) {\\n bytes32 epochHash;\\n uint256 firstInputIndex;\\n uint256 lastInputIndex;\\n\\n // query the current consensus for the desired claim\\n (epochHash, firstInputIndex, lastInputIndex) = getClaim(_proof.context);\\n\\n // validate the epoch input index based on the input index range\\n // provided by the consensus\\n _proof.validity.validateInputIndexRange(\\n firstInputIndex,\\n lastInputIndex\\n );\\n\\n // reverts if proof isn't valid\\n _proof.validity.validateNotice(_notice, epochHash);\\n\\n return true;\\n }\\n\\n /// @notice Retrieve a claim about the DApp from the current consensus.\\n /// The encoding of `_proofContext` might vary depending on the implementation.\\n /// @param _proofContext Data for retrieving the desired claim\\n /// @return The claimed epoch hash\\n /// @return The index of the first input of the epoch in the input box\\n /// @return The index of the last input of the epoch in the input box\\n function getClaim(\\n bytes calldata _proofContext\\n ) internal view returns (bytes32, uint256, uint256) {\\n return consensus.getClaim(address(this), _proofContext);\\n }\\n\\n function migrateToConsensus(\\n IConsensus _newConsensus\\n ) external override onlyOwner {\\n consensus = _newConsensus;\\n\\n _newConsensus.join();\\n\\n emit NewConsensus(_newConsensus);\\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 /// @notice Accept Ether transfers.\\n /// @dev If you wish to transfer Ether to a DApp while informing\\n /// the DApp backend of it, then please do so through the Ether portal contract.\\n receive() external payable {}\\n\\n /// @notice Transfer some amount of Ether to some recipient.\\n /// @param _receiver The address which will receive the amount of Ether\\n /// @param _value The amount of Ether to be transferred in Wei\\n /// @dev This function can only be called by the DApp itself through vouchers.\\n /// If this method is not called by DApp itself, `OnlyDApp` error is raised.\\n /// If the transfer fails, `EtherTransferFailed` error is raised.\\n function withdrawEther(address _receiver, uint256 _value) external {\\n if (msg.sender != address(this)) {\\n revert OnlyDApp();\\n }\\n\\n (bool sent, ) = _receiver.call{value: _value}(\\\"\\\");\\n\\n if (!sent) {\\n revert EtherTransferFailed();\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe54766db1afcbb9578fffc1a87927d95673f1a630d88a7889941878a89761128\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/CartesiDAppFactory.sol\":{\"content\":\"// (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 {ICartesiDAppFactory} from \\\"./ICartesiDAppFactory.sol\\\";\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\nimport {CartesiDApp} from \\\"./CartesiDApp.sol\\\";\\n\\n/// @title Cartesi DApp Factory\\n/// @notice Allows anyone to reliably deploy a new `CartesiDApp` contract.\\ncontract CartesiDAppFactory is ICartesiDAppFactory {\\n function newApplication(\\n IConsensus _consensus,\\n address _dappOwner,\\n bytes32 _templateHash\\n ) external override returns (CartesiDApp) {\\n CartesiDApp application = new CartesiDApp(\\n _consensus,\\n _dappOwner,\\n _templateHash\\n );\\n\\n emit ApplicationCreated(\\n _consensus,\\n _dappOwner,\\n _templateHash,\\n application\\n );\\n\\n return application;\\n }\\n\\n function newApplication(\\n IConsensus _consensus,\\n address _dappOwner,\\n bytes32 _templateHash,\\n bytes32 _salt\\n ) external override returns (CartesiDApp) {\\n CartesiDApp application = new CartesiDApp{salt: _salt}(\\n _consensus,\\n _dappOwner,\\n _templateHash\\n );\\n\\n emit ApplicationCreated(\\n _consensus,\\n _dappOwner,\\n _templateHash,\\n application\\n );\\n\\n return application;\\n }\\n\\n function calculateApplicationAddress(\\n IConsensus _consensus,\\n address _dappOwner,\\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(CartesiDApp).creationCode,\\n abi.encode(_consensus, _dappOwner, _templateHash)\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0xd5f93d28a69df7dc63205026dc5a1865ee989a683f3e648812ded6cefb35f10d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/ICartesiDApp.sol\":{\"content\":\"// (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 \\\"../consensus/IConsensus.sol\\\";\\nimport {OutputValidityProof} from \\\"../library/LibOutputValidation.sol\\\";\\n\\n/// @notice Data for validating outputs.\\n/// @param validity A validity proof for the output\\n/// @param context Data for querying the right claim from the current consensus contract\\n/// @dev The encoding of `context` might vary depending on the implementation of the consensus contract.\\nstruct Proof {\\n OutputValidityProof validity;\\n bytes context;\\n}\\n\\n/// @title Cartesi DApp interface\\ninterface ICartesiDApp {\\n // Events\\n\\n /// @notice The DApp has migrated to another consensus contract.\\n /// @param newConsensus The new consensus contract\\n /// @dev MUST be triggered on a successful call to `migrateToConsensus`.\\n event NewConsensus(IConsensus newConsensus);\\n\\n /// @notice A voucher was executed from the DApp.\\n /// @param voucherId A number that uniquely identifies the voucher\\n /// amongst all vouchers emitted by this DApp\\n event VoucherExecuted(uint256 voucherId);\\n\\n // Permissioned functions\\n\\n /// @notice Migrate the DApp to a new consensus.\\n /// @param _newConsensus The new consensus\\n /// @dev Can only be called by the DApp owner.\\n function migrateToConsensus(IConsensus _newConsensus) external;\\n\\n // Permissionless functions\\n\\n /// @notice Try to execute a voucher.\\n ///\\n /// Reverts if voucher was already successfully executed.\\n ///\\n /// @param _destination The address that will receive the payload through a message call\\n /// @param _payload The payload, which\\u2014in the case of Solidity contracts\\u2014encodes a function call\\n /// @param _proof The proof used to validate the voucher against\\n /// a claim submitted by the current consensus contract\\n /// @return Whether the execution was successful or not\\n /// @dev On a successful execution, emits a `VoucherExecuted` event.\\n /// Execution of already executed voucher will raise a `VoucherReexecutionNotAllowed` error.\\n function executeVoucher(\\n address _destination,\\n bytes calldata _payload,\\n Proof calldata _proof\\n ) external returns (bool);\\n\\n /// @notice Check whether a voucher has been executed.\\n /// @param _inputIndex The index of the input in the input box\\n /// @param _outputIndexWithinInput The index of output emitted by the input\\n /// @return Whether the voucher has been executed before\\n function wasVoucherExecuted(\\n uint256 _inputIndex,\\n uint256 _outputIndexWithinInput\\n ) external view returns (bool);\\n\\n /// @notice Validate a notice.\\n /// @param _notice The notice\\n /// @param _proof Data for validating outputs\\n /// @return Whether the notice is valid or not\\n function validateNotice(\\n bytes calldata _notice,\\n Proof calldata _proof\\n ) external view returns (bool);\\n\\n /// @notice Get the DApp's template hash.\\n /// @return The DApp'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\":\"0x7bb375a4deb593af06955bbf1d88e096f4288f25fa032349796f93705d29386f\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/dapp/ICartesiDAppFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {CartesiDApp} from \\\"./CartesiDApp.sol\\\";\\nimport {IConsensus} from \\\"../consensus/IConsensus.sol\\\";\\n\\n/// @title Cartesi DApp Factory interface\\ninterface ICartesiDAppFactory {\\n // Events\\n\\n /// @notice A new application was deployed.\\n /// @param consensus The initial consensus contract\\n /// @param dappOwner The initial DApp owner\\n /// @param templateHash The initial machine state hash\\n /// @param application The application\\n /// @dev MUST be triggered on a successful call to `newApplication`.\\n event ApplicationCreated(\\n IConsensus indexed consensus,\\n address dappOwner,\\n bytes32 templateHash,\\n CartesiDApp application\\n );\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new application.\\n /// @param _consensus The initial consensus contract\\n /// @param _dappOwner The initial DApp owner\\n /// @param _templateHash The initial machine state hash\\n /// @return The application\\n /// @dev On success, MUST emit an `ApplicationCreated` event.\\n function newApplication(\\n IConsensus _consensus,\\n address _dappOwner,\\n bytes32 _templateHash\\n ) external returns (CartesiDApp);\\n\\n /// @notice Deploy a new application deterministically.\\n /// @param _consensus The initial consensus contract\\n /// @param _dappOwner The initial DApp owner\\n /// @param _templateHash The initial machine state hash\\n /// @param _salt The salt used to deterministically generate the DApp address\\n /// @return The application\\n /// @dev On success, MUST emit an `ApplicationCreated` event.\\n function newApplication(\\n IConsensus _consensus,\\n address _dappOwner,\\n bytes32 _templateHash,\\n bytes32 _salt\\n ) external returns (CartesiDApp);\\n\\n /// @notice Calculate the address of an application to be deployed deterministically.\\n /// @param _consensus The initial consensus contract\\n /// @param _dappOwner The initial DApp owner\\n /// @param _templateHash The initial machine state hash\\n /// @param _salt The salt used to deterministically generate the DApp address\\n /// @return The deterministic application 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 _dappOwner,\\n bytes32 _templateHash,\\n bytes32 _salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0xb6d6ae44b2195f54a5c5ac85dc1c33801036878982c6b9aafe8fb66a3103517b\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/library/LibOutputValidation.sol\":{\"content\":\"// (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 {MerkleV2} from \\\"@cartesi/util/contracts/MerkleV2.sol\\\";\\nimport {OutputEncoding} from \\\"../common/OutputEncoding.sol\\\";\\n\\n/// @param inputIndexWithinEpoch Which input, inside the epoch, the output belongs to\\n/// @param outputIndexWithinInput Index of output emitted by the input\\n/// @param outputHashesRootHash Merkle root of hashes of outputs emitted by the input\\n/// @param vouchersEpochRootHash Merkle root of all epoch's voucher metadata hashes\\n/// @param noticesEpochRootHash Merkle root of all epoch's notice metadata hashes\\n/// @param machineStateHash Hash of the machine state claimed this epoch\\n/// @param outputHashInOutputHashesSiblings Proof that this output metadata is in metadata memory range\\n/// @param outputHashesInEpochSiblings Proof that this output metadata is in epoch's output memory range\\nstruct OutputValidityProof {\\n uint64 inputIndexWithinEpoch;\\n uint64 outputIndexWithinInput;\\n bytes32 outputHashesRootHash;\\n bytes32 vouchersEpochRootHash;\\n bytes32 noticesEpochRootHash;\\n bytes32 machineStateHash;\\n bytes32[] outputHashInOutputHashesSiblings;\\n bytes32[] outputHashesInEpochSiblings;\\n}\\n\\n/// @title Output Validation Library\\nlibrary LibOutputValidation {\\n using CanonicalMachine for CanonicalMachine.Log2Size;\\n\\n /// @notice Raised when some `OutputValidityProof` variables does not match\\n /// the presented finalized epoch.\\n error IncorrectEpochHash();\\n\\n /// @notice Raised when `OutputValidityProof` metadata memory range is NOT\\n /// contained in epoch's output memory range.\\n error IncorrectOutputsEpochRootHash();\\n\\n /// @notice Raised when Merkle root of output hash is NOT contained\\n /// in the output metadata array memory range.\\n error IncorrectOutputHashesRootHash();\\n\\n /// @notice Raised when epoch input index is NOT compatible with the\\n /// provided input index range.\\n error InputIndexOutOfClaimBounds();\\n\\n /// @notice Make sure the output proof is valid, otherwise revert.\\n /// @param v The output validity proof\\n /// @param encodedOutput The encoded output\\n /// @param epochHash The hash of the epoch in which the output was generated\\n /// @param outputsEpochRootHash Either `v.vouchersEpochRootHash` (for vouchers)\\n /// or `v.noticesEpochRootHash` (for notices)\\n /// @param outputEpochLog2Size Either `EPOCH_VOUCHER_LOG2_SIZE` (for vouchers)\\n /// or `EPOCH_NOTICE_LOG2_SIZE` (for notices)\\n /// @param outputHashesLog2Size Either `VOUCHER_METADATA_LOG2_SIZE` (for vouchers)\\n /// or `NOTICE_METADATA_LOG2_SIZE` (for notices)\\n function validateEncodedOutput(\\n OutputValidityProof calldata v,\\n bytes memory encodedOutput,\\n bytes32 epochHash,\\n bytes32 outputsEpochRootHash,\\n uint256 outputEpochLog2Size,\\n uint256 outputHashesLog2Size\\n ) internal pure {\\n // prove that outputs hash is represented in a finalized epoch\\n if (\\n keccak256(\\n abi.encodePacked(\\n v.vouchersEpochRootHash,\\n v.noticesEpochRootHash,\\n v.machineStateHash\\n )\\n ) != epochHash\\n ) {\\n revert IncorrectEpochHash();\\n }\\n\\n // prove that output metadata memory range is contained in epoch's output memory range\\n if (\\n MerkleV2.getRootAfterReplacementInDrive(\\n CanonicalMachine.getIntraMemoryRangePosition(\\n v.inputIndexWithinEpoch,\\n CanonicalMachine.KECCAK_LOG2_SIZE\\n ),\\n CanonicalMachine.KECCAK_LOG2_SIZE.uint64OfSize(),\\n outputEpochLog2Size,\\n v.outputHashesRootHash,\\n v.outputHashesInEpochSiblings\\n ) != outputsEpochRootHash\\n ) {\\n revert IncorrectOutputsEpochRootHash();\\n }\\n\\n // The hash of the output is converted to bytes (abi.encode) and\\n // treated as data. The metadata output memory range stores that data while\\n // being indifferent to its contents. To prove that the received\\n // output is contained in the metadata output memory range we need to\\n // prove that x, where:\\n // x = keccak(\\n // keccak(\\n // keccak(hashOfOutput[0:7]),\\n // keccak(hashOfOutput[8:15])\\n // ),\\n // keccak(\\n // keccak(hashOfOutput[16:23]),\\n // keccak(hashOfOutput[24:31])\\n // )\\n // )\\n // is contained in it. We can't simply use hashOfOutput because the\\n // log2size of the leaf is three (8 bytes) not five (32 bytes)\\n bytes32 merkleRootOfHashOfOutput = MerkleV2.getMerkleRootFromBytes(\\n abi.encodePacked(keccak256(encodedOutput)),\\n CanonicalMachine.KECCAK_LOG2_SIZE.uint64OfSize()\\n );\\n\\n // prove that Merkle root of bytes(hashOfOutput) is contained\\n // in the output metadata array memory range\\n if (\\n MerkleV2.getRootAfterReplacementInDrive(\\n CanonicalMachine.getIntraMemoryRangePosition(\\n v.outputIndexWithinInput,\\n CanonicalMachine.KECCAK_LOG2_SIZE\\n ),\\n CanonicalMachine.KECCAK_LOG2_SIZE.uint64OfSize(),\\n outputHashesLog2Size,\\n merkleRootOfHashOfOutput,\\n v.outputHashInOutputHashesSiblings\\n ) != v.outputHashesRootHash\\n ) {\\n revert IncorrectOutputHashesRootHash();\\n }\\n }\\n\\n /// @notice Make sure the output proof is valid, otherwise revert.\\n /// @param v The output validity proof\\n /// @param destination The address that will receive the payload through a message call\\n /// @param payload The payload, which\\u2014in the case of Solidity contracts\\u2014encodes a function call\\n /// @param epochHash The hash of the epoch in which the output was generated\\n function validateVoucher(\\n OutputValidityProof calldata v,\\n address destination,\\n bytes calldata payload,\\n bytes32 epochHash\\n ) internal pure {\\n bytes memory encodedVoucher = OutputEncoding.encodeVoucher(\\n destination,\\n payload\\n );\\n validateEncodedOutput(\\n v,\\n encodedVoucher,\\n epochHash,\\n v.vouchersEpochRootHash,\\n CanonicalMachine.EPOCH_VOUCHER_LOG2_SIZE.uint64OfSize(),\\n CanonicalMachine.VOUCHER_METADATA_LOG2_SIZE.uint64OfSize()\\n );\\n }\\n\\n /// @notice Make sure the output proof is valid, otherwise revert.\\n /// @param v The output validity proof\\n /// @param notice The notice\\n /// @param epochHash The hash of the epoch in which the output was generated\\n function validateNotice(\\n OutputValidityProof calldata v,\\n bytes calldata notice,\\n bytes32 epochHash\\n ) internal pure {\\n bytes memory encodedNotice = OutputEncoding.encodeNotice(notice);\\n validateEncodedOutput(\\n v,\\n encodedNotice,\\n epochHash,\\n v.noticesEpochRootHash,\\n CanonicalMachine.EPOCH_NOTICE_LOG2_SIZE.uint64OfSize(),\\n CanonicalMachine.NOTICE_METADATA_LOG2_SIZE.uint64OfSize()\\n );\\n }\\n\\n /// @notice Get the position of a voucher on the bit mask.\\n /// @param voucher The index of voucher from those generated by such input\\n /// @param input The index of the input in the DApp's input box\\n /// @return Position of the voucher on the bit mask\\n function getBitMaskPosition(\\n uint256 voucher,\\n uint256 input\\n ) internal pure returns (uint256) {\\n // voucher * 2 ** 128 + input\\n // this shouldn't overflow because it is impossible to have > 2**128 vouchers\\n // and because we are assuming there will be < 2 ** 128 inputs on the input box\\n return (((voucher << 128) | input));\\n }\\n\\n /// @notice Validate input index range and get the input index.\\n /// @param v The output validity proof\\n /// @param firstInputIndex The index of the first input of the epoch in the input box\\n /// @param lastInputIndex The index of the last input of the epoch in the input box\\n /// @return The index of the input in the DApp's input box\\n /// @dev Reverts if epoch input index is not compatible with the provided input index range.\\n function validateInputIndexRange(\\n OutputValidityProof calldata v,\\n uint256 firstInputIndex,\\n uint256 lastInputIndex\\n ) internal pure returns (uint256) {\\n uint256 inputIndex = firstInputIndex + v.inputIndexWithinEpoch;\\n\\n if (inputIndex > lastInputIndex) {\\n revert InputIndexOutOfClaimBounds();\\n }\\n\\n return inputIndex;\\n }\\n}\\n\",\"keccak256\":\"0x874ef478bd265acc94f2480a97191da907f05c6b46dc9e901c534b6acab14e03\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50611af9806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80630e1a07f5146100465780633648bfb514610075578063bd4f121914610088575b600080fd5b6100596100543660046102df565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b610059610083366004610325565b610148565b6100596100963660046102df565b6101ef565b600080828686866040516100ae906102ba565b6001600160a01b03938416815292909116602083015260408201526060018190604051809103906000f59050801580156100ec573d6000803e3d6000fd5b50604080516001600160a01b03888116825260208201889052838116828401529151929350908816917fe73165c2d277daf8713fd08b40845cb6bb7a20b2b543f3d35324a475660fcebd9181900360600190a295945050505050565b60008084848460405161015a906102ba565b6001600160a01b0393841681529290911660208301526040820152606001604051809103906000f080158015610194573d6000803e3d6000fd5b50604080516001600160a01b03878116825260208201879052838116828401529151929350908716917fe73165c2d277daf8713fd08b40845cb6bb7a20b2b543f3d35324a475660fcebd9181900360600190a2949350505050565b60006102738260405180602001610205906102ba565b601f1982820381018352601f9091011660408181526001600160a01b038a811660208401528916908201526060810187905260800160408051601f19818403018152908290526102589291602001610396565b6040516020818303038152906040528051906020012061027c565b95945050505050565b6000610289838330610290565b9392505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b611710806103b483390190565b6001600160a01b03811681146102dc57600080fd5b50565b600080600080608085870312156102f557600080fd5b8435610300816102c7565b93506020850135610310816102c7565b93969395505050506040820135916060013590565b60008060006060848603121561033a57600080fd5b8335610345816102c7565b92506020840135610355816102c7565b929592945050506040919091013590565b6000815160005b81811015610387576020818501810151868301520161036d565b50600093019283525090919050565b60006103ab6103a58386610366565b84610366565b94935050505056fe60a06040523480156200001157600080fd5b506040516200171038038062001710833981016040819052620000349162000212565b6200003f33620000cb565b600180556200004e826200011b565b6080819052600380546001600160a01b0319166001600160a01b0385169081179091556040805163b688a36360e01b8152905163b688a3639160048082019260009290919082900301818387803b158015620000a957600080fd5b505af1158015620000be573d6000803e3d6000fd5b505050505050506200025a565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b620001256200019e565b6001600160a01b038116620001905760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6200019b81620000cb565b50565b6000546001600160a01b03163314620001fa5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000187565b565b6001600160a01b03811681146200019b57600080fd5b6000806000606084860312156200022857600080fd5b83516200023581620001fc565b60208501519093506200024881620001fc565b80925050604084015190509250925092565b60805161149a6200027660003960006101ec015261149a6000f3fe6080604052600436106100e15760003560e01c80638da5cb5b1161007f578063bc197c8111610059578063bc197c8114610288578063f23a6e61146102b4578063f2fde38b146102e0578063fc4116831461030057600080fd5b80638da5cb5b1461022a57806396487d46146102485780639d9b11451461026857600080fd5b8063179e740b116100bb578063179e740b14610186578063522f6815146101b857806361b12c66146101da578063715018a61461021557600080fd5b806301ffc9a7146100ed5780631250482f14610122578063150b7a021461014257600080fd5b366100e857005b600080fd5b3480156100f957600080fd5b5061010d610108366004610d2a565b610320565b60405190151581526020015b60405180910390f35b34801561012e57600080fd5b5061010d61013d366004610dd0565b610357565b34801561014e57600080fd5b5061016d61015d366004610f00565b630a85bd0160e11b949350505050565b6040516001600160e01b03199091168152602001610119565b34801561019257600080fd5b506003546001600160a01b03165b6040516001600160a01b039091168152602001610119565b3480156101c457600080fd5b506101d86101d3366004610f5f565b61053c565b005b3480156101e657600080fd5b506040517f00000000000000000000000000000000000000000000000000000000000000008152602001610119565b34801561022157600080fd5b506101d86105d5565b34801561023657600080fd5b506000546001600160a01b03166101a0565b34801561025457600080fd5b5061010d610263366004610f8b565b6105e9565b34801561027457600080fd5b5061010d610283366004610ff3565b61063a565b34801561029457600080fd5b5061016d6102a3366004611094565b63bc197c8160e01b95945050505050565b3480156102c057600080fd5b5061016d6102cf366004611141565b63f23a6e6160e01b95945050505050565b3480156102ec57600080fd5b506101d86102fb3660046111a9565b61064c565b34801561030c57600080fd5b506101d861031b3660046111a9565b6106ca565b60006001600160e01b03198216630271189760e51b148061035157506301ffc9a760e01b6001600160e01b03198316145b92915050565b600061036161077f565b600080808061037b61037660208801886111c6565b6107d8565b919550935091506103988383610391898061120c565b919061085f565b90506103b4898989876103ab8b8061120c565b939291906108a5565b60006103e86103c3888061120c565b6103d490604081019060200161122c565b6001600160401b03168360809190911b1790565b90506103f3816108da565b15610411576040516370de22b760e01b815260040160405180910390fd5b60008a6001600160a01b03168a8a60405161042d929190611255565b6000604051808303816000865af19150503d806000811461046a576040519150601f19603f3d011682016040523d82523d6000602084013e61046f565b606091505b505090508015610524576040516306449da160e41b815260026004820152602481018390526001604482015273F5B2d8c81cDE4D6238bBf20D3D77DB37df13f73590636449da109060640160006040518083038186803b1580156104d257600080fd5b505af41580156104e6573d6000803e3d6000fd5b505050507f0eb7ee080f865f1cadc4f54daf58cc3b8879e888832867d13351edcec0fbdc548260405161051b91815260200190565b60405180910390a15b9550505050505061053460018055565b949350505050565b33301461055c5760405163a08d601d60e01b815260040160405180910390fd5b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146105a9576040519150601f19603f3d011682016040523d82523d6000602084013e6105ae565b606091505b50509050806105d057604051630ce8f45160e31b815260040160405180910390fd5b505050565b6105dd610958565b6105e760006109b2565b565b60008080806105fe61037660208701876111c6565b919450925090506106148282610391888061120c565b5061062d878785610625898061120c565b929190610a02565b5060019695505050505050565b6000608082901b8317610534816108da565b610654610958565b6001600160a01b0381166106be5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6106c7816109b2565b50565b6106d2610958565b600380546001600160a01b0319166001600160a01b0383169081179091556040805163b688a36360e01b8152905163b688a3639160048082019260009290919082900301818387803b15801561072757600080fd5b505af115801561073b573d6000803e3d6000fd5b50506040516001600160a01b03841681527f4991c6f37185659e276ff918a96f3e20e6c5abcd8c9aab450dc19c2f7ad35cb59250602001905060405180910390a150565b6002600154036107d15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016106b5565b6002600155565b60035460405163035e6a0960e61b8152600091829182916001600160a01b03169063d79a8240906108119030908990899060040161128e565b606060405180830381865afa15801561082e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085291906112bc565b9250925092509250925092565b60008061086f602086018661122c565b610882906001600160401b0316856112ea565b9050828111156105345760405163fd9ae91f60e01b815260040160405180910390fd5b60006108b2858585610a29565b90506108d2868284606083013560255b6001600160401b03166015610a58565b505050505050565b6040516303fbaf7360e01b8152600260048201526024810182905260009073F5B2d8c81cDE4D6238bBf20D3D77DB37df13f735906303fbaf7390604401602060405180830381865af4158015610934573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610351919061130b565b6000546001600160a01b031633146105e75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106b5565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610a0e8484610cfe565b9050610a22858284608083013560256108c2565b5050505050565b6060838383604051602001610a409392919061128e565b60405160208183030381529060405290509392505050565b6040805160608089013560208301526080808a01359383019390935260a0890135908201528591016040516020818303038152906040528051906020012014610ab457604051636fbd3b7160e11b815260040160405180910390fd5b827333436035441927Df1a73FE3AAC5906854632e53d6379de4601610af0610adf60208b018b61122c565b60051b681fffffffffffffffe01690565b60058660408c0135610b0560e08e018e61132d565b6040518763ffffffff1660e01b8152600401610b2696959493929190611376565b602060405180830381865af4158015610b43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6791906113d9565b14610b8557604051634371daa160e11b815260040160405180910390fd5b60007333436035441927Df1a73FE3AAC5906854632e53d63c84583a18780519060200120604051602001610bbb91815260200190565b60408051601f19818403018152908290526001600160e01b031960e084901b168252610bec916005906004016113f2565b602060405180830381865af4158015610c09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2d91906113d9565b905086604001357333436035441927Df1a73FE3AAC5906854632e53d6379de4601610c648a6020016020810190610adf919061122c565b60058686610c7560c08f018f61132d565b6040518763ffffffff1660e01b8152600401610c9696959493929190611376565b602060405180830381865af4158015610cb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd791906113d9565b14610cf55760405163017c689560e61b815260040160405180910390fd5b50505050505050565b60608282604051602001610d13929190611450565b604051602081830303815290604052905092915050565b600060208284031215610d3c57600080fd5b81356001600160e01b031981168114610d5457600080fd5b9392505050565b6001600160a01b03811681146106c757600080fd5b60008083601f840112610d8257600080fd5b5081356001600160401b03811115610d9957600080fd5b602083019150836020828501011115610db157600080fd5b9250929050565b600060408284031215610dca57600080fd5b50919050565b60008060008060608587031215610de657600080fd5b8435610df181610d5b565b935060208501356001600160401b0380821115610e0d57600080fd5b610e1988838901610d70565b90955093506040870135915080821115610e3257600080fd5b50610e3f87828801610db8565b91505092959194509250565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715610e8957610e89610e4b565b604052919050565b600082601f830112610ea257600080fd5b81356001600160401b03811115610ebb57610ebb610e4b565b610ece601f8201601f1916602001610e61565b818152846020838601011115610ee357600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215610f1657600080fd5b8435610f2181610d5b565b93506020850135610f3181610d5b565b92506040850135915060608501356001600160401b03811115610f5357600080fd5b610e3f87828801610e91565b60008060408385031215610f7257600080fd5b8235610f7d81610d5b565b946020939093013593505050565b600080600060408486031215610fa057600080fd5b83356001600160401b0380821115610fb757600080fd5b610fc387838801610d70565b90955093506020860135915080821115610fdc57600080fd5b50610fe986828701610db8565b9150509250925092565b6000806040838503121561100657600080fd5b50508035926020909101359150565b600082601f83011261102657600080fd5b813560206001600160401b0382111561104157611041610e4b565b8160051b611050828201610e61565b928352848101820192828101908785111561106a57600080fd5b83870192505b8483101561108957823582529183019190830190611070565b979650505050505050565b600080600080600060a086880312156110ac57600080fd5b85356110b781610d5b565b945060208601356110c781610d5b565b935060408601356001600160401b03808211156110e357600080fd5b6110ef89838a01611015565b9450606088013591508082111561110557600080fd5b61111189838a01611015565b9350608088013591508082111561112757600080fd5b5061113488828901610e91565b9150509295509295909350565b600080600080600060a0868803121561115957600080fd5b853561116481610d5b565b9450602086013561117481610d5b565b9350604086013592506060860135915060808601356001600160401b0381111561119d57600080fd5b61113488828901610e91565b6000602082840312156111bb57600080fd5b8135610d5481610d5b565b6000808335601e198436030181126111dd57600080fd5b8301803591506001600160401b038211156111f757600080fd5b602001915036819003821315610db157600080fd5b6000823560fe1983360301811261122257600080fd5b9190910192915050565b60006020828403121561123e57600080fd5b81356001600160401b0381168114610d5457600080fd5b8183823760009101908152919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03841681526040602082018190526000906112b39083018486611265565b95945050505050565b6000806000606084860312156112d157600080fd5b8351925060208401519150604084015190509250925092565b8082018082111561035157634e487b7160e01b600052601160045260246000fd5b60006020828403121561131d57600080fd5b81518015158114610d5457600080fd5b6000808335601e1984360301811261134457600080fd5b8301803591506001600160401b0382111561135e57600080fd5b6020019150600581901b3603821315610db157600080fd5b6001600160401b03878116825286166020820152604081018590526060810184905260a060808201819052810182905260006001600160fb1b038311156113bc57600080fd5b8260051b808560c08501379190910160c001979650505050505050565b6000602082840312156113eb57600080fd5b5051919050565b604081526000835180604084015260005b818110156114205760208187018101516060868401015201611403565b506000606082850101526060601f19601f8301168401019150506001600160401b03831660208301529392505050565b60208152600061053460208301848661126556fea2646970667358221220981835fbbf44aedaeb41e0c0c9001ffe55187a0b5606db0cdbf7500fc7c5e30e64736f6c63430008130033a2646970667358221220a12c770ef21751c306949fd9ed57ed453446a67f2dfb1d63d08c918461eca99764736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80630e1a07f5146100465780633648bfb514610075578063bd4f121914610088575b600080fd5b6100596100543660046102df565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b610059610083366004610325565b610148565b6100596100963660046102df565b6101ef565b600080828686866040516100ae906102ba565b6001600160a01b03938416815292909116602083015260408201526060018190604051809103906000f59050801580156100ec573d6000803e3d6000fd5b50604080516001600160a01b03888116825260208201889052838116828401529151929350908816917fe73165c2d277daf8713fd08b40845cb6bb7a20b2b543f3d35324a475660fcebd9181900360600190a295945050505050565b60008084848460405161015a906102ba565b6001600160a01b0393841681529290911660208301526040820152606001604051809103906000f080158015610194573d6000803e3d6000fd5b50604080516001600160a01b03878116825260208201879052838116828401529151929350908716917fe73165c2d277daf8713fd08b40845cb6bb7a20b2b543f3d35324a475660fcebd9181900360600190a2949350505050565b60006102738260405180602001610205906102ba565b601f1982820381018352601f9091011660408181526001600160a01b038a811660208401528916908201526060810187905260800160408051601f19818403018152908290526102589291602001610396565b6040516020818303038152906040528051906020012061027c565b95945050505050565b6000610289838330610290565b9392505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b611710806103b483390190565b6001600160a01b03811681146102dc57600080fd5b50565b600080600080608085870312156102f557600080fd5b8435610300816102c7565b93506020850135610310816102c7565b93969395505050506040820135916060013590565b60008060006060848603121561033a57600080fd5b8335610345816102c7565b92506020840135610355816102c7565b929592945050506040919091013590565b6000815160005b81811015610387576020818501810151868301520161036d565b50600093019283525090919050565b60006103ab6103a58386610366565b84610366565b94935050505056fe60a06040523480156200001157600080fd5b506040516200171038038062001710833981016040819052620000349162000212565b6200003f33620000cb565b600180556200004e826200011b565b6080819052600380546001600160a01b0319166001600160a01b0385169081179091556040805163b688a36360e01b8152905163b688a3639160048082019260009290919082900301818387803b158015620000a957600080fd5b505af1158015620000be573d6000803e3d6000fd5b505050505050506200025a565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b620001256200019e565b6001600160a01b038116620001905760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6200019b81620000cb565b50565b6000546001600160a01b03163314620001fa5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000187565b565b6001600160a01b03811681146200019b57600080fd5b6000806000606084860312156200022857600080fd5b83516200023581620001fc565b60208501519093506200024881620001fc565b80925050604084015190509250925092565b60805161149a6200027660003960006101ec015261149a6000f3fe6080604052600436106100e15760003560e01c80638da5cb5b1161007f578063bc197c8111610059578063bc197c8114610288578063f23a6e61146102b4578063f2fde38b146102e0578063fc4116831461030057600080fd5b80638da5cb5b1461022a57806396487d46146102485780639d9b11451461026857600080fd5b8063179e740b116100bb578063179e740b14610186578063522f6815146101b857806361b12c66146101da578063715018a61461021557600080fd5b806301ffc9a7146100ed5780631250482f14610122578063150b7a021461014257600080fd5b366100e857005b600080fd5b3480156100f957600080fd5b5061010d610108366004610d2a565b610320565b60405190151581526020015b60405180910390f35b34801561012e57600080fd5b5061010d61013d366004610dd0565b610357565b34801561014e57600080fd5b5061016d61015d366004610f00565b630a85bd0160e11b949350505050565b6040516001600160e01b03199091168152602001610119565b34801561019257600080fd5b506003546001600160a01b03165b6040516001600160a01b039091168152602001610119565b3480156101c457600080fd5b506101d86101d3366004610f5f565b61053c565b005b3480156101e657600080fd5b506040517f00000000000000000000000000000000000000000000000000000000000000008152602001610119565b34801561022157600080fd5b506101d86105d5565b34801561023657600080fd5b506000546001600160a01b03166101a0565b34801561025457600080fd5b5061010d610263366004610f8b565b6105e9565b34801561027457600080fd5b5061010d610283366004610ff3565b61063a565b34801561029457600080fd5b5061016d6102a3366004611094565b63bc197c8160e01b95945050505050565b3480156102c057600080fd5b5061016d6102cf366004611141565b63f23a6e6160e01b95945050505050565b3480156102ec57600080fd5b506101d86102fb3660046111a9565b61064c565b34801561030c57600080fd5b506101d861031b3660046111a9565b6106ca565b60006001600160e01b03198216630271189760e51b148061035157506301ffc9a760e01b6001600160e01b03198316145b92915050565b600061036161077f565b600080808061037b61037660208801886111c6565b6107d8565b919550935091506103988383610391898061120c565b919061085f565b90506103b4898989876103ab8b8061120c565b939291906108a5565b60006103e86103c3888061120c565b6103d490604081019060200161122c565b6001600160401b03168360809190911b1790565b90506103f3816108da565b15610411576040516370de22b760e01b815260040160405180910390fd5b60008a6001600160a01b03168a8a60405161042d929190611255565b6000604051808303816000865af19150503d806000811461046a576040519150601f19603f3d011682016040523d82523d6000602084013e61046f565b606091505b505090508015610524576040516306449da160e41b815260026004820152602481018390526001604482015273__$f57eb21c11c6dae369da3ca36f4f48eb77$__90636449da109060640160006040518083038186803b1580156104d257600080fd5b505af41580156104e6573d6000803e3d6000fd5b505050507f0eb7ee080f865f1cadc4f54daf58cc3b8879e888832867d13351edcec0fbdc548260405161051b91815260200190565b60405180910390a15b9550505050505061053460018055565b949350505050565b33301461055c5760405163a08d601d60e01b815260040160405180910390fd5b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146105a9576040519150601f19603f3d011682016040523d82523d6000602084013e6105ae565b606091505b50509050806105d057604051630ce8f45160e31b815260040160405180910390fd5b505050565b6105dd610958565b6105e760006109b2565b565b60008080806105fe61037660208701876111c6565b919450925090506106148282610391888061120c565b5061062d878785610625898061120c565b929190610a02565b5060019695505050505050565b6000608082901b8317610534816108da565b610654610958565b6001600160a01b0381166106be5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6106c7816109b2565b50565b6106d2610958565b600380546001600160a01b0319166001600160a01b0383169081179091556040805163b688a36360e01b8152905163b688a3639160048082019260009290919082900301818387803b15801561072757600080fd5b505af115801561073b573d6000803e3d6000fd5b50506040516001600160a01b03841681527f4991c6f37185659e276ff918a96f3e20e6c5abcd8c9aab450dc19c2f7ad35cb59250602001905060405180910390a150565b6002600154036107d15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016106b5565b6002600155565b60035460405163035e6a0960e61b8152600091829182916001600160a01b03169063d79a8240906108119030908990899060040161128e565b606060405180830381865afa15801561082e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085291906112bc565b9250925092509250925092565b60008061086f602086018661122c565b610882906001600160401b0316856112ea565b9050828111156105345760405163fd9ae91f60e01b815260040160405180910390fd5b60006108b2858585610a29565b90506108d2868284606083013560255b6001600160401b03166015610a58565b505050505050565b6040516303fbaf7360e01b8152600260048201526024810182905260009073__$f57eb21c11c6dae369da3ca36f4f48eb77$__906303fbaf7390604401602060405180830381865af4158015610934573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610351919061130b565b6000546001600160a01b031633146105e75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106b5565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610a0e8484610cfe565b9050610a22858284608083013560256108c2565b5050505050565b6060838383604051602001610a409392919061128e565b60405160208183030381529060405290509392505050565b6040805160608089013560208301526080808a01359383019390935260a0890135908201528591016040516020818303038152906040528051906020012014610ab457604051636fbd3b7160e11b815260040160405180910390fd5b8273__$2a7ef22e717e9afc55afc95d018bf1a85b$__6379de4601610af0610adf60208b018b61122c565b60051b681fffffffffffffffe01690565b60058660408c0135610b0560e08e018e61132d565b6040518763ffffffff1660e01b8152600401610b2696959493929190611376565b602060405180830381865af4158015610b43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6791906113d9565b14610b8557604051634371daa160e11b815260040160405180910390fd5b600073__$2a7ef22e717e9afc55afc95d018bf1a85b$__63c84583a18780519060200120604051602001610bbb91815260200190565b60408051601f19818403018152908290526001600160e01b031960e084901b168252610bec916005906004016113f2565b602060405180830381865af4158015610c09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2d91906113d9565b9050866040013573__$2a7ef22e717e9afc55afc95d018bf1a85b$__6379de4601610c648a6020016020810190610adf919061122c565b60058686610c7560c08f018f61132d565b6040518763ffffffff1660e01b8152600401610c9696959493929190611376565b602060405180830381865af4158015610cb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd791906113d9565b14610cf55760405163017c689560e61b815260040160405180910390fd5b50505050505050565b60608282604051602001610d13929190611450565b604051602081830303815290604052905092915050565b600060208284031215610d3c57600080fd5b81356001600160e01b031981168114610d5457600080fd5b9392505050565b6001600160a01b03811681146106c757600080fd5b60008083601f840112610d8257600080fd5b5081356001600160401b03811115610d9957600080fd5b602083019150836020828501011115610db157600080fd5b9250929050565b600060408284031215610dca57600080fd5b50919050565b60008060008060608587031215610de657600080fd5b8435610df181610d5b565b935060208501356001600160401b0380821115610e0d57600080fd5b610e1988838901610d70565b90955093506040870135915080821115610e3257600080fd5b50610e3f87828801610db8565b91505092959194509250565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715610e8957610e89610e4b565b604052919050565b600082601f830112610ea257600080fd5b81356001600160401b03811115610ebb57610ebb610e4b565b610ece601f8201601f1916602001610e61565b818152846020838601011115610ee357600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215610f1657600080fd5b8435610f2181610d5b565b93506020850135610f3181610d5b565b92506040850135915060608501356001600160401b03811115610f5357600080fd5b610e3f87828801610e91565b60008060408385031215610f7257600080fd5b8235610f7d81610d5b565b946020939093013593505050565b600080600060408486031215610fa057600080fd5b83356001600160401b0380821115610fb757600080fd5b610fc387838801610d70565b90955093506020860135915080821115610fdc57600080fd5b50610fe986828701610db8565b9150509250925092565b6000806040838503121561100657600080fd5b50508035926020909101359150565b600082601f83011261102657600080fd5b813560206001600160401b0382111561104157611041610e4b565b8160051b611050828201610e61565b928352848101820192828101908785111561106a57600080fd5b83870192505b8483101561108957823582529183019190830190611070565b979650505050505050565b600080600080600060a086880312156110ac57600080fd5b85356110b781610d5b565b945060208601356110c781610d5b565b935060408601356001600160401b03808211156110e357600080fd5b6110ef89838a01611015565b9450606088013591508082111561110557600080fd5b61111189838a01611015565b9350608088013591508082111561112757600080fd5b5061113488828901610e91565b9150509295509295909350565b600080600080600060a0868803121561115957600080fd5b853561116481610d5b565b9450602086013561117481610d5b565b9350604086013592506060860135915060808601356001600160401b0381111561119d57600080fd5b61113488828901610e91565b6000602082840312156111bb57600080fd5b8135610d5481610d5b565b6000808335601e198436030181126111dd57600080fd5b8301803591506001600160401b038211156111f757600080fd5b602001915036819003821315610db157600080fd5b6000823560fe1983360301811261122257600080fd5b9190910192915050565b60006020828403121561123e57600080fd5b81356001600160401b0381168114610d5457600080fd5b8183823760009101908152919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03841681526040602082018190526000906112b39083018486611265565b95945050505050565b6000806000606084860312156112d157600080fd5b8351925060208401519150604084015190509250925092565b8082018082111561035157634e487b7160e01b600052601160045260246000fd5b60006020828403121561131d57600080fd5b81518015158114610d5457600080fd5b6000808335601e1984360301811261134457600080fd5b8301803591506001600160401b0382111561135e57600080fd5b6020019150600581901b3603821315610db157600080fd5b6001600160401b03878116825286166020820152604081018590526060810184905260a060808201819052810182905260006001600160fb1b038311156113bc57600080fd5b8260051b808560c08501379190910160c001979650505050505050565b6000602082840312156113eb57600080fd5b5051919050565b604081526000835180604084015260005b818110156114205760208187018101516060868401015201611403565b506000606082850101526060601f19601f8301168401019150506001600160401b03831660208301529392505050565b60208152600061053460208301848661126556fea2646970667358221220981835fbbf44aedaeb41e0c0c9001ffe55187a0b5606db0cdbf7500fc7c5e30e64736f6c63430008130033a2646970667358221220a12c770ef21751c306949fd9ed57ed453446a67f2dfb1d63d08c918461eca99764736f6c63430008130033", - "libraries": { - "Bitmask": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", - "MerkleV2": "0x33436035441927Df1a73FE3AAC5906854632e53d" - }, - "devdoc": { - "events": { - "ApplicationCreated(address,address,bytes32,address)": { - "details": "MUST be triggered on a successful call to `newApplication`.", - "params": { - "application": "The application", - "consensus": "The initial consensus contract", - "dappOwner": "The initial DApp owner", - "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": { - "_consensus": "The initial consensus contract", - "_dappOwner": "The initial DApp owner", - "_salt": "The salt used to deterministically generate the DApp address", - "_templateHash": "The initial machine state hash" - }, - "returns": { - "_0": "The deterministic application address" - } - }, - "newApplication(address,address,bytes32)": { - "details": "On success, MUST emit an `ApplicationCreated` event.", - "params": { - "_consensus": "The initial consensus contract", - "_dappOwner": "The initial DApp owner", - "_templateHash": "The initial machine state hash" - }, - "returns": { - "_0": "The application" - } - }, - "newApplication(address,address,bytes32,bytes32)": { - "details": "On success, MUST emit an `ApplicationCreated` event.", - "params": { - "_consensus": "The initial consensus contract", - "_dappOwner": "The initial DApp owner", - "_salt": "The salt used to deterministically generate the DApp address", - "_templateHash": "The initial machine state hash" - }, - "returns": { - "_0": "The application" - } - } - }, - "title": "Cartesi DApp 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 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 `CartesiDApp` 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 deleted file mode 100644 index 755a108d3..000000000 --- a/deployments/optimism_sepolia/ERC1155BatchPortal.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "address": "0xedB53860A6B52bbb7561Ad596416ee9965B055Aa", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC1155", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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": "0x30624d9de55f779a0793d4c0a4f9793ec551269afbf3b50c63051d38843900fe", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", - "contractAddress": null, - "transactionIndex": 1, - "gasUsed": "370950", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x9fbc52bea6d9296372970c0f28fac5786bfc2aeb19b7b76aea2ff9615d0e0868", - "transactionHash": "0x30624d9de55f779a0793d4c0a4f9793ec551269afbf3b50c63051d38843900fe", - "logs": [], - "blockNumber": 5400904, - "cumulativeGasUsed": "417839", - "status": 1, - "byzantium": true - }, - "args": [ - "0x59b22D57D4f067708AB0c00552767405926dc768" - ], - "numDeployments": 1, - "solcInputHash": "54ee33aea592269e6046663615f287b6", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"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\":\"_dapp\",\"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 `_tokenIds` and `_values` have the same length.\",\"params\":{\"_baseLayerData\":\"Additional data to be interpreted by the base layer\",\"_dapp\":\"The address of the DApp\",\"_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 to a DApp and add an input to the DApp'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 input relay.\"}},\"notice\":\"This contract allows anyone to perform batch transfers of ERC-1155 tokens to a DApp 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 v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token 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 amount 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 `amount` tokens of token type `id` from `from` to `to`.\\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 `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 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` 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 amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon 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 caller.\\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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"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 and relays.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Ether being sent in Wei\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\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 ret The return value of `transferFrom`\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param amount The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\n function encodeERC20Deposit(\\n bool ret,\\n IERC20 token,\\n address sender,\\n uint256 amount,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n ret, // 1B\\n token, // 20B\\n sender, // 20B\\n amount, // 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\\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\\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\\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 /// @notice Encode a DApp address relay.\\n /// @param dapp The DApp address\\n /// @return The encoded input\\n function encodeDAppAddressRelay(\\n address dapp\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n dapp // 20B\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5dce266a7b70ba86adf6a728c7667255d3e2b20f1789a951150a1d05439b7019\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputRelay.sol\":{\"content\":\"// (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 \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay interface\\ninterface IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this input relay.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x8c9316c43cc2c7754fbd5abccfcdbc5ed09a2f1228d993240eac6c41ea531521\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/InputRelay.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputRelay} from \\\"./IInputRelay.sol\\\";\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay\\n/// @notice This contract serves as a base for all the other input relays.\\ncontract InputRelay is IInputRelay {\\n /// @notice The input box used by the input relay.\\n IInputBox internal immutable inputBox;\\n\\n /// @notice Constructs the input relay.\\n /// @param _inputBox The input box used by the input relay\\n constructor(IInputBox _inputBox) {\\n inputBox = _inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return inputBox;\\n }\\n}\\n\",\"keccak256\":\"0xbb489f157a0bd7a9da29b0bf3c47c4b4051d90ccd252abc3f81c8e897329e590\",\"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 {InputRelay} from \\\"../inputs/InputRelay.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 a DApp while informing the off-chain machine.\\ncontract ERC1155BatchPortal is InputRelay, IERC1155BatchPortal {\\n /// @notice Constructs the portal.\\n /// @param _inputBox The input box used by the portal\\n constructor(IInputBox _inputBox) InputRelay(_inputBox) {}\\n\\n function depositBatchERC1155Token(\\n IERC1155 _token,\\n address _dapp,\\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 _dapp,\\n _tokenIds,\\n _values,\\n _baseLayerData\\n );\\n\\n bytes memory input = InputEncoding.encodeBatchERC1155Deposit(\\n _token,\\n msg.sender,\\n _tokenIds,\\n _values,\\n _baseLayerData,\\n _execLayerData\\n );\\n\\n inputBox.addInput(_dapp, input);\\n }\\n}\\n\",\"keccak256\":\"0x8aab3384ab673cf9dd34da33b2a1c9efbbfb4960acaee44c7d50c63344237d86\",\"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 {IInputRelay} from \\\"../inputs/IInputRelay.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title ERC-1155 Batch Transfer Portal interface\\ninterface IERC1155BatchPortal is IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Transfer a batch of ERC-1155 tokens to a DApp and add an input to\\n /// the DApp'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 _dapp The address of the DApp\\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 `_tokenIds` and `_values` have the same length.\\n function depositBatchERC1155Token(\\n IERC1155 _token,\\n address _dapp,\\n uint256[] calldata _tokenIds,\\n uint256[] calldata _values,\\n bytes calldata _baseLayerData,\\n bytes calldata _execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0xfd76007f27ca0b4886d477eabdbda517e6a4a139c2b044cd8b59debf4894016d\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b5060405161064538038061064583398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516105b461009160003960008181603c015261012601526105b46000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806324d15c6714610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a6100853660046102c1565b61008c565b005b604051631759616b60e11b81526001600160a01b038b1690632eb2c2d6906100c69033908d908d908d908d908d908d908d90600401610404565b600060405180830381600087803b1580156100e057600080fd5b505af11580156100f4573d6000803e3d6000fd5b50505050600061010c8b338b8b8b8b8b8b8b8b6101ae565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061015d908d90859060040161048c565b6020604051808303816000875af115801561017c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a091906104ce565b505050505050505050505050565b6060600089898989898989896040516020016101d19897969594939291906104e7565b60405160208183030381529060405290508b8b826040516020016101f793929190610538565b6040516020818303038152906040529150509a9950505050505050505050565b80356001600160a01b038116811461022e57600080fd5b919050565b60008083601f84011261024557600080fd5b50813567ffffffffffffffff81111561025d57600080fd5b6020830191508360208260051b850101111561027857600080fd5b9250929050565b60008083601f84011261029157600080fd5b50813567ffffffffffffffff8111156102a957600080fd5b60208301915083602082850101111561027857600080fd5b60008060008060008060008060008060c08b8d0312156102e057600080fd5b6102e98b610217565b99506102f760208c01610217565b985060408b013567ffffffffffffffff8082111561031457600080fd5b6103208e838f01610233565b909a50985060608d013591508082111561033957600080fd5b6103458e838f01610233565b909850965060808d013591508082111561035e57600080fd5b61036a8e838f0161027f565b909650945060a08d013591508082111561038357600080fd5b506103908d828e0161027f565b915080935050809150509295989b9194979a5092959850565b81835260006001600160fb1b038311156103c257600080fd5b8260051b80836020870137939093016020019392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0389811682528816602082015260a060408201819052600090610431908301888a6103a9565b82810360608401526104448187896103a9565b905082810360808401526104598185876103db565b9b9a5050505050505050505050565b60005b8381101561048357818101518382015260200161046b565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526104b9816060850160208701610468565b601f01601f1916919091016060019392505050565b6000602082840312156104e057600080fd5b5051919050565b6080815260006104fb608083018a8c6103a9565b828103602084015261050e81898b6103a9565b905082810360408401526105238187896103db565b905082810360608401526104598185876103db565b60006bffffffffffffffffffffffff19808660601b168352808560601b16601484015250825161056f816028850160208701610468565b9190910160280194935050505056fea2646970667358221220b1261ceaf7c0f69c5d0d611864ae36802a7987738f02b3c9f93c1843357f32eb64736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806324d15c6714610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a6100853660046102c1565b61008c565b005b604051631759616b60e11b81526001600160a01b038b1690632eb2c2d6906100c69033908d908d908d908d908d908d908d90600401610404565b600060405180830381600087803b1580156100e057600080fd5b505af11580156100f4573d6000803e3d6000fd5b50505050600061010c8b338b8b8b8b8b8b8b8b6101ae565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061015d908d90859060040161048c565b6020604051808303816000875af115801561017c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a091906104ce565b505050505050505050505050565b6060600089898989898989896040516020016101d19897969594939291906104e7565b60405160208183030381529060405290508b8b826040516020016101f793929190610538565b6040516020818303038152906040529150509a9950505050505050505050565b80356001600160a01b038116811461022e57600080fd5b919050565b60008083601f84011261024557600080fd5b50813567ffffffffffffffff81111561025d57600080fd5b6020830191508360208260051b850101111561027857600080fd5b9250929050565b60008083601f84011261029157600080fd5b50813567ffffffffffffffff8111156102a957600080fd5b60208301915083602082850101111561027857600080fd5b60008060008060008060008060008060c08b8d0312156102e057600080fd5b6102e98b610217565b99506102f760208c01610217565b985060408b013567ffffffffffffffff8082111561031457600080fd5b6103208e838f01610233565b909a50985060608d013591508082111561033957600080fd5b6103458e838f01610233565b909850965060808d013591508082111561035e57600080fd5b61036a8e838f0161027f565b909650945060a08d013591508082111561038357600080fd5b506103908d828e0161027f565b915080935050809150509295989b9194979a5092959850565b81835260006001600160fb1b038311156103c257600080fd5b8260051b80836020870137939093016020019392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0389811682528816602082015260a060408201819052600090610431908301888a6103a9565b82810360608401526104448187896103a9565b905082810360808401526104598185876103db565b9b9a5050505050505050505050565b60005b8381101561048357818101518382015260200161046b565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526104b9816060850160208701610468565b601f01601f1916919091016060019392505050565b6000602082840312156104e057600080fd5b5051919050565b6080815260006104fb608083018a8c6103a9565b828103602084015261050e81898b6103a9565b905082810360408401526105238187896103db565b905082810360608401526104598185876103db565b60006bffffffffffffffffffffffff19808660601b168352808560601b16601484015250825161056f816028850160208701610468565b9190910160280194935050505056fea2646970667358221220b1261ceaf7c0f69c5d0d611864ae36802a7987738f02b3c9f93c1843357f32eb64736f6c63430008130033", - "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 `_tokenIds` and `_values` have the same length.", - "params": { - "_baseLayerData": "Additional data to be interpreted by the base layer", - "_dapp": "The address of the DApp", - "_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 to a DApp and add an input to the DApp'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 input relay." - } - }, - "notice": "This contract allows anyone to perform batch transfers of ERC-1155 tokens to a DApp 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 deleted file mode 100644 index bb1db8a1a..000000000 --- a/deployments/optimism_sepolia/ERC1155SinglePortal.json +++ /dev/null @@ -1,138 +0,0 @@ -{ - "address": "0x7CFB0193Ca87eB6e48056885E026552c3A941FC4", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC1155", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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": "0x909908dcbd7af7a310223bbb9558e0aae727e1e03ec6bf9bbc5e408021b3992a", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", - "contractAddress": null, - "transactionIndex": 1, - "gasUsed": "317542", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x3c0cf9265d844ed9bf5cc7b472db3b549e0ffefb31179fc49e8a60185e04b77f", - "transactionHash": "0x909908dcbd7af7a310223bbb9558e0aae727e1e03ec6bf9bbc5e408021b3992a", - "logs": [], - "blockNumber": 5400900, - "cumulativeGasUsed": "381531", - "status": 1, - "byzantium": true - }, - "args": [ - "0x59b22D57D4f067708AB0c00552767405926dc768" - ], - "numDeployments": 1, - "solcInputHash": "54ee33aea592269e6046663615f287b6", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"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\":\"_dapp\",\"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\":{\"_baseLayerData\":\"Additional data to be interpreted by the base layer\",\"_dapp\":\"The address of the DApp\",\"_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 an ERC-1155 token to a DApp and add an input to the DApp'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 input relay.\"}},\"notice\":\"This contract allows anyone to perform single transfers of ERC-1155 tokens to a DApp 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 v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token 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 amount 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 `amount` tokens of token type `id` from `from` to `to`.\\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 `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 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` 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 amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon 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 caller.\\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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"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 and relays.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Ether being sent in Wei\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\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 ret The return value of `transferFrom`\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param amount The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\n function encodeERC20Deposit(\\n bool ret,\\n IERC20 token,\\n address sender,\\n uint256 amount,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n ret, // 1B\\n token, // 20B\\n sender, // 20B\\n amount, // 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\\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\\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\\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 /// @notice Encode a DApp address relay.\\n /// @param dapp The DApp address\\n /// @return The encoded input\\n function encodeDAppAddressRelay(\\n address dapp\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n dapp // 20B\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5dce266a7b70ba86adf6a728c7667255d3e2b20f1789a951150a1d05439b7019\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputRelay.sol\":{\"content\":\"// (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 \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay interface\\ninterface IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this input relay.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x8c9316c43cc2c7754fbd5abccfcdbc5ed09a2f1228d993240eac6c41ea531521\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/InputRelay.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputRelay} from \\\"./IInputRelay.sol\\\";\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay\\n/// @notice This contract serves as a base for all the other input relays.\\ncontract InputRelay is IInputRelay {\\n /// @notice The input box used by the input relay.\\n IInputBox internal immutable inputBox;\\n\\n /// @notice Constructs the input relay.\\n /// @param _inputBox The input box used by the input relay\\n constructor(IInputBox _inputBox) {\\n inputBox = _inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return inputBox;\\n }\\n}\\n\",\"keccak256\":\"0xbb489f157a0bd7a9da29b0bf3c47c4b4051d90ccd252abc3f81c8e897329e590\",\"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 {InputRelay} from \\\"../inputs/InputRelay.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 a DApp while informing the off-chain machine.\\ncontract ERC1155SinglePortal is InputRelay, IERC1155SinglePortal {\\n /// @notice Constructs the portal.\\n /// @param _inputBox The input box used by the portal\\n constructor(IInputBox _inputBox) InputRelay(_inputBox) {}\\n\\n function depositSingleERC1155Token(\\n IERC1155 _token,\\n address _dapp,\\n uint256 _tokenId,\\n uint256 _value,\\n bytes calldata _baseLayerData,\\n bytes calldata _execLayerData\\n ) external override {\\n _token.safeTransferFrom(\\n msg.sender,\\n _dapp,\\n _tokenId,\\n _value,\\n _baseLayerData\\n );\\n\\n bytes memory input = InputEncoding.encodeSingleERC1155Deposit(\\n _token,\\n msg.sender,\\n _tokenId,\\n _value,\\n _baseLayerData,\\n _execLayerData\\n );\\n\\n inputBox.addInput(_dapp, input);\\n }\\n}\\n\",\"keccak256\":\"0x1647752c6abb80e283258cc863425845d31f3b2a53f85bc4d1db91853416b434\",\"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 {IInputRelay} from \\\"../inputs/IInputRelay.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title ERC-1155 Single Transfer Portal interface\\ninterface IERC1155SinglePortal is IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Transfer an ERC-1155 token to a DApp and add an input to\\n /// the DApp'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 _dapp The address of the DApp\\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 _dapp,\\n uint256 _tokenId,\\n uint256 _value,\\n bytes calldata _baseLayerData,\\n bytes calldata _execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0x1d3c93c70d81ede71436b43dfecbfa9f644010ca08f4197bfb966831451dab6d\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b5060405161054e38038061054e83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516104bd61009160003960008181603c015261012001526104bd6000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a578063dec07dca14610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a61008536600461026a565b61008c565b005b604051637921219560e11b81526001600160a01b0389169063f242432a906100c29033908b908b908b908b908b9060040161033b565b600060405180830381600087803b1580156100dc57600080fd5b505af11580156100f0573d6000803e3d6000fd5b50505050600061010689338989898989896101a6565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd6390610157908b9085906004016103a6565b6020604051808303816000875af1158015610176573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019a91906103e8565b50505050505050505050565b60606000858585856040516020016101c19493929190610401565b604051602081830303815290604052905089898989846040516020016101eb959493929190610433565b60405160208183030381529060405291505098975050505050505050565b6001600160a01b038116811461021e57600080fd5b50565b60008083601f84011261023357600080fd5b50813567ffffffffffffffff81111561024b57600080fd5b60208301915083602082850101111561026357600080fd5b9250929050565b60008060008060008060008060c0898b03121561028657600080fd5b883561029181610209565b975060208901356102a181610209565b96506040890135955060608901359450608089013567ffffffffffffffff808211156102cc57600080fd5b6102d88c838d01610221565b909650945060a08b01359150808211156102f157600080fd5b506102fe8b828c01610221565b999c989b5096995094979396929594505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03878116825286166020820152604081018590526060810184905260a0608082018190526000906103769083018486610312565b98975050505050505050565b60005b8381101561039d578181015183820152602001610385565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526103d3816060850160208701610382565b601f01601f1916919091016060019392505050565b6000602082840312156103fa57600080fd5b5051919050565b604081526000610415604083018688610312565b8281036020840152610428818587610312565b979650505050505050565b60006bffffffffffffffffffffffff19808860601b168352808760601b166014840152508460288301528360488301528251610476816068850160208701610382565b91909101606801969550505050505056fea26469706673582212208a2be17b506fdeea2c29cef703e184884f695e71e9147dce06da5055620ed53364736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a578063dec07dca14610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a61008536600461026a565b61008c565b005b604051637921219560e11b81526001600160a01b0389169063f242432a906100c29033908b908b908b908b908b9060040161033b565b600060405180830381600087803b1580156100dc57600080fd5b505af11580156100f0573d6000803e3d6000fd5b50505050600061010689338989898989896101a6565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd6390610157908b9085906004016103a6565b6020604051808303816000875af1158015610176573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019a91906103e8565b50505050505050505050565b60606000858585856040516020016101c19493929190610401565b604051602081830303815290604052905089898989846040516020016101eb959493929190610433565b60405160208183030381529060405291505098975050505050505050565b6001600160a01b038116811461021e57600080fd5b50565b60008083601f84011261023357600080fd5b50813567ffffffffffffffff81111561024b57600080fd5b60208301915083602082850101111561026357600080fd5b9250929050565b60008060008060008060008060c0898b03121561028657600080fd5b883561029181610209565b975060208901356102a181610209565b96506040890135955060608901359450608089013567ffffffffffffffff808211156102cc57600080fd5b6102d88c838d01610221565b909650945060a08b01359150808211156102f157600080fd5b506102fe8b828c01610221565b999c989b5096995094979396929594505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03878116825286166020820152604081018590526060810184905260a0608082018190526000906103769083018486610312565b98975050505050505050565b60005b8381101561039d578181015183820152602001610385565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526103d3816060850160208701610382565b601f01601f1916919091016060019392505050565b6000602082840312156103fa57600080fd5b5051919050565b604081526000610415604083018688610312565b8281036020840152610428818587610312565b979650505050505050565b60006bffffffffffffffffffffffff19808860601b168352808760601b166014840152508460288301528360488301528251610476816068850160208701610382565b91909101606801969550505050505056fea26469706673582212208a2be17b506fdeea2c29cef703e184884f695e71e9147dce06da5055620ed53364736f6c63430008130033", - "devdoc": { - "kind": "dev", - "methods": { - "constructor": { - "params": { - "_inputBox": "The input box used by the portal" - } - }, - "depositSingleERC1155Token(address,address,uint256,uint256,bytes,bytes)": { - "params": { - "_baseLayerData": "Additional data to be interpreted by the base layer", - "_dapp": "The address of the DApp", - "_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 an ERC-1155 token to a DApp and add an input to the DApp'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 input relay." - } - }, - "notice": "This contract allows anyone to perform single transfers of ERC-1155 tokens to a DApp 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 deleted file mode 100644 index c29e7437e..000000000 --- a/deployments/optimism_sepolia/ERC20Portal.json +++ /dev/null @@ -1,126 +0,0 @@ -{ - "address": "0x9C21AEb2093C32DDbC53eEF24B873BDCd1aDa1DB", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC20", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "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": "0x50b2b7741f3161cf192a371232d8c7a1f4c57ccd2f4642b879d476306bc18ef7", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", - "contractAddress": null, - "transactionIndex": 1, - "gasUsed": "265834", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x22f2738c002dfcedeff3e3aad052313f1bc597eb467c06b83f35b142dfaf1855", - "transactionHash": "0x50b2b7741f3161cf192a371232d8c7a1f4c57ccd2f4642b879d476306bc18ef7", - "logs": [], - "blockNumber": 5394613, - "cumulativeGasUsed": "312735", - "status": 1, - "byzantium": true - }, - "args": [ - "0x59b22D57D4f067708AB0c00552767405926dc768" - ], - "numDeployments": 1, - "solcInputHash": "54ee33aea592269e6046663615f287b6", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"_inputBox\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_dapp\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"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\":{\"_amount\":\"The amount of tokens to be transferred\",\"_dapp\":\"The address of the DApp\",\"_execLayerData\":\"Additional data to be interpreted by the execution layer\",\"_token\":\"The ERC-20 token contract\"}},\"getInputBox()\":{\"returns\":{\"_0\":\"The input box\"}}},\"title\":\"ERC-20 Portal\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs the portal.\"},\"depositERC20Tokens(address,address,uint256,bytes)\":{\"notice\":\"Transfer ERC-20 tokens to a DApp and add an input to the DApp's input box to signal such operation. The caller must allow the portal to withdraw at least `_amount` tokens from their account beforehand, by calling the `approve` function in the token contract.\"},\"getInputBox()\":{\"notice\":\"Get the input box used by this input relay.\"}},\"notice\":\"This contract allows anyone to perform transfers of ERC-20 tokens to a DApp 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 v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token 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 amount 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 `amount` tokens of token type `id` from `from` to `to`.\\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 `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 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` 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 amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon 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 caller.\\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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"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 and relays.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Ether being sent in Wei\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\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 ret The return value of `transferFrom`\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param amount The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\n function encodeERC20Deposit(\\n bool ret,\\n IERC20 token,\\n address sender,\\n uint256 amount,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n ret, // 1B\\n token, // 20B\\n sender, // 20B\\n amount, // 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\\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\\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\\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 /// @notice Encode a DApp address relay.\\n /// @param dapp The DApp address\\n /// @return The encoded input\\n function encodeDAppAddressRelay(\\n address dapp\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n dapp // 20B\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5dce266a7b70ba86adf6a728c7667255d3e2b20f1789a951150a1d05439b7019\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputRelay.sol\":{\"content\":\"// (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 \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay interface\\ninterface IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this input relay.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x8c9316c43cc2c7754fbd5abccfcdbc5ed09a2f1228d993240eac6c41ea531521\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/InputRelay.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputRelay} from \\\"./IInputRelay.sol\\\";\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay\\n/// @notice This contract serves as a base for all the other input relays.\\ncontract InputRelay is IInputRelay {\\n /// @notice The input box used by the input relay.\\n IInputBox internal immutable inputBox;\\n\\n /// @notice Constructs the input relay.\\n /// @param _inputBox The input box used by the input relay\\n constructor(IInputBox _inputBox) {\\n inputBox = _inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return inputBox;\\n }\\n}\\n\",\"keccak256\":\"0xbb489f157a0bd7a9da29b0bf3c47c4b4051d90ccd252abc3f81c8e897329e590\",\"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 {InputRelay} from \\\"../inputs/InputRelay.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 a DApp while informing the off-chain machine.\\ncontract ERC20Portal is InputRelay, IERC20Portal {\\n /// @notice Constructs the portal.\\n /// @param _inputBox The input box used by the portal\\n constructor(IInputBox _inputBox) InputRelay(_inputBox) {}\\n\\n function depositERC20Tokens(\\n IERC20 _token,\\n address _dapp,\\n uint256 _amount,\\n bytes calldata _execLayerData\\n ) external override {\\n bool success = _token.transferFrom(msg.sender, _dapp, _amount);\\n\\n bytes memory input = InputEncoding.encodeERC20Deposit(\\n success,\\n _token,\\n msg.sender,\\n _amount,\\n _execLayerData\\n );\\n\\n inputBox.addInput(_dapp, input);\\n }\\n}\\n\",\"keccak256\":\"0x0de20df5988c4cda715ff1b1fbf30119822b850d2541d9a7119b8d44907da31f\",\"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 {IInputRelay} from \\\"../inputs/IInputRelay.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title ERC-20 Portal interface\\ninterface IERC20Portal is IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Transfer ERC-20 tokens to a DApp and add an input to\\n /// the DApp's input box to signal such operation.\\n ///\\n /// The caller must allow the portal to withdraw at least `_amount` 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 _dapp The address of the DApp\\n /// @param _amount 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 _dapp,\\n uint256 _amount,\\n bytes calldata _execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0xaeacb82606f1a687170c230eb169094cb3eea8ddc4838dc13f4830721fb5234b\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b5060405161045f38038061045f83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516103ce61009160003960008181603c015261013501526103ce6000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806395854b8114610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a610085366004610209565b61008c565b005b6040516323b872dd60e01b81523360048201526001600160a01b03858116602483015260448201859052600091908716906323b872dd906064016020604051808303816000875af11580156100e5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061010991906102a8565b9050600061011b8288338888886101b9565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061016c90899085906004016102d1565b6020604051808303816000875af115801561018b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101af919061032f565b5050505050505050565b60608686868686866040516020016101d696959493929190610348565b60405160208183030381529060405290509695505050505050565b6001600160a01b038116811461020657600080fd5b50565b60008060008060006080868803121561022157600080fd5b853561022c816101f1565b9450602086013561023c816101f1565b935060408601359250606086013567ffffffffffffffff8082111561026057600080fd5b818801915088601f83011261027457600080fd5b81358181111561028357600080fd5b89602082850101111561029557600080fd5b9699959850939650602001949392505050565b6000602082840312156102ba57600080fd5b815180151581146102ca57600080fd5b9392505050565b60018060a01b038316815260006020604081840152835180604085015260005b8181101561030d578581018301518582016060015282016102f1565b506000606082860101526060601f19601f830116850101925050509392505050565b60006020828403121561034157600080fd5b5051919050565b86151560f81b815260006bffffffffffffffffffffffff19808860601b166001840152808760601b166015840152508460298301528284604984013750600091016049019081529594505050505056fea26469706673582212205635c4a24e9e9f5e128a69b633d53f24838d8833b76e4fca1f3bf3b490e380c664736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806395854b8114610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a610085366004610209565b61008c565b005b6040516323b872dd60e01b81523360048201526001600160a01b03858116602483015260448201859052600091908716906323b872dd906064016020604051808303816000875af11580156100e5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061010991906102a8565b9050600061011b8288338888886101b9565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061016c90899085906004016102d1565b6020604051808303816000875af115801561018b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101af919061032f565b5050505050505050565b60608686868686866040516020016101d696959493929190610348565b60405160208183030381529060405290509695505050505050565b6001600160a01b038116811461020657600080fd5b50565b60008060008060006080868803121561022157600080fd5b853561022c816101f1565b9450602086013561023c816101f1565b935060408601359250606086013567ffffffffffffffff8082111561026057600080fd5b818801915088601f83011261027457600080fd5b81358181111561028357600080fd5b89602082850101111561029557600080fd5b9699959850939650602001949392505050565b6000602082840312156102ba57600080fd5b815180151581146102ca57600080fd5b9392505050565b60018060a01b038316815260006020604081840152835180604085015260005b8181101561030d578581018301518582016060015282016102f1565b506000606082860101526060601f19601f830116850101925050509392505050565b60006020828403121561034157600080fd5b5051919050565b86151560f81b815260006bffffffffffffffffffffffff19808860601b166001840152808760601b166015840152508460298301528284604984013750600091016049019081529594505050505056fea26469706673582212205635c4a24e9e9f5e128a69b633d53f24838d8833b76e4fca1f3bf3b490e380c664736f6c63430008130033", - "devdoc": { - "kind": "dev", - "methods": { - "constructor": { - "params": { - "_inputBox": "The input box used by the portal" - } - }, - "depositERC20Tokens(address,address,uint256,bytes)": { - "params": { - "_amount": "The amount of tokens to be transferred", - "_dapp": "The address of the DApp", - "_execLayerData": "Additional data to be interpreted by the execution layer", - "_token": "The ERC-20 token contract" - } - }, - "getInputBox()": { - "returns": { - "_0": "The input box" - } - } - }, - "title": "ERC-20 Portal", - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "constructor": { - "notice": "Constructs the portal." - }, - "depositERC20Tokens(address,address,uint256,bytes)": { - "notice": "Transfer ERC-20 tokens to a DApp and add an input to the DApp's input box to signal such operation. The caller must allow the portal to withdraw at least `_amount` tokens from their account beforehand, by calling the `approve` function in the token contract." - }, - "getInputBox()": { - "notice": "Get the input box used by this input relay." - } - }, - "notice": "This contract allows anyone to perform transfers of ERC-20 tokens to a DApp 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 deleted file mode 100644 index a7037d082..000000000 --- a/deployments/optimism_sepolia/ERC721Portal.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "address": "0x237F8DD094C0e47f4236f12b4Fa01d6Dae89fb87", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC721", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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": "0x067526ff6e73afe3f67e1c86776aa27367b6a143f1ac194d8ff2f8b8fad410a6", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", - "contractAddress": null, - "transactionIndex": 1, - "gasUsed": "308450", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xf15ce3b5655f81c66b567242ec4567d62e51f221d1b29561413032c5af33a12c", - "transactionHash": "0x067526ff6e73afe3f67e1c86776aa27367b6a143f1ac194d8ff2f8b8fad410a6", - "logs": [], - "blockNumber": 5395075, - "cumulativeGasUsed": "355351", - "status": 1, - "byzantium": true - }, - "args": [ - "0x59b22D57D4f067708AB0c00552767405926dc768" - ], - "numDeployments": 1, - "solcInputHash": "54ee33aea592269e6046663615f287b6", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"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\":\"_dapp\",\"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\":{\"_baseLayerData\":\"Additional data to be interpreted by the base layer\",\"_dapp\":\"The address of the DApp\",\"_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 a DApp and add an input to the DApp'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 input relay.\"}},\"notice\":\"This contract allows anyone to perform transfers of ERC-721 tokens to a DApp 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 v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token 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 amount 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 `amount` tokens of token type `id` from `from` to `to`.\\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 `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 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` 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 amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon 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 caller.\\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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"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 and relays.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Ether being sent in Wei\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\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 ret The return value of `transferFrom`\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param amount The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\n function encodeERC20Deposit(\\n bool ret,\\n IERC20 token,\\n address sender,\\n uint256 amount,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n ret, // 1B\\n token, // 20B\\n sender, // 20B\\n amount, // 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\\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\\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\\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 /// @notice Encode a DApp address relay.\\n /// @param dapp The DApp address\\n /// @return The encoded input\\n function encodeDAppAddressRelay(\\n address dapp\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n dapp // 20B\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5dce266a7b70ba86adf6a728c7667255d3e2b20f1789a951150a1d05439b7019\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputRelay.sol\":{\"content\":\"// (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 \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay interface\\ninterface IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this input relay.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x8c9316c43cc2c7754fbd5abccfcdbc5ed09a2f1228d993240eac6c41ea531521\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/InputRelay.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputRelay} from \\\"./IInputRelay.sol\\\";\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay\\n/// @notice This contract serves as a base for all the other input relays.\\ncontract InputRelay is IInputRelay {\\n /// @notice The input box used by the input relay.\\n IInputBox internal immutable inputBox;\\n\\n /// @notice Constructs the input relay.\\n /// @param _inputBox The input box used by the input relay\\n constructor(IInputBox _inputBox) {\\n inputBox = _inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return inputBox;\\n }\\n}\\n\",\"keccak256\":\"0xbb489f157a0bd7a9da29b0bf3c47c4b4051d90ccd252abc3f81c8e897329e590\",\"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 {InputRelay} from \\\"../inputs/InputRelay.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 a DApp while informing the off-chain machine.\\ncontract ERC721Portal is InputRelay, IERC721Portal {\\n /// @notice Constructs the portal.\\n /// @param _inputBox The input box used by the portal\\n constructor(IInputBox _inputBox) InputRelay(_inputBox) {}\\n\\n function depositERC721Token(\\n IERC721 _token,\\n address _dapp,\\n uint256 _tokenId,\\n bytes calldata _baseLayerData,\\n bytes calldata _execLayerData\\n ) external override {\\n _token.safeTransferFrom(msg.sender, _dapp, _tokenId, _baseLayerData);\\n\\n bytes memory input = InputEncoding.encodeERC721Deposit(\\n _token,\\n msg.sender,\\n _tokenId,\\n _baseLayerData,\\n _execLayerData\\n );\\n\\n inputBox.addInput(_dapp, input);\\n }\\n}\\n\",\"keccak256\":\"0xe402b9ad4394ceb4e6bc0a0fe9df7fa0f9ee46709b8046ed50fe2f83ab259a9e\",\"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 {IInputRelay} from \\\"../inputs/IInputRelay.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title ERC-721 Portal interface\\ninterface IERC721Portal is IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Transfer an ERC-721 token to a DApp and add an input to\\n /// the DApp'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 _dapp The address of the DApp\\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 _dapp,\\n uint256 _tokenId,\\n bytes calldata _baseLayerData,\\n bytes calldata _execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0x9da43aa0b2c19659dd96c244ce260760d7c1c675aaec85feacd322d35b8e1844\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b5060405161052438038061052483398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b60805161049361009160003960008181603c015261011d01526104936000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806328911e8314610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a610085366004610263565b61008c565b005b604051635c46a7ef60e11b81526001600160a01b0388169063b88d4fde906100c09033908a908a908a908a9060040161032b565b600060405180830381600087803b1580156100da57600080fd5b505af11580156100ee573d6000803e3d6000fd5b505050506000610103883388888888886101a2565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd6390610154908a90859060040161038e565b6020604051808303816000875af1158015610173573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019791906103d0565b505050505050505050565b60606000858585856040516020016101bd94939291906103e9565b6040516020818303038152906040529050888888836040516020016101e59493929190610410565b604051602081830303815290604052915050979650505050505050565b6001600160a01b038116811461021757600080fd5b50565b60008083601f84011261022c57600080fd5b50813567ffffffffffffffff81111561024457600080fd5b60208301915083602082850101111561025c57600080fd5b9250929050565b600080600080600080600060a0888a03121561027e57600080fd5b873561028981610202565b9650602088013561029981610202565b955060408801359450606088013567ffffffffffffffff808211156102bd57600080fd5b6102c98b838c0161021a565b909650945060808a01359150808211156102e257600080fd5b506102ef8a828b0161021a565b989b979a50959850939692959293505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038681168252851660208201526040810184905260806060820181905260009061035f9083018486610302565b979650505050505050565b60005b8381101561038557818101518382015260200161036d565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526103bb81606085016020870161036a565b601f01601f1916919091016060019392505050565b6000602082840312156103e257600080fd5b5051919050565b6040815260006103fd604083018688610302565b828103602084015261035f818587610302565b60006bffffffffffffffffffffffff19808760601b168352808660601b16601484015250836028830152825161044d81604885016020870161036a565b919091016048019594505050505056fea2646970667358221220c2c237b79e46918de25850a3a3944f2f3cce2d65223f9c2c4e6fefb21e70609864736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806328911e8314610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a610085366004610263565b61008c565b005b604051635c46a7ef60e11b81526001600160a01b0388169063b88d4fde906100c09033908a908a908a908a9060040161032b565b600060405180830381600087803b1580156100da57600080fd5b505af11580156100ee573d6000803e3d6000fd5b505050506000610103883388888888886101a2565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd6390610154908a90859060040161038e565b6020604051808303816000875af1158015610173573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019791906103d0565b505050505050505050565b60606000858585856040516020016101bd94939291906103e9565b6040516020818303038152906040529050888888836040516020016101e59493929190610410565b604051602081830303815290604052915050979650505050505050565b6001600160a01b038116811461021757600080fd5b50565b60008083601f84011261022c57600080fd5b50813567ffffffffffffffff81111561024457600080fd5b60208301915083602082850101111561025c57600080fd5b9250929050565b600080600080600080600060a0888a03121561027e57600080fd5b873561028981610202565b9650602088013561029981610202565b955060408801359450606088013567ffffffffffffffff808211156102bd57600080fd5b6102c98b838c0161021a565b909650945060808a01359150808211156102e257600080fd5b506102ef8a828b0161021a565b989b979a50959850939692959293505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038681168252851660208201526040810184905260806060820181905260009061035f9083018486610302565b979650505050505050565b60005b8381101561038557818101518382015260200161036d565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526103bb81606085016020870161036a565b601f01601f1916919091016060019392505050565b6000602082840312156103e257600080fd5b5051919050565b6040815260006103fd604083018688610302565b828103602084015261035f818587610302565b60006bffffffffffffffffffffffff19808760601b168352808660601b16601484015250836028830152825161044d81604885016020870161036a565b919091016048019594505050505056fea2646970667358221220c2c237b79e46918de25850a3a3944f2f3cce2d65223f9c2c4e6fefb21e70609864736f6c63430008130033", - "devdoc": { - "kind": "dev", - "methods": { - "constructor": { - "params": { - "_inputBox": "The input box used by the portal" - } - }, - "depositERC721Token(address,address,uint256,bytes,bytes)": { - "params": { - "_baseLayerData": "Additional data to be interpreted by the base layer", - "_dapp": "The address of the DApp", - "_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 a DApp and add an input to the DApp'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 input relay." - } - }, - "notice": "This contract allows anyone to perform transfers of ERC-721 tokens to a DApp 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 deleted file mode 100644 index a5f88ee72..000000000 --- a/deployments/optimism_sepolia/EtherPortal.json +++ /dev/null @@ -1,127 +0,0 @@ -{ - "address": "0xFfdbe43d4c855BF7e0f105c400A50857f53AB044", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "EtherTransferFailed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "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": "0xb9d1ee6750d974a682c74395178a29d61a48f8c33f2c58493ae06882dba5f24b", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", - "contractAddress": null, - "transactionIndex": 1, - "gasUsed": "237926", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x0ae5631cc035165a74541c0b298b7ea4137fb5fd932e211e2fbc55913323310a", - "transactionHash": "0xb9d1ee6750d974a682c74395178a29d61a48f8c33f2c58493ae06882dba5f24b", - "logs": [], - "blockNumber": 5394436, - "cumulativeGasUsed": "284827", - "status": 1, - "byzantium": true - }, - "args": [ - "0x59b22D57D4f067708AB0c00552767405926dc768" - ], - "numDeployments": 1, - "solcInputHash": "54ee33aea592269e6046663615f287b6", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"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\":\"_dapp\",\"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\":\"All the value sent through this function is forwarded to the DApp. If the transfer fails, `EtherTransferFailed` error is raised.\",\"params\":{\"_dapp\":\"The address of the DApp\",\"_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\":\"Raised when the Ether transfer fails.\"}]},\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs the portal.\"},\"depositEther(address,bytes)\":{\"notice\":\"Transfer Ether to a DApp and add an input to the DApp's input box to signal such operation. All the value sent through this function is forwarded to the DApp.\"},\"getInputBox()\":{\"notice\":\"Get the input box used by this input relay.\"}},\"notice\":\"This contract allows anyone to perform transfers of Ether to a DApp 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 v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token 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 amount 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 `amount` tokens of token type `id` from `from` to `to`.\\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 `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 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` 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 amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../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 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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon 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 caller.\\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\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"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 and relays.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Ether being sent in Wei\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\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 ret The return value of `transferFrom`\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param amount The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input\\n function encodeERC20Deposit(\\n bool ret,\\n IERC20 token,\\n address sender,\\n uint256 amount,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n ret, // 1B\\n token, // 20B\\n sender, // 20B\\n amount, // 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\\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\\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\\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 /// @notice Encode a DApp address relay.\\n /// @param dapp The DApp address\\n /// @return The encoded input\\n function encodeDAppAddressRelay(\\n address dapp\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n dapp // 20B\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5dce266a7b70ba86adf6a728c7667255d3e2b20f1789a951150a1d05439b7019\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputRelay.sol\":{\"content\":\"// (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 \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay interface\\ninterface IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this input relay.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x8c9316c43cc2c7754fbd5abccfcdbc5ed09a2f1228d993240eac6c41ea531521\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/InputRelay.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputRelay} from \\\"./IInputRelay.sol\\\";\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\n\\n/// @title Input Relay\\n/// @notice This contract serves as a base for all the other input relays.\\ncontract InputRelay is IInputRelay {\\n /// @notice The input box used by the input relay.\\n IInputBox internal immutable inputBox;\\n\\n /// @notice Constructs the input relay.\\n /// @param _inputBox The input box used by the input relay\\n constructor(IInputBox _inputBox) {\\n inputBox = _inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return inputBox;\\n }\\n}\\n\",\"keccak256\":\"0xbb489f157a0bd7a9da29b0bf3c47c4b4051d90ccd252abc3f81c8e897329e590\",\"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 {InputRelay} from \\\"../inputs/InputRelay.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 a DApp while informing the off-chain machine.\\ncontract EtherPortal is InputRelay, IEtherPortal {\\n /// @notice Raised when the Ether transfer fails.\\n error EtherTransferFailed();\\n\\n /// @notice Constructs the portal.\\n /// @param _inputBox The input box used by the portal\\n constructor(IInputBox _inputBox) InputRelay(_inputBox) {}\\n\\n function depositEther(\\n address _dapp,\\n bytes calldata _execLayerData\\n ) external payable override {\\n // We used to call `transfer()` but it's not considered safe,\\n // as it assumes gas costs are immutable (they are not).\\n (bool success, ) = _dapp.call{value: msg.value}(\\\"\\\");\\n\\n if (!success) {\\n revert EtherTransferFailed();\\n }\\n\\n bytes memory input = InputEncoding.encodeEtherDeposit(\\n msg.sender,\\n msg.value,\\n _execLayerData\\n );\\n\\n inputBox.addInput(_dapp, input);\\n }\\n}\\n\",\"keccak256\":\"0x47950c335ae2d0dd03b680d6fcd9cb26aa1333ecf6772b1f3a71a80100b8b34c\",\"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 {IInputRelay} from \\\"../inputs/IInputRelay.sol\\\";\\n\\n/// @title Ether Portal interface\\ninterface IEtherPortal is IInputRelay {\\n // Permissionless functions\\n\\n /// @notice Transfer Ether to a DApp and add an input to\\n /// the DApp's input box to signal such operation.\\n ///\\n /// All the value sent through this function is forwarded to the DApp.\\n ///\\n /// @param _dapp The address of the DApp\\n /// @param _execLayerData Additional data to be interpreted by the execution layer\\n /// @dev All the value sent through this function is forwarded to the DApp.\\n /// If the transfer fails, `EtherTransferFailed` error is raised.\\n function depositEther(\\n address _dapp,\\n bytes calldata _execLayerData\\n ) external payable;\\n}\\n\",\"keccak256\":\"0xa8bdb1f91935db3d7ba158935164e61f042da26a9abe872edccbff28614d9143\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b506040516103de3803806103de83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b60805161034d61009160003960008181603c0152610128015261034d6000f3fe6080604052600436106100285760003560e01c8062aace9a1461002d578063938c054f14610077575b600080fd5b34801561003957600080fd5b507f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a6100853660046101dc565b61008c565b005b6000836001600160a01b03163460405160006040518083038185875af1925050503d80600081146100d9576040519150601f19603f3d011682016040523d82523d6000602084013e6100de565b606091505b505090508061010057604051630ce8f45160e31b815260040160405180910390fd5b600061010e333486866101aa565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061015f908890859060040161026d565b6020604051808303816000875af115801561017e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a291906102cb565b505050505050565b6060848484846040516020016101c394939291906102e4565b6040516020818303038152906040529050949350505050565b6000806000604084860312156101f157600080fd5b83356001600160a01b038116811461020857600080fd5b9250602084013567ffffffffffffffff8082111561022557600080fd5b818601915086601f83011261023957600080fd5b81358181111561024857600080fd5b87602082850101111561025a57600080fd5b6020830194508093505050509250925092565b60018060a01b038316815260006020604081840152835180604085015260005b818110156102a95785810183015185820160600152820161028d565b506000606082860101526060601f19601f830116850101925050509392505050565b6000602082840312156102dd57600080fd5b5051919050565b6bffffffffffffffffffffffff198560601b1681528360148201528183603483013760009101603401908152939250505056fea26469706673582212203555bb6cf9b2020729bb19c561673a225f367cd3219906075930d8b9f3fb219864736f6c63430008130033", - "deployedBytecode": "0x6080604052600436106100285760003560e01c8062aace9a1461002d578063938c054f14610077575b600080fd5b34801561003957600080fd5b507f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a6100853660046101dc565b61008c565b005b6000836001600160a01b03163460405160006040518083038185875af1925050503d80600081146100d9576040519150601f19603f3d011682016040523d82523d6000602084013e6100de565b606091505b505090508061010057604051630ce8f45160e31b815260040160405180910390fd5b600061010e333486866101aa565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061015f908890859060040161026d565b6020604051808303816000875af115801561017e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a291906102cb565b505050505050565b6060848484846040516020016101c394939291906102e4565b6040516020818303038152906040529050949350505050565b6000806000604084860312156101f157600080fd5b83356001600160a01b038116811461020857600080fd5b9250602084013567ffffffffffffffff8082111561022557600080fd5b818601915086601f83011261023957600080fd5b81358181111561024857600080fd5b87602082850101111561025a57600080fd5b6020830194508093505050509250925092565b60018060a01b038316815260006020604081840152835180604085015260005b818110156102a95785810183015185820160600152820161028d565b506000606082860101526060601f19601f830116850101925050509392505050565b6000602082840312156102dd57600080fd5b5051919050565b6bffffffffffffffffffffffff198560601b1681528360148201528183603483013760009101603401908152939250505056fea26469706673582212203555bb6cf9b2020729bb19c561673a225f367cd3219906075930d8b9f3fb219864736f6c63430008130033", - "devdoc": { - "kind": "dev", - "methods": { - "constructor": { - "params": { - "_inputBox": "The input box used by the portal" - } - }, - "depositEther(address,bytes)": { - "details": "All the value sent through this function is forwarded to the DApp. If the transfer fails, `EtherTransferFailed` error is raised.", - "params": { - "_dapp": "The address of the DApp", - "_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": "Raised when the Ether transfer fails." - } - ] - }, - "kind": "user", - "methods": { - "constructor": { - "notice": "Constructs the portal." - }, - "depositEther(address,bytes)": { - "notice": "Transfer Ether to a DApp and add an input to the DApp's input box to signal such operation. All the value sent through this function is forwarded to the DApp." - }, - "getInputBox()": { - "notice": "Get the input box used by this input relay." - } - }, - "notice": "This contract allows anyone to perform transfers of Ether to a DApp 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 deleted file mode 100644 index bd45cd0fb..000000000 --- a/deployments/optimism_sepolia/InputBox.json +++ /dev/null @@ -1,246 +0,0 @@ -{ - "address": "0x59b22D57D4f067708AB0c00552767405926dc768", - "abi": [ - { - "inputs": [], - "name": "InputSizeExceedsLimit", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "dapp", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "inputIndex", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "input", - "type": "bytes" - } - ], - "name": "InputAdded", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_input", - "type": "bytes" - } - ], - "name": "addInput", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "getInputHash", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - } - ], - "name": "getNumberOfInputs", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "transactionHash": "0x86a4bb98fa95f33ac2a969abe61c8137b517a4c2774ddc1e7e5faf4146f475f0", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", - "contractAddress": null, - "transactionIndex": 1, - "gasUsed": "260728", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xd1c19e23deb60abb0606a181c6cfc7522d0ab053d3abb97429e5ab83973cb5d0", - "transactionHash": "0x86a4bb98fa95f33ac2a969abe61c8137b517a4c2774ddc1e7e5faf4146f475f0", - "logs": [], - "blockNumber": 5393079, - "cumulativeGasUsed": "307617", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 1, - "solcInputHash": "8964a82607cc9a4fa86e2a225f50957d", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"InputSizeExceedsLimit\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"dapp\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"inputIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"input\",\"type\":\"bytes\"}],\"name\":\"InputAdded\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_dapp\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_input\",\"type\":\"bytes\"}],\"name\":\"addInput\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_dapp\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"getInputHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_dapp\",\"type\":\"address\"}],\"name\":\"getNumberOfInputs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"InputAdded(address,uint256,address,bytes)\":{\"details\":\"MUST be triggered on a successful call to `addInput`.\",\"params\":{\"dapp\":\"The address of the DApp\",\"input\":\"The contents of the input\",\"inputIndex\":\"The index of the input in the input box\",\"sender\":\"The address that sent the input\"}}},\"kind\":\"dev\",\"methods\":{\"addInput(address,bytes)\":{\"details\":\"MUST fire an `InputAdded` event accordingly. Input larger than machine limit will raise `InputSizeExceedsLimit` error.\",\"params\":{\"_dapp\":\"The address of the DApp\",\"_input\":\"The contents of the input\"},\"returns\":{\"_0\":\"The hash of the input plus some extra metadata\"}},\"getInputHash(address,uint256)\":{\"details\":\"`_index` MUST be in the interval `[0,n)` where `n` is the number of inputs in the DApp's input box. See the `getNumberOfInputs` function.\",\"params\":{\"_dapp\":\"The address of the DApp\",\"_index\":\"The index of the input in the DApp's input box\"},\"returns\":{\"_0\":\"The hash of the input at the provided index in the DApp's input box\"}},\"getNumberOfInputs(address)\":{\"params\":{\"_dapp\":\"The address of the DApp\"},\"returns\":{\"_0\":\"Number of inputs in the DApp's input box\"}}},\"stateVariables\":{\"inputBoxes\":{\"details\":\"See the `getNumberOfInputs`, `getInputHash` and `addInput` functions.\"}},\"title\":\"Input Box\",\"version\":1},\"userdoc\":{\"errors\":{\"InputSizeExceedsLimit()\":[{\"notice\":\"Raised when input is larger than the machine limit.\"}]},\"events\":{\"InputAdded(address,uint256,address,bytes)\":{\"notice\":\"Emitted when an input is added to a DApp's input box.\"}},\"kind\":\"user\",\"methods\":{\"addInput(address,bytes)\":{\"notice\":\"Add an input to a DApp's input box.\"},\"getInputHash(address,uint256)\":{\"notice\":\"Get the hash of an input in a DApp's input box.\"},\"getNumberOfInputs(address)\":{\"notice\":\"Get the number of inputs in a DApp's input box.\"}},\"notice\":\"Trustless and permissionless contract that receives arbitrary blobs (called \\\"inputs\\\") from anyone and adds a compound hash to an append-only list (called \\\"input box\\\"). Each DApp has its own input box. The hash that is stored on-chain is composed by the hash of the input blob, the block number and timestamp, the input sender address, and the input index. Data availability is guaranteed by the emission of `InputAdded` events on every successful call to `addInput`. This ensures that inputs can be retrieved by anyone at any time, without having to rely on centralized data providers. From the perspective of this contract, inputs are encoding-agnostic byte arrays. It is up to the DApp to interpret, validate and act upon inputs.\",\"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 Base-2 logarithm of number of bytes.\\n type Log2Size is uint64;\\n\\n /// @notice Machine word size (8 bytes).\\n Log2Size constant WORD_LOG2_SIZE = Log2Size.wrap(3);\\n\\n /// @notice Machine address space size (2^64 bytes).\\n Log2Size constant MACHINE_LOG2_SIZE = Log2Size.wrap(64);\\n\\n /// @notice Keccak-256 output size (32 bytes).\\n Log2Size constant KECCAK_LOG2_SIZE = Log2Size.wrap(5);\\n\\n /// @notice Maximum input size (~2 megabytes).\\n /// @dev The offset and size fields use up the extra 64 bytes.\\n uint256 constant INPUT_MAX_SIZE = (1 << 21) - 64;\\n\\n /// @notice Maximum voucher metadata memory range (2 megabytes).\\n Log2Size constant VOUCHER_METADATA_LOG2_SIZE = Log2Size.wrap(21);\\n\\n /// @notice Maximum notice metadata memory range (2 megabytes).\\n Log2Size constant NOTICE_METADATA_LOG2_SIZE = Log2Size.wrap(21);\\n\\n /// @notice Maximum epoch voucher memory range (128 megabytes).\\n Log2Size constant EPOCH_VOUCHER_LOG2_SIZE = Log2Size.wrap(37);\\n\\n /// @notice Maximum epoch notice memory range (128 megabytes).\\n Log2Size constant EPOCH_NOTICE_LOG2_SIZE = Log2Size.wrap(37);\\n\\n /// @notice Unwrap `s` into its underlying uint64 value.\\n /// @param s Base-2 logarithm of some number of bytes\\n function uint64OfSize(Log2Size s) internal pure returns (uint64) {\\n return Log2Size.unwrap(s);\\n }\\n\\n /// @notice Return the position of an intra memory range on a memory range\\n /// with contents with the same size.\\n /// @param index Index of intra memory range\\n /// @param log2Size Base-2 logarithm of intra memory range size\\n function getIntraMemoryRangePosition(\\n uint64 index,\\n Log2Size log2Size\\n ) internal pure returns (uint64) {\\n return index << Log2Size.unwrap(log2Size);\\n }\\n}\\n\",\"keccak256\":\"0x97cdce56cdb4f0b4164e6be3a72e50469a3124e4716e753a1792aa70eac614f5\",\"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/// @title Input Box interface\\ninterface IInputBox {\\n /// @notice Emitted when an input is added to a DApp's input box.\\n /// @param dapp The address of the DApp\\n /// @param inputIndex The index of the input in the input box\\n /// @param sender The address that sent the input\\n /// @param input The contents of the input\\n /// @dev MUST be triggered on a successful call to `addInput`.\\n event InputAdded(\\n address indexed dapp,\\n uint256 indexed inputIndex,\\n address sender,\\n bytes input\\n );\\n\\n /// @notice Add an input to a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _input The contents of the input\\n /// @return The hash of the input plus some extra metadata\\n /// @dev MUST fire an `InputAdded` event accordingly.\\n /// Input larger than machine limit will raise `InputSizeExceedsLimit` error.\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @return Number of inputs in the DApp's input box\\n function getNumberOfInputs(address _dapp) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in a DApp's input box.\\n /// @param _dapp The address of the DApp\\n /// @param _index The index of the input in the DApp's input box\\n /// @return The hash of the input at the provided index in the DApp's input box\\n /// @dev `_index` MUST be in the interval `[0,n)` where `n` is the number of\\n /// inputs in the DApp's input box. See the `getNumberOfInputs` function.\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x95e007391405e86eeb980be9a99e5cf15b34bb5b819292d206ef8a58f9c46c25\",\"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.8;\\n\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\nimport {LibInput} from \\\"../library/LibInput.sol\\\";\\n\\n/// @title Input Box\\n///\\n/// @notice Trustless and permissionless contract that receives arbitrary blobs\\n/// (called \\\"inputs\\\") from anyone and adds a compound hash to an append-only list\\n/// (called \\\"input box\\\"). Each DApp has its own input box.\\n///\\n/// The hash that is stored on-chain is composed by the hash of the input blob,\\n/// the block number and timestamp, the input sender address, and the input index.\\n///\\n/// Data availability is guaranteed by the emission of `InputAdded` events\\n/// on every successful call to `addInput`. This ensures that inputs can be\\n/// retrieved by anyone at any time, without having to rely on centralized data\\n/// providers.\\n///\\n/// From the perspective of this contract, inputs are encoding-agnostic byte\\n/// arrays. It is up to the DApp to interpret, validate and act upon inputs.\\ncontract InputBox is IInputBox {\\n /// @notice Mapping from DApp address to list of input hashes.\\n /// @dev See the `getNumberOfInputs`, `getInputHash` and `addInput` functions.\\n mapping(address => bytes32[]) internal inputBoxes;\\n\\n function addInput(\\n address _dapp,\\n bytes calldata _input\\n ) external override returns (bytes32) {\\n bytes32[] storage inputBox = inputBoxes[_dapp];\\n uint256 inputIndex = inputBox.length;\\n\\n bytes32 inputHash = LibInput.computeInputHash(\\n msg.sender,\\n block.number,\\n block.timestamp,\\n _input,\\n inputIndex\\n );\\n\\n // add input to the input box\\n inputBox.push(inputHash);\\n\\n // block.number and timestamp can be retrieved by the event metadata itself\\n emit InputAdded(_dapp, inputIndex, msg.sender, _input);\\n\\n return inputHash;\\n }\\n\\n function getNumberOfInputs(\\n address _dapp\\n ) external view override returns (uint256) {\\n return inputBoxes[_dapp].length;\\n }\\n\\n function getInputHash(\\n address _dapp,\\n uint256 _index\\n ) external view override returns (bytes32) {\\n return inputBoxes[_dapp][_index];\\n }\\n}\\n\",\"keccak256\":\"0x83d36baf0bda5a63ea5eae7e021b80eabb30f9ace14fcdb5936f0e27b779fccb\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/library/LibInput.sol\":{\"content\":\"// (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\\\";\\n\\n/// @title Input Library\\nlibrary LibInput {\\n using CanonicalMachine for CanonicalMachine.Log2Size;\\n\\n /// @notice Raised when input is larger than the machine limit.\\n error InputSizeExceedsLimit();\\n\\n /// @notice Summarize input data in a single hash.\\n /// @param sender `msg.sender`\\n /// @param blockNumber `block.number`\\n /// @param blockTimestamp `block.timestamp`\\n /// @param input The input blob\\n /// @param inputIndex The index of the input in the input box\\n /// @return The input hash\\n function computeInputHash(\\n address sender,\\n uint256 blockNumber,\\n uint256 blockTimestamp,\\n bytes calldata input,\\n uint256 inputIndex\\n ) internal pure returns (bytes32) {\\n if (input.length > CanonicalMachine.INPUT_MAX_SIZE) {\\n revert InputSizeExceedsLimit();\\n }\\n\\n bytes32 keccakMetadata = keccak256(\\n abi.encode(\\n sender,\\n blockNumber,\\n blockTimestamp,\\n 0, //TODO decide how to deal with epoch index\\n inputIndex // input index in the input box\\n )\\n );\\n\\n bytes32 keccakInput = keccak256(input);\\n\\n return keccak256(abi.encode(keccakMetadata, keccakInput));\\n }\\n}\\n\",\"keccak256\":\"0x27f2fe9efc2f6fc85687ea78e5c79a090c46ece27e7bb26e0c184a3fef62317a\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506103be806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80631789cd631461004657806361a93c871461006b578063677087c914610094575b600080fd5b610059610054366004610253565b6100a7565b60405190815260200160405180910390f35b6100596100793660046102d6565b6001600160a01b031660009081526020819052604090205490565b6100596100a23660046102f8565b61013b565b6001600160a01b03831660009081526020819052604081208054826100d0334342898987610178565b83546001810185556000858152602090200181905560405190915082906001600160a01b038916907f6aaa400068bf4ca337265e2a1e1e841f66b8597fd5b452fdc52a44bed28a0784906101299033908b908b90610322565b60405180910390a39695505050505050565b6001600160a01b038216600090815260208190526040812080548390811061016557610165610362565b9060005260206000200154905092915050565b6000621fffc083111561019e57604051634273a49560e11b815260040160405180910390fd5b604080516001600160a01b03891660208201529081018790526060810186905260006080820181905260a082018490529060c001604051602081830303815290604052805190602001209050600085856040516101fc929190610378565b604080519182900382206020808401959095528282015280518083038201815260609092019052805192019190912098975050505050505050565b80356001600160a01b038116811461024e57600080fd5b919050565b60008060006040848603121561026857600080fd5b61027184610237565b9250602084013567ffffffffffffffff8082111561028e57600080fd5b818601915086601f8301126102a257600080fd5b8135818111156102b157600080fd5b8760208285010111156102c357600080fd5b6020830194508093505050509250925092565b6000602082840312156102e857600080fd5b6102f182610237565b9392505050565b6000806040838503121561030b57600080fd5b61031483610237565b946020939093013593505050565b6001600160a01b03841681526040602082018190528101829052818360608301376000818301606090810191909152601f909201601f1916010192915050565b634e487b7160e01b600052603260045260246000fd5b818382376000910190815291905056fea264697066735822122043b0a58952371efb5f75573ec65e82305da7154e6338f4e9c00f5cc07f92c4af64736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80631789cd631461004657806361a93c871461006b578063677087c914610094575b600080fd5b610059610054366004610253565b6100a7565b60405190815260200160405180910390f35b6100596100793660046102d6565b6001600160a01b031660009081526020819052604090205490565b6100596100a23660046102f8565b61013b565b6001600160a01b03831660009081526020819052604081208054826100d0334342898987610178565b83546001810185556000858152602090200181905560405190915082906001600160a01b038916907f6aaa400068bf4ca337265e2a1e1e841f66b8597fd5b452fdc52a44bed28a0784906101299033908b908b90610322565b60405180910390a39695505050505050565b6001600160a01b038216600090815260208190526040812080548390811061016557610165610362565b9060005260206000200154905092915050565b6000621fffc083111561019e57604051634273a49560e11b815260040160405180910390fd5b604080516001600160a01b03891660208201529081018790526060810186905260006080820181905260a082018490529060c001604051602081830303815290604052805190602001209050600085856040516101fc929190610378565b604080519182900382206020808401959095528282015280518083038201815260609092019052805192019190912098975050505050505050565b80356001600160a01b038116811461024e57600080fd5b919050565b60008060006040848603121561026857600080fd5b61027184610237565b9250602084013567ffffffffffffffff8082111561028e57600080fd5b818601915086601f8301126102a257600080fd5b8135818111156102b157600080fd5b8760208285010111156102c357600080fd5b6020830194508093505050509250925092565b6000602082840312156102e857600080fd5b6102f182610237565b9392505050565b6000806040838503121561030b57600080fd5b61031483610237565b946020939093013593505050565b6001600160a01b03841681526040602082018190528101829052818360608301376000818301606090810191909152601f909201601f1916010192915050565b634e487b7160e01b600052603260045260246000fd5b818382376000910190815291905056fea264697066735822122043b0a58952371efb5f75573ec65e82305da7154e6338f4e9c00f5cc07f92c4af64736f6c63430008130033", - "devdoc": { - "events": { - "InputAdded(address,uint256,address,bytes)": { - "details": "MUST be triggered on a successful call to `addInput`.", - "params": { - "dapp": "The address of the DApp", - "input": "The contents of the input", - "inputIndex": "The index of the input in the input box", - "sender": "The address that sent the input" - } - } - }, - "kind": "dev", - "methods": { - "addInput(address,bytes)": { - "details": "MUST fire an `InputAdded` event accordingly. Input larger than machine limit will raise `InputSizeExceedsLimit` error.", - "params": { - "_dapp": "The address of the DApp", - "_input": "The contents of the input" - }, - "returns": { - "_0": "The hash of the input plus some extra metadata" - } - }, - "getInputHash(address,uint256)": { - "details": "`_index` MUST be in the interval `[0,n)` where `n` is the number of inputs in the DApp's input box. See the `getNumberOfInputs` function.", - "params": { - "_dapp": "The address of the DApp", - "_index": "The index of the input in the DApp's input box" - }, - "returns": { - "_0": "The hash of the input at the provided index in the DApp's input box" - } - }, - "getNumberOfInputs(address)": { - "params": { - "_dapp": "The address of the DApp" - }, - "returns": { - "_0": "Number of inputs in the DApp's input box" - } - } - }, - "stateVariables": { - "inputBoxes": { - "details": "See the `getNumberOfInputs`, `getInputHash` and `addInput` functions." - } - }, - "title": "Input Box", - "version": 1 - }, - "userdoc": { - "errors": { - "InputSizeExceedsLimit()": [ - { - "notice": "Raised when input is larger than the machine limit." - } - ] - }, - "events": { - "InputAdded(address,uint256,address,bytes)": { - "notice": "Emitted when an input is added to a DApp's input box." - } - }, - "kind": "user", - "methods": { - "addInput(address,bytes)": { - "notice": "Add an input to a DApp's input box." - }, - "getInputHash(address,uint256)": { - "notice": "Get the hash of an input in a DApp's input box." - }, - "getNumberOfInputs(address)": { - "notice": "Get the number of inputs in a DApp's input box." - } - }, - "notice": "Trustless and permissionless contract that receives arbitrary blobs (called \"inputs\") from anyone and adds a compound hash to an append-only list (called \"input box\"). Each DApp has its own input box. The hash that is stored on-chain is composed by the hash of the input blob, the block number and timestamp, the input sender address, and the input index. Data availability is guaranteed by the emission of `InputAdded` events on every successful call to `addInput`. This ensures that inputs can be retrieved by anyone at any time, without having to rely on centralized data providers. From the perspective of this contract, inputs are encoding-agnostic byte arrays. It is up to the DApp to interpret, validate and act upon inputs.", - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 4121, - "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/sepolia/.chainId b/deployments/sepolia/.chainId deleted file mode 100644 index bd8d1cd44..000000000 --- a/deployments/sepolia/.chainId +++ /dev/null @@ -1 +0,0 @@ -11155111 \ No newline at end of file diff --git a/deployments/sepolia/SafeERC20Transfer.json b/deployments/sepolia/SafeERC20Transfer.json deleted file mode 100644 index 32bf0756e..000000000 --- a/deployments/sepolia/SafeERC20Transfer.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "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": "0x98e445e0ec10dc1a246c81175a1e84397ace20c9568d746c6fb6580cb9002efa", - "receipt": { - "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", - "from": "0xB25D9D56f5877Ca869A0362c324aCC2F1465AF1B", - "contractAddress": null, - "transactionIndex": 65, - "gasUsed": "227912", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x881a60eacc13cf7383f14512def317c6f1f4b939a7fb87f71aee1ae761462a0f", - "transactionHash": "0x98e445e0ec10dc1a246c81175a1e84397ace20c9568d746c6fb6580cb9002efa", - "logs": [], - "blockNumber": 6099866, - "cumulativeGasUsed": "6715820", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 1, - "solcInputHash": "d5e580c56a1973c1da5089d8c687e7bd", - "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/export/abi/arbitrum.json b/export/abi/arbitrum.json deleted file mode 100644 index 11a16f9e9..000000000 --- a/export/abi/arbitrum.json +++ /dev/null @@ -1,920 +0,0 @@ -{ - "name": "arbitrum", - "chainId": "42161", - "contracts": { - "CartesiDAppFactory": { - "address": "0x7122cd1221C20892234186facfE8615e6743Ab02", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "contract IConsensus", - "name": "consensus", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "dappOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "templateHash", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "contract CartesiDApp", - "name": "application", - "type": "address" - } - ], - "name": "ApplicationCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "contract IConsensus", - "name": "_consensus", - "type": "address" - }, - { - "internalType": "address", - "name": "_dappOwner", - "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": "_dappOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_templateHash", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newApplication", - "outputs": [ - { - "internalType": "contract CartesiDApp", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IConsensus", - "name": "_consensus", - "type": "address" - }, - { - "internalType": "address", - "name": "_dappOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_templateHash", - "type": "bytes32" - } - ], - "name": "newApplication", - "outputs": [ - { - "internalType": "contract CartesiDApp", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ] - }, - "ERC1155BatchPortal": { - "address": "0xedB53860A6B52bbb7561Ad596416ee9965B055Aa", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC1155", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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" - } - ] - }, - "ERC1155SinglePortal": { - "address": "0x7CFB0193Ca87eB6e48056885E026552c3A941FC4", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC1155", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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" - } - ] - }, - "ERC20Portal": { - "address": "0x9C21AEb2093C32DDbC53eEF24B873BDCd1aDa1DB", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC20", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "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": "0x237F8DD094C0e47f4236f12b4Fa01d6Dae89fb87", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC721", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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" - } - ] - }, - "EtherPortal": { - "address": "0xFfdbe43d4c855BF7e0f105c400A50857f53AB044", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "EtherTransferFailed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "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" - } - ] - }, - "InputBox": { - "address": "0x59b22D57D4f067708AB0c00552767405926dc768", - "abi": [ - { - "inputs": [], - "name": "InputSizeExceedsLimit", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "dapp", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "inputIndex", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "input", - "type": "bytes" - } - ], - "name": "InputAdded", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_input", - "type": "bytes" - } - ], - "name": "addInput", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "getInputHash", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - } - ], - "name": "getNumberOfInputs", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - ] - }, - "Bitmask": { - "address": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", - "abi": [] - }, - "CartesiMathV2": { - "address": "0xB634F716BEd5Dd5A2b9a91C92474C499e50Cb27D", - "abi": [ - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "clz", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "ctz", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "getLog2Floor", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "getLog2TableTimes1M", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "isPowerOf2", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "log2ApproxTimes1M", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - } - ] - }, - "MerkleV2": { - "address": "0x33436035441927Df1a73FE3AAC5906854632e53d", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes32[]", - "name": "hashes", - "type": "bytes32[]" - } - ], - "name": "calculateRootFromPowerOfTwo", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "getEmptyTreeHashAtIndex", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "_data", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "_wordIndex", - "type": "uint256" - } - ], - "name": "getHashOfWordAtIndex", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "_data", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "_log2Size", - "type": "uint256" - } - ], - "name": "getMerkleRootFromBytes", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_position", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_logSizeOfReplacement", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_logSizeOfFullDrive", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "_replacement", - "type": "bytes32" - }, - { - "internalType": "bytes32[]", - "name": "siblings", - "type": "bytes32[]" - } - ], - "name": "getRootAfterReplacementInDrive", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - } - ] - }, - "UnrolledCordic": { - "address": "0x3F8FdcD1B0F421D817BF58C96b7C91B98100B450", - "abi": [ - { - "inputs": [ - { - "internalType": "uint256", - "name": "val", - "type": "uint256" - } - ], - "name": "log2Times1e18", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - } - ] - }, - "AuthorityFactory": { - "address": "0xf26a5b278C25D8D41A136d22Ad719EACEd9c3e63", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "authorityOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract Authority", - "name": "authority", - "type": "address" - } - ], - "name": "AuthorityCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateAuthorityAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newAuthority", - "outputs": [ - { - "internalType": "contract Authority", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - } - ], - "name": "newAuthority", - "outputs": [ - { - "internalType": "contract Authority", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ] - } - } -} diff --git a/export/abi/arbitrum_sepolia.json b/export/abi/arbitrum_sepolia.json deleted file mode 100644 index 7d0aebbab..000000000 --- a/export/abi/arbitrum_sepolia.json +++ /dev/null @@ -1,920 +0,0 @@ -{ - "name": "arbitrum_sepolia", - "chainId": "421614", - "contracts": { - "ERC20Portal": { - "address": "0x9C21AEb2093C32DDbC53eEF24B873BDCd1aDa1DB", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC20", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "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": "0x237F8DD094C0e47f4236f12b4Fa01d6Dae89fb87", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC721", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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" - } - ] - }, - "EtherPortal": { - "address": "0xFfdbe43d4c855BF7e0f105c400A50857f53AB044", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "EtherTransferFailed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "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" - } - ] - }, - "InputBox": { - "address": "0x59b22D57D4f067708AB0c00552767405926dc768", - "abi": [ - { - "inputs": [], - "name": "InputSizeExceedsLimit", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "dapp", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "inputIndex", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "input", - "type": "bytes" - } - ], - "name": "InputAdded", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_input", - "type": "bytes" - } - ], - "name": "addInput", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "getInputHash", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - } - ], - "name": "getNumberOfInputs", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - ] - }, - "Bitmask": { - "address": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", - "abi": [] - }, - "CartesiMathV2": { - "address": "0xB634F716BEd5Dd5A2b9a91C92474C499e50Cb27D", - "abi": [ - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "clz", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "ctz", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "getLog2Floor", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "getLog2TableTimes1M", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "isPowerOf2", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "log2ApproxTimes1M", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - } - ] - }, - "MerkleV2": { - "address": "0x33436035441927Df1a73FE3AAC5906854632e53d", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes32[]", - "name": "hashes", - "type": "bytes32[]" - } - ], - "name": "calculateRootFromPowerOfTwo", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "getEmptyTreeHashAtIndex", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "_data", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "_wordIndex", - "type": "uint256" - } - ], - "name": "getHashOfWordAtIndex", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "_data", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "_log2Size", - "type": "uint256" - } - ], - "name": "getMerkleRootFromBytes", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_position", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_logSizeOfReplacement", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_logSizeOfFullDrive", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "_replacement", - "type": "bytes32" - }, - { - "internalType": "bytes32[]", - "name": "siblings", - "type": "bytes32[]" - } - ], - "name": "getRootAfterReplacementInDrive", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - } - ] - }, - "UnrolledCordic": { - "address": "0x3F8FdcD1B0F421D817BF58C96b7C91B98100B450", - "abi": [ - { - "inputs": [ - { - "internalType": "uint256", - "name": "val", - "type": "uint256" - } - ], - "name": "log2Times1e18", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - } - ] - }, - "ERC1155SinglePortal": { - "address": "0x7CFB0193Ca87eB6e48056885E026552c3A941FC4", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC1155", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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": "0xedB53860A6B52bbb7561Ad596416ee9965B055Aa", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC1155", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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": "0xf26a5b278C25D8D41A136d22Ad719EACEd9c3e63", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "authorityOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract Authority", - "name": "authority", - "type": "address" - } - ], - "name": "AuthorityCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateAuthorityAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newAuthority", - "outputs": [ - { - "internalType": "contract Authority", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - } - ], - "name": "newAuthority", - "outputs": [ - { - "internalType": "contract Authority", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ] - }, - "CartesiDAppFactory": { - "address": "0x7122cd1221C20892234186facfE8615e6743Ab02", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "contract IConsensus", - "name": "consensus", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "dappOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "templateHash", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "contract CartesiDApp", - "name": "application", - "type": "address" - } - ], - "name": "ApplicationCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "contract IConsensus", - "name": "_consensus", - "type": "address" - }, - { - "internalType": "address", - "name": "_dappOwner", - "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": "_dappOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_templateHash", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newApplication", - "outputs": [ - { - "internalType": "contract CartesiDApp", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IConsensus", - "name": "_consensus", - "type": "address" - }, - { - "internalType": "address", - "name": "_dappOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_templateHash", - "type": "bytes32" - } - ], - "name": "newApplication", - "outputs": [ - { - "internalType": "contract CartesiDApp", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ] - } - } -} \ No newline at end of file diff --git a/export/abi/mainnet.json b/export/abi/mainnet.json deleted file mode 100644 index 73cfc28e4..000000000 --- a/export/abi/mainnet.json +++ /dev/null @@ -1,920 +0,0 @@ -{ - "name": "mainnet", - "chainId": "1", - "contracts": { - "CartesiDAppFactory": { - "address": "0x7122cd1221C20892234186facfE8615e6743Ab02", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "contract IConsensus", - "name": "consensus", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "dappOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "templateHash", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "contract CartesiDApp", - "name": "application", - "type": "address" - } - ], - "name": "ApplicationCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "contract IConsensus", - "name": "_consensus", - "type": "address" - }, - { - "internalType": "address", - "name": "_dappOwner", - "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": "_dappOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_templateHash", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newApplication", - "outputs": [ - { - "internalType": "contract CartesiDApp", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IConsensus", - "name": "_consensus", - "type": "address" - }, - { - "internalType": "address", - "name": "_dappOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_templateHash", - "type": "bytes32" - } - ], - "name": "newApplication", - "outputs": [ - { - "internalType": "contract CartesiDApp", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ] - }, - "ERC1155BatchPortal": { - "address": "0xedB53860A6B52bbb7561Ad596416ee9965B055Aa", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC1155", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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" - } - ] - }, - "ERC1155SinglePortal": { - "address": "0x7CFB0193Ca87eB6e48056885E026552c3A941FC4", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC1155", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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" - } - ] - }, - "ERC20Portal": { - "address": "0x9C21AEb2093C32DDbC53eEF24B873BDCd1aDa1DB", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC20", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "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": "0x237F8DD094C0e47f4236f12b4Fa01d6Dae89fb87", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC721", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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" - } - ] - }, - "EtherPortal": { - "address": "0xFfdbe43d4c855BF7e0f105c400A50857f53AB044", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "EtherTransferFailed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "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" - } - ] - }, - "InputBox": { - "address": "0x59b22D57D4f067708AB0c00552767405926dc768", - "abi": [ - { - "inputs": [], - "name": "InputSizeExceedsLimit", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "dapp", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "inputIndex", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "input", - "type": "bytes" - } - ], - "name": "InputAdded", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_input", - "type": "bytes" - } - ], - "name": "addInput", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "getInputHash", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - } - ], - "name": "getNumberOfInputs", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - ] - }, - "Bitmask": { - "address": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", - "abi": [] - }, - "CartesiMathV2": { - "address": "0xB634F716BEd5Dd5A2b9a91C92474C499e50Cb27D", - "abi": [ - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "clz", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "ctz", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "getLog2Floor", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "getLog2TableTimes1M", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "isPowerOf2", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "log2ApproxTimes1M", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - } - ] - }, - "MerkleV2": { - "address": "0x33436035441927Df1a73FE3AAC5906854632e53d", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes32[]", - "name": "hashes", - "type": "bytes32[]" - } - ], - "name": "calculateRootFromPowerOfTwo", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "getEmptyTreeHashAtIndex", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "_data", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "_wordIndex", - "type": "uint256" - } - ], - "name": "getHashOfWordAtIndex", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "_data", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "_log2Size", - "type": "uint256" - } - ], - "name": "getMerkleRootFromBytes", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_position", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_logSizeOfReplacement", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_logSizeOfFullDrive", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "_replacement", - "type": "bytes32" - }, - { - "internalType": "bytes32[]", - "name": "siblings", - "type": "bytes32[]" - } - ], - "name": "getRootAfterReplacementInDrive", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - } - ] - }, - "UnrolledCordic": { - "address": "0x3F8FdcD1B0F421D817BF58C96b7C91B98100B450", - "abi": [ - { - "inputs": [ - { - "internalType": "uint256", - "name": "val", - "type": "uint256" - } - ], - "name": "log2Times1e18", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - } - ] - }, - "AuthorityFactory": { - "address": "0xf26a5b278C25D8D41A136d22Ad719EACEd9c3e63", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "authorityOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract Authority", - "name": "authority", - "type": "address" - } - ], - "name": "AuthorityCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateAuthorityAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newAuthority", - "outputs": [ - { - "internalType": "contract Authority", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - } - ], - "name": "newAuthority", - "outputs": [ - { - "internalType": "contract Authority", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ] - } - } -} diff --git a/export/abi/optimism.json b/export/abi/optimism.json deleted file mode 100644 index 35a51f111..000000000 --- a/export/abi/optimism.json +++ /dev/null @@ -1,920 +0,0 @@ -{ - "name": "optimism", - "chainId": "10", - "contracts": { - "CartesiDAppFactory": { - "address": "0x7122cd1221C20892234186facfE8615e6743Ab02", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "contract IConsensus", - "name": "consensus", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "dappOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "templateHash", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "contract CartesiDApp", - "name": "application", - "type": "address" - } - ], - "name": "ApplicationCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "contract IConsensus", - "name": "_consensus", - "type": "address" - }, - { - "internalType": "address", - "name": "_dappOwner", - "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": "_dappOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_templateHash", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newApplication", - "outputs": [ - { - "internalType": "contract CartesiDApp", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IConsensus", - "name": "_consensus", - "type": "address" - }, - { - "internalType": "address", - "name": "_dappOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_templateHash", - "type": "bytes32" - } - ], - "name": "newApplication", - "outputs": [ - { - "internalType": "contract CartesiDApp", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ] - }, - "ERC1155BatchPortal": { - "address": "0xedB53860A6B52bbb7561Ad596416ee9965B055Aa", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC1155", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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" - } - ] - }, - "ERC1155SinglePortal": { - "address": "0x7CFB0193Ca87eB6e48056885E026552c3A941FC4", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC1155", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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" - } - ] - }, - "ERC20Portal": { - "address": "0x9C21AEb2093C32DDbC53eEF24B873BDCd1aDa1DB", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC20", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "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": "0x237F8DD094C0e47f4236f12b4Fa01d6Dae89fb87", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC721", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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" - } - ] - }, - "EtherPortal": { - "address": "0xFfdbe43d4c855BF7e0f105c400A50857f53AB044", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "EtherTransferFailed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "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" - } - ] - }, - "InputBox": { - "address": "0x59b22D57D4f067708AB0c00552767405926dc768", - "abi": [ - { - "inputs": [], - "name": "InputSizeExceedsLimit", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "dapp", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "inputIndex", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "input", - "type": "bytes" - } - ], - "name": "InputAdded", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_input", - "type": "bytes" - } - ], - "name": "addInput", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "getInputHash", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - } - ], - "name": "getNumberOfInputs", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - ] - }, - "Bitmask": { - "address": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", - "abi": [] - }, - "CartesiMathV2": { - "address": "0xB634F716BEd5Dd5A2b9a91C92474C499e50Cb27D", - "abi": [ - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "clz", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "ctz", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "getLog2Floor", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "getLog2TableTimes1M", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "isPowerOf2", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "log2ApproxTimes1M", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - } - ] - }, - "MerkleV2": { - "address": "0x33436035441927Df1a73FE3AAC5906854632e53d", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes32[]", - "name": "hashes", - "type": "bytes32[]" - } - ], - "name": "calculateRootFromPowerOfTwo", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "getEmptyTreeHashAtIndex", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "_data", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "_wordIndex", - "type": "uint256" - } - ], - "name": "getHashOfWordAtIndex", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "_data", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "_log2Size", - "type": "uint256" - } - ], - "name": "getMerkleRootFromBytes", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_position", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_logSizeOfReplacement", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_logSizeOfFullDrive", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "_replacement", - "type": "bytes32" - }, - { - "internalType": "bytes32[]", - "name": "siblings", - "type": "bytes32[]" - } - ], - "name": "getRootAfterReplacementInDrive", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - } - ] - }, - "UnrolledCordic": { - "address": "0x3F8FdcD1B0F421D817BF58C96b7C91B98100B450", - "abi": [ - { - "inputs": [ - { - "internalType": "uint256", - "name": "val", - "type": "uint256" - } - ], - "name": "log2Times1e18", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - } - ] - }, - "AuthorityFactory": { - "address": "0xf26a5b278C25D8D41A136d22Ad719EACEd9c3e63", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "authorityOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract Authority", - "name": "authority", - "type": "address" - } - ], - "name": "AuthorityCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateAuthorityAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newAuthority", - "outputs": [ - { - "internalType": "contract Authority", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - } - ], - "name": "newAuthority", - "outputs": [ - { - "internalType": "contract Authority", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ] - } - } -} diff --git a/export/abi/optimism_sepolia.json b/export/abi/optimism_sepolia.json deleted file mode 100644 index 278992a45..000000000 --- a/export/abi/optimism_sepolia.json +++ /dev/null @@ -1,920 +0,0 @@ -{ - "name": "optimism_sepolia", - "chainId": "11155420", - "contracts": { - "AuthorityFactory": { - "address": "0xf26a5b278C25D8D41A136d22Ad719EACEd9c3e63", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "authorityOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract Authority", - "name": "authority", - "type": "address" - } - ], - "name": "AuthorityCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "calculateAuthorityAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newAuthority", - "outputs": [ - { - "internalType": "contract Authority", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_authorityOwner", - "type": "address" - } - ], - "name": "newAuthority", - "outputs": [ - { - "internalType": "contract Authority", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ] - }, - "ERC1155BatchPortal": { - "address": "0xedB53860A6B52bbb7561Ad596416ee9965B055Aa", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC1155", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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" - } - ] - }, - "ERC1155SinglePortal": { - "address": "0x7CFB0193Ca87eB6e48056885E026552c3A941FC4", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC1155", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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" - } - ] - }, - "ERC20Portal": { - "address": "0x9C21AEb2093C32DDbC53eEF24B873BDCd1aDa1DB", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC20", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "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": "0x237F8DD094C0e47f4236f12b4Fa01d6Dae89fb87", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "contract IERC721", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_dapp", - "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" - } - ] - }, - "EtherPortal": { - "address": "0xFfdbe43d4c855BF7e0f105c400A50857f53AB044", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IInputBox", - "name": "_inputBox", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "EtherTransferFailed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "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" - } - ] - }, - "InputBox": { - "address": "0x59b22D57D4f067708AB0c00552767405926dc768", - "abi": [ - { - "inputs": [], - "name": "InputSizeExceedsLimit", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "dapp", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "inputIndex", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "input", - "type": "bytes" - } - ], - "name": "InputAdded", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_input", - "type": "bytes" - } - ], - "name": "addInput", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "getInputHash", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_dapp", - "type": "address" - } - ], - "name": "getNumberOfInputs", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - ] - }, - "Bitmask": { - "address": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", - "abi": [] - }, - "CartesiMathV2": { - "address": "0xB634F716BEd5Dd5A2b9a91C92474C499e50Cb27D", - "abi": [ - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "clz", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "ctz", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "getLog2Floor", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "getLog2TableTimes1M", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "isPowerOf2", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_num", - "type": "uint256" - } - ], - "name": "log2ApproxTimes1M", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - } - ] - }, - "MerkleV2": { - "address": "0x33436035441927Df1a73FE3AAC5906854632e53d", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes32[]", - "name": "hashes", - "type": "bytes32[]" - } - ], - "name": "calculateRootFromPowerOfTwo", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "getEmptyTreeHashAtIndex", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "_data", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "_wordIndex", - "type": "uint256" - } - ], - "name": "getHashOfWordAtIndex", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "_data", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "_log2Size", - "type": "uint256" - } - ], - "name": "getMerkleRootFromBytes", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_position", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_logSizeOfReplacement", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_logSizeOfFullDrive", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "_replacement", - "type": "bytes32" - }, - { - "internalType": "bytes32[]", - "name": "siblings", - "type": "bytes32[]" - } - ], - "name": "getRootAfterReplacementInDrive", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - } - ] - }, - "UnrolledCordic": { - "address": "0x3F8FdcD1B0F421D817BF58C96b7C91B98100B450", - "abi": [ - { - "inputs": [ - { - "internalType": "uint256", - "name": "val", - "type": "uint256" - } - ], - "name": "log2Times1e18", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - } - ] - }, - "CartesiDAppFactory": { - "address": "0x7122cd1221C20892234186facfE8615e6743Ab02", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "contract IConsensus", - "name": "consensus", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "dappOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "templateHash", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "contract CartesiDApp", - "name": "application", - "type": "address" - } - ], - "name": "ApplicationCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "contract IConsensus", - "name": "_consensus", - "type": "address" - }, - { - "internalType": "address", - "name": "_dappOwner", - "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": "_dappOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_templateHash", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "newApplication", - "outputs": [ - { - "internalType": "contract CartesiDApp", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IConsensus", - "name": "_consensus", - "type": "address" - }, - { - "internalType": "address", - "name": "_dappOwner", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_templateHash", - "type": "bytes32" - } - ], - "name": "newApplication", - "outputs": [ - { - "internalType": "contract CartesiDApp", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ] - } - } -} \ No newline at end of file