From 1e72e3204a4563521babeccbba9c8f70991eb076 Mon Sep 17 00:00:00 2001 From: Danilo Tuler Date: Wed, 30 Oct 2024 12:16:02 -0400 Subject: [PATCH] fix: restore sepolia transaction receipts --- deployments/sepolia/AuthorityFactory.json | 20 ++++++++++++++++-- deployments/sepolia/ERC1155BatchPortal.json | 20 ++++++++++++++++-- deployments/sepolia/ERC1155SinglePortal.json | 20 ++++++++++++++++-- deployments/sepolia/ERC20Portal.json | 20 ++++++++++++++++-- deployments/sepolia/ERC721Portal.json | 20 ++++++++++++++++-- deployments/sepolia/EtherPortal.json | 20 ++++++++++++++++-- deployments/sepolia/InputBox.json | 22 +++++++++++++++++--- deployments/sepolia/QuorumFactory.json | 20 ++++++++++++++++-- 8 files changed, 145 insertions(+), 17 deletions(-) diff --git a/deployments/sepolia/AuthorityFactory.json b/deployments/sepolia/AuthorityFactory.json index 9ee93092..2f4fa701 100644 --- a/deployments/sepolia/AuthorityFactory.json +++ b/deployments/sepolia/AuthorityFactory.json @@ -97,9 +97,25 @@ "type": "function" } ], + "transactionHash": "0x93b0ce5a1b8b6cb69ceded19ccf667a1230a51925a00809c3202d387b1c2865f", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0xeA4037a524309056545fbAd9A688f449E7e05ffB", + "contractAddress": null, + "transactionIndex": 41, + "gasUsed": "532228", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xb527b55072b0e52ca8325eee566afd4d3343e327285a22036713dd62ed75ebce", + "transactionHash": "0x93b0ce5a1b8b6cb69ceded19ccf667a1230a51925a00809c3202d387b1c2865f", + "logs": [], + "blockNumber": 6850941, + "cumulativeGasUsed": "4528239", + "status": 1, + "byzantium": true + }, "args": [], - "numDeployments": 1, - "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "numDeployments": 3, + "solcInputHash": "3277ebc53d2ec4c7847e5faa9f9b26b3", "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract IAuthority\",\"name\":\"authority\",\"type\":\"address\"}],\"name\":\"AuthorityCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"authorityOwner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"epochLength\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"}],\"name\":\"calculateAuthorityAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"authorityOwner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"epochLength\",\"type\":\"uint256\"}],\"name\":\"newAuthority\",\"outputs\":[{\"internalType\":\"contract IAuthority\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"authorityOwner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"epochLength\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"}],\"name\":\"newAuthority\",\"outputs\":[{\"internalType\":\"contract IAuthority\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"AuthorityCreated(address)\":{\"details\":\"MUST be triggered on a successful call to `newAuthority`.\",\"params\":{\"authority\":\"The authority\"}}},\"kind\":\"dev\",\"methods\":{\"calculateAuthorityAddress(address,uint256,bytes32)\":{\"details\":\"Beware that only the `newAuthority` function with the `salt` parameter is able to deterministically deploy an authority.\",\"params\":{\"authorityOwner\":\"The initial authority owner\",\"epochLength\":\"The epoch length\",\"salt\":\"The salt used to deterministically generate the authority address\"},\"returns\":{\"_0\":\"The deterministic authority address\"}},\"newAuthority(address,uint256)\":{\"details\":\"On success, MUST emit an `AuthorityCreated` event.Reverts if the authority owner address is zero.Reverts if the epoch length is zero.\",\"params\":{\"authorityOwner\":\"The initial authority owner\",\"epochLength\":\"The epoch length\"},\"returns\":{\"_0\":\"The authority\"}},\"newAuthority(address,uint256,bytes32)\":{\"details\":\"On success, MUST emit an `AuthorityCreated` event.Reverts if the authority owner address is zero.Reverts if the epoch length is zero.\",\"params\":{\"authorityOwner\":\"The initial authority owner\",\"epochLength\":\"The epoch length\",\"salt\":\"The salt used to deterministically generate the authority address\"},\"returns\":{\"_0\":\"The authority\"}}},\"title\":\"Authority Factory\",\"version\":1},\"userdoc\":{\"events\":{\"AuthorityCreated(address)\":{\"notice\":\"A new authority was deployed.\"}},\"kind\":\"user\",\"methods\":{\"calculateAuthorityAddress(address,uint256,bytes32)\":{\"notice\":\"Calculate the address of an authority to be deployed deterministically.\"},\"newAuthority(address,uint256)\":{\"notice\":\"Deploy a new authority.\"},\"newAuthority(address,uint256,bytes32)\":{\"notice\":\"Deploy a new authority deterministically.\"}},\"notice\":\"Allows anyone to reliably deploy a new `IAuthority` contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/consensus/authority/AuthorityFactory.sol\":\"AuthorityFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {Context} from \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * The initial owner is set to the address provided by the deployer. This can\\n * later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n /**\\n * @dev The caller account is not authorized to perform an operation.\\n */\\n error OwnableUnauthorizedAccount(address account);\\n\\n /**\\n * @dev The owner is not a valid owner account. (eg. `address(0)`)\\n */\\n error OwnableInvalidOwner(address owner);\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\\n */\\n constructor(address initialOwner) {\\n if (initialOwner == address(0)) {\\n revert OwnableInvalidOwner(address(0));\\n }\\n _transferOwnership(initialOwner);\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n if (owner() != _msgSender()) {\\n revert OwnableUnauthorizedAccount(_msgSender());\\n }\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n if (newOwner == address(0)) {\\n revert OwnableInvalidOwner(address(0));\\n }\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xff6d0bb2e285473e5311d9d3caacb525ae3538a80758c10649a4d61029b017bb\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Not enough balance for performing a CREATE2 deploy.\\n */\\n error Create2InsufficientBalance(uint256 balance, uint256 needed);\\n\\n /**\\n * @dev There's no code to deploy.\\n */\\n error Create2EmptyBytecode();\\n\\n /**\\n * @dev The deployment failed.\\n */\\n error Create2FailedDeployment();\\n\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\\n if (address(this).balance < amount) {\\n revert Create2InsufficientBalance(address(this).balance, amount);\\n }\\n if (bytecode.length == 0) {\\n revert Create2EmptyBytecode();\\n }\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n if (addr == address(0)) {\\n revert Create2FailedDeployment();\\n }\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2b9807d194b92f1068d868e9587d27037264a9a067c778486f86ae21c61cbd5e\",\"license\":\"MIT\"},\"contracts/access/IOwnable.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @notice The interface of OpenZeppelin's `Ownable` contract.\\ninterface IOwnable {\\n function owner() external view returns (address);\\n function renounceOwnership() external;\\n function transferOwnership(address newOwner) external;\\n}\\n\",\"keccak256\":\"0x826f366603fe6fd715bd912d40e9b4e851c110aea5895522523d800015532f6d\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/AbstractConsensus.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IConsensus} from \\\"./IConsensus.sol\\\";\\n\\n/// @notice Stores accepted claims for several applications.\\n/// @dev This contract was designed to be inherited by implementations of the `IConsensus` interface\\n/// that only need a simple mechanism of storage and retrieval of accepted claims.\\nabstract contract AbstractConsensus is IConsensus {\\n /// @notice The epoch length\\n uint256 private immutable _epochLength;\\n\\n /// @notice Indexes accepted claims by application contract address.\\n mapping(address => mapping(bytes32 => bool)) private _acceptedClaims;\\n\\n /// @param epochLength The epoch length\\n /// @dev Reverts if the epoch length is zero.\\n constructor(uint256 epochLength) {\\n require(epochLength > 0, \\\"epoch length must not be zero\\\");\\n _epochLength = epochLength;\\n }\\n\\n /// @inheritdoc IConsensus\\n function wasClaimAccepted(\\n address appContract,\\n bytes32 claim\\n ) public view override returns (bool) {\\n return _acceptedClaims[appContract][claim];\\n }\\n\\n /// @inheritdoc IConsensus\\n function getEpochLength() public view override returns (uint256) {\\n return _epochLength;\\n }\\n\\n /// @notice Accept a claim.\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The output Merkle root hash\\n /// @dev Emits a `ClaimAcceptance` event.\\n function _acceptClaim(\\n address appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n ) internal {\\n _acceptedClaims[appContract][claim] = true;\\n emit ClaimAcceptance(appContract, lastProcessedBlockNumber, claim);\\n }\\n}\\n\",\"keccak256\":\"0x8d94096a285a068e53dfa65f26d4aa8549c3edf0d80e1b3f4322a2df69e141b7\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/IConsensus.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @notice Each application has its own stream of inputs.\\n/// See the `IInputBox` interface for calldata-based on-chain data availability.\\n/// @notice When an input is fed to the application, it may yield several outputs.\\n/// @notice Since genesis, a Merkle tree of all outputs ever produced is maintained\\n/// both inside and outside the Cartesi Machine.\\n/// @notice The claim that validators may submit to the consensus contract\\n/// is the root of this Merkle tree after processing all base layer blocks until some height.\\n/// @notice A validator should be able to save transaction fees by not submitting a claim if it was...\\n/// - already submitted by the validator (see the `ClaimSubmission` event) or;\\n/// - already accepted by the consensus (see the `ClaimAcceptance` event).\\n/// @notice The acceptance criteria for claims may depend on the type of consensus, and is not specified by this interface.\\n/// For example, a claim may be accepted if it was...\\n/// - submitted by an authority or;\\n/// - submitted by the majority of a quorum or;\\n/// - submitted and not proven wrong after some period of time or;\\n/// - submitted and proven correct through an on-chain tournament.\\ninterface IConsensus {\\n /// @notice MUST trigger when a claim is submitted.\\n /// @param submitter The submitter address\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The root of the Merkle tree of outputs\\n event ClaimSubmission(\\n address indexed submitter,\\n address indexed appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n );\\n\\n /// @notice MUST trigger when a claim is accepted.\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The root of the Merkle tree of outputs\\n event ClaimAcceptance(\\n address indexed appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n );\\n\\n /// @notice Submit a claim to the consensus.\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The root of the Merkle tree of outputs\\n /// @dev MUST fire a `ClaimSubmission` event.\\n /// @dev MAY fire a `ClaimAcceptance` event, if the acceptance criteria is met.\\n function submitClaim(\\n address appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n ) external;\\n\\n /// @notice Check if an output Merkle root hash was ever accepted by the consensus\\n /// for a particular application.\\n /// @param appContract The application contract address\\n /// @param claim The root of the Merkle tree of outputs\\n function wasClaimAccepted(\\n address appContract,\\n bytes32 claim\\n ) external view returns (bool);\\n\\n /// @notice Get the epoch length, in number of base layer blocks.\\n /// @dev The epoch number of a block is defined as\\n /// the integer division of the block number by the epoch length.\\n function getEpochLength() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x33ef3c4e213b2a3489b37d5ef553dc1165c598c56beb0ed8290723a5c74d821c\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/Authority.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\nimport {IAuthority} from \\\"./IAuthority.sol\\\";\\nimport {IConsensus} from \\\"../IConsensus.sol\\\";\\nimport {AbstractConsensus} from \\\"../AbstractConsensus.sol\\\";\\nimport {IOwnable} from \\\"../../access/IOwnable.sol\\\";\\n\\n/// @notice A consensus contract controlled by a single address, the owner.\\n/// @dev This contract inherits from OpenZeppelin's `Ownable` contract.\\n/// For more information on `Ownable`, please consult OpenZeppelin's official documentation.\\ncontract Authority is IAuthority, AbstractConsensus, Ownable {\\n /// @param initialOwner The initial contract owner\\n /// @param epochLength The epoch length\\n /// @dev Reverts if the epoch length is zero.\\n constructor(\\n address initialOwner,\\n uint256 epochLength\\n ) AbstractConsensus(epochLength) Ownable(initialOwner) {}\\n\\n /// @notice Submit a claim.\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The output Merkle root hash\\n /// @dev Fires a `ClaimSubmission` event and a `ClaimAcceptance` event.\\n /// @dev Can only be called by the owner.\\n function submitClaim(\\n address appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n ) external override onlyOwner {\\n emit ClaimSubmission(\\n msg.sender,\\n appContract,\\n lastProcessedBlockNumber,\\n claim\\n );\\n _acceptClaim(appContract, lastProcessedBlockNumber, claim);\\n }\\n\\n function owner() public view override(IOwnable, Ownable) returns (address) {\\n return super.owner();\\n }\\n\\n function renounceOwnership() public override(IOwnable, Ownable) {\\n super.renounceOwnership();\\n }\\n\\n function transferOwnership(\\n address newOwner\\n ) public override(IOwnable, Ownable) {\\n super.transferOwnership(newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xaebdc8837598570f415461eb609ec5cfb51da3d2a631d133c83d95211b6fc85b\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/AuthorityFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Create2} from \\\"@openzeppelin/contracts/utils/Create2.sol\\\";\\n\\nimport {IAuthorityFactory} from \\\"./IAuthorityFactory.sol\\\";\\nimport {Authority} from \\\"./Authority.sol\\\";\\nimport {IAuthority} from \\\"./IAuthority.sol\\\";\\n\\n/// @title Authority Factory\\n/// @notice Allows anyone to reliably deploy a new `IAuthority` contract.\\ncontract AuthorityFactory is IAuthorityFactory {\\n function newAuthority(\\n address authorityOwner,\\n uint256 epochLength\\n ) external override returns (IAuthority) {\\n IAuthority authority = new Authority(authorityOwner, epochLength);\\n\\n emit AuthorityCreated(authority);\\n\\n return authority;\\n }\\n\\n function newAuthority(\\n address authorityOwner,\\n uint256 epochLength,\\n bytes32 salt\\n ) external override returns (IAuthority) {\\n IAuthority authority = new Authority{salt: salt}(\\n authorityOwner,\\n epochLength\\n );\\n\\n emit AuthorityCreated(authority);\\n\\n return authority;\\n }\\n\\n function calculateAuthorityAddress(\\n address authorityOwner,\\n uint256 epochLength,\\n bytes32 salt\\n ) external view override returns (address) {\\n return\\n Create2.computeAddress(\\n salt,\\n keccak256(\\n abi.encodePacked(\\n type(Authority).creationCode,\\n abi.encode(authorityOwner, epochLength)\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0xebd3e83da68c6b5173289d5f4f32e5bb4874cad4f3675b8fd90b4187c1656773\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/IAuthority.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IOwnable} from \\\"../../access/IOwnable.sol\\\";\\nimport {IConsensus} from \\\"../IConsensus.sol\\\";\\n\\n/// @notice A consensus contract controlled by a single address, the owner.\\ninterface IAuthority is IConsensus, IOwnable {}\\n\",\"keccak256\":\"0x6b63b7eb9c7deac1184052e58a2fba6e45bc630f1a38225d35cafbd0d5b98b04\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/authority/IAuthorityFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IAuthority} from \\\"./IAuthority.sol\\\";\\n\\n/// @title Authority Factory interface\\ninterface IAuthorityFactory {\\n // Events\\n\\n /// @notice A new authority was deployed.\\n /// @param authority The authority\\n /// @dev MUST be triggered on a successful call to `newAuthority`.\\n event AuthorityCreated(IAuthority authority);\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new authority.\\n /// @param authorityOwner The initial authority owner\\n /// @param epochLength The epoch length\\n /// @return The authority\\n /// @dev On success, MUST emit an `AuthorityCreated` event.\\n /// @dev Reverts if the authority owner address is zero.\\n /// @dev Reverts if the epoch length is zero.\\n function newAuthority(\\n address authorityOwner,\\n uint256 epochLength\\n ) external returns (IAuthority);\\n\\n /// @notice Deploy a new authority deterministically.\\n /// @param authorityOwner The initial authority owner\\n /// @param epochLength The epoch length\\n /// @param salt The salt used to deterministically generate the authority address\\n /// @return The authority\\n /// @dev On success, MUST emit an `AuthorityCreated` event.\\n /// @dev Reverts if the authority owner address is zero.\\n /// @dev Reverts if the epoch length is zero.\\n function newAuthority(\\n address authorityOwner,\\n uint256 epochLength,\\n bytes32 salt\\n ) external returns (IAuthority);\\n\\n /// @notice Calculate the address of an authority to be deployed deterministically.\\n /// @param authorityOwner The initial authority owner\\n /// @param epochLength The epoch length\\n /// @param salt The salt used to deterministically generate the authority address\\n /// @return The deterministic authority address\\n /// @dev Beware that only the `newAuthority` function with the `salt` parameter\\n /// is able to deterministically deploy an authority.\\n function calculateAuthorityAddress(\\n address authorityOwner,\\n uint256 epochLength,\\n bytes32 salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x05bde19d7cbd2bed92a9d81baa60b7e24b00b99f3656b67515b0903e5a920d46\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b506108a8806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80631442f7bb1461004657806393d7217c14610075578063ec99266814610088575b600080fd5b61005961005436600461029d565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b6100596100833660046102d0565b61011e565b61005961009636600461029d565b6101a7565b600061011682604051806020016100b190610274565b601f1982820381018352601f9091011660408181526001600160a01b0389166020830152810187905260600160408051601f19818403018152908290526100fb929160200161032a565b60405160208183030381529060405280519060200120610236565b949350505050565b600080838360405161012f90610274565b6001600160a01b0390921682526020820152604001604051809103906000f080158015610160573d6000803e3d6000fd5b506040516001600160a01b03821681529091507fdca1fad70bee4ba7a4e17a1c6e99e657d2251af7a279124758bc01588abe2d2f9060200160405180910390a19392505050565b6000808285856040516101b990610274565b6001600160a01b03909216825260208201526040018190604051809103906000f59050801580156101ee573d6000803e3d6000fd5b506040516001600160a01b03821681529091507fdca1fad70bee4ba7a4e17a1c6e99e657d2251af7a279124758bc01588abe2d2f9060200160405180910390a1949350505050565b600061024383833061024a565b9392505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b6105338061034083390190565b80356001600160a01b038116811461029857600080fd5b919050565b6000806000606084860312156102b257600080fd5b6102bb84610281565b95602085013595506040909401359392505050565b600080604083850312156102e357600080fd5b6102ec83610281565b946020939093013593505050565b6000815160005b8181101561031b5760208185018101518683015201610301565b50600093019283525090919050565b600061011661033983866102fa565b846102fa56fe60a060405234801561001057600080fd5b5060405161053338038061053383398101604081905261002f91610116565b8181600081116100865760405162461bcd60e51b815260206004820152601d60248201527f65706f6368206c656e677468206d757374206e6f74206265207a65726f00000060448201526064015b60405180910390fd5b6080526001600160a01b0381166100b357604051631e4fbdf760e01b81526000600482015260240161007d565b6100bc816100c4565b505050610150565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000806040838503121561012957600080fd5b82516001600160a01b038116811461014057600080fd5b6020939093015192949293505050565b6080516103c961016a600039600060f501526103c96000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c80636470af0014610067578063715018a61461007c5780638da5cb5b146100845780639618f35b146100a9578063cfe8a73b146100f0578063f2fde38b1461011e575b600080fd5b61007a610075366004610314565b610131565b005b61007a61018f565b61008c610199565b6040516001600160a01b0390911681526020015b60405180910390f35b6100e06100b7366004610347565b6001600160a01b0391909116600090815260208181526040808320938352929052205460ff1690565b60405190151581526020016100a0565b6040517f000000000000000000000000000000000000000000000000000000000000000081526020016100a0565b61007a61012c366004610371565b6101b2565b6101396101be565b60408051838152602081018390526001600160a01b0385169133917ff5a28e07a1b89d1ca3f9a2a7ef16bd650503a4791baf2e70dc401c21ee505f0a910160405180910390a361018a8383836101f5565b505050565b61019761025d565b565b60006101ad6001546001600160a01b031690565b905090565b6101bb8161026f565b50565b336101c7610199565b6001600160a01b0316146101975760405163118cdaa760e01b81523360048201526024015b60405180910390fd5b6001600160a01b038316600081815260208181526040808320858452825291829020805460ff1916600117905581518581529081018490527fd3e4892959c6ddb27e02bcaaebc0c1898d0f677b7360bf80339f10a8717957d3910160405180910390a2505050565b6102656101be565b61019760006102a6565b6102776101be565b6001600160a01b0381166102a157604051631e4fbdf760e01b8152600060048201526024016101ec565b6101bb815b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80356001600160a01b038116811461030f57600080fd5b919050565b60008060006060848603121561032957600080fd5b610332846102f8565b95602085013595506040909401359392505050565b6000806040838503121561035a57600080fd5b610363836102f8565b946020939093013593505050565b60006020828403121561038357600080fd5b61038c826102f8565b939250505056fea2646970667358221220fdfd7afacb990763bde79c74a424d800d5b6d84b9946a046eab3844941271e9864736f6c63430008170033a2646970667358221220cea85fc9e89ea5b4ed137a747c8c035c923896b73e090001968db6647ef1226864736f6c63430008170033", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80631442f7bb1461004657806393d7217c14610075578063ec99266814610088575b600080fd5b61005961005436600461029d565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b6100596100833660046102d0565b61011e565b61005961009636600461029d565b6101a7565b600061011682604051806020016100b190610274565b601f1982820381018352601f9091011660408181526001600160a01b0389166020830152810187905260600160408051601f19818403018152908290526100fb929160200161032a565b60405160208183030381529060405280519060200120610236565b949350505050565b600080838360405161012f90610274565b6001600160a01b0390921682526020820152604001604051809103906000f080158015610160573d6000803e3d6000fd5b506040516001600160a01b03821681529091507fdca1fad70bee4ba7a4e17a1c6e99e657d2251af7a279124758bc01588abe2d2f9060200160405180910390a19392505050565b6000808285856040516101b990610274565b6001600160a01b03909216825260208201526040018190604051809103906000f59050801580156101ee573d6000803e3d6000fd5b506040516001600160a01b03821681529091507fdca1fad70bee4ba7a4e17a1c6e99e657d2251af7a279124758bc01588abe2d2f9060200160405180910390a1949350505050565b600061024383833061024a565b9392505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b6105338061034083390190565b80356001600160a01b038116811461029857600080fd5b919050565b6000806000606084860312156102b257600080fd5b6102bb84610281565b95602085013595506040909401359392505050565b600080604083850312156102e357600080fd5b6102ec83610281565b946020939093013593505050565b6000815160005b8181101561031b5760208185018101518683015201610301565b50600093019283525090919050565b600061011661033983866102fa565b846102fa56fe60a060405234801561001057600080fd5b5060405161053338038061053383398101604081905261002f91610116565b8181600081116100865760405162461bcd60e51b815260206004820152601d60248201527f65706f6368206c656e677468206d757374206e6f74206265207a65726f00000060448201526064015b60405180910390fd5b6080526001600160a01b0381166100b357604051631e4fbdf760e01b81526000600482015260240161007d565b6100bc816100c4565b505050610150565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000806040838503121561012957600080fd5b82516001600160a01b038116811461014057600080fd5b6020939093015192949293505050565b6080516103c961016a600039600060f501526103c96000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c80636470af0014610067578063715018a61461007c5780638da5cb5b146100845780639618f35b146100a9578063cfe8a73b146100f0578063f2fde38b1461011e575b600080fd5b61007a610075366004610314565b610131565b005b61007a61018f565b61008c610199565b6040516001600160a01b0390911681526020015b60405180910390f35b6100e06100b7366004610347565b6001600160a01b0391909116600090815260208181526040808320938352929052205460ff1690565b60405190151581526020016100a0565b6040517f000000000000000000000000000000000000000000000000000000000000000081526020016100a0565b61007a61012c366004610371565b6101b2565b6101396101be565b60408051838152602081018390526001600160a01b0385169133917ff5a28e07a1b89d1ca3f9a2a7ef16bd650503a4791baf2e70dc401c21ee505f0a910160405180910390a361018a8383836101f5565b505050565b61019761025d565b565b60006101ad6001546001600160a01b031690565b905090565b6101bb8161026f565b50565b336101c7610199565b6001600160a01b0316146101975760405163118cdaa760e01b81523360048201526024015b60405180910390fd5b6001600160a01b038316600081815260208181526040808320858452825291829020805460ff1916600117905581518581529081018490527fd3e4892959c6ddb27e02bcaaebc0c1898d0f677b7360bf80339f10a8717957d3910160405180910390a2505050565b6102656101be565b61019760006102a6565b6102776101be565b6001600160a01b0381166102a157604051631e4fbdf760e01b8152600060048201526024016101ec565b6101bb815b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80356001600160a01b038116811461030f57600080fd5b919050565b60008060006060848603121561032957600080fd5b610332846102f8565b95602085013595506040909401359392505050565b6000806040838503121561035a57600080fd5b610363836102f8565b946020939093013593505050565b60006020828403121561038357600080fd5b61038c826102f8565b939250505056fea2646970667358221220fdfd7afacb990763bde79c74a424d800d5b6d84b9946a046eab3844941271e9864736f6c63430008170033a2646970667358221220cea85fc9e89ea5b4ed137a747c8c035c923896b73e090001968db6647ef1226864736f6c63430008170033", diff --git a/deployments/sepolia/ERC1155BatchPortal.json b/deployments/sepolia/ERC1155BatchPortal.json index 4c37d538..d60b5e7f 100644 --- a/deployments/sepolia/ERC1155BatchPortal.json +++ b/deployments/sepolia/ERC1155BatchPortal.json @@ -64,11 +64,27 @@ "type": "function" } ], + "transactionHash": "0x74d043e4185d038611578058fb1f9a92f64e9092216e1d21d71fd52f4ffecaa4", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0xeA4037a524309056545fbAd9A688f449E7e05ffB", + "contractAddress": null, + "transactionIndex": 37, + "gasUsed": "370950", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x3ded79b9fdca61e5fc69c6abf1e64700c7a5880cf27f134875529eb3ae2b68d0", + "transactionHash": "0x74d043e4185d038611578058fb1f9a92f64e9092216e1d21d71fd52f4ffecaa4", + "logs": [], + "blockNumber": 6850939, + "cumulativeGasUsed": "10315652", + "status": 1, + "byzantium": true + }, "args": [ "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6" ], - "numDeployments": 1, - "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "numDeployments": 5, + "solcInputHash": "8db616d9d86bc002576bd1bb74fd4f72", "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"inputBox\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"contract IERC1155\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"baseLayerData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"execLayerData\",\"type\":\"bytes\"}],\"name\":\"depositBatchERC1155Token\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getInputBox\",\"outputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"inputBox\":\"The input box used by the portal\"}},\"depositBatchERC1155Token(address,address,uint256[],uint256[],bytes,bytes)\":{\"details\":\"Please make sure the arrays `tokenIds` and `values` have the same length.\",\"params\":{\"appContract\":\"The application contract address\",\"baseLayerData\":\"Additional data to be interpreted by the base layer\",\"execLayerData\":\"Additional data to be interpreted by the execution layer\",\"token\":\"The ERC-1155 token contract\",\"tokenIds\":\"The identifiers of the tokens being transferred\",\"values\":\"Transfer amounts per token type\"}},\"getInputBox()\":{\"returns\":{\"_0\":\"The input box\"}}},\"title\":\"ERC-1155 Batch Transfer Portal\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs the portal.\"},\"depositBatchERC1155Token(address,address,uint256[],uint256[],bytes,bytes)\":{\"notice\":\"Transfer a batch of ERC-1155 tokens of multiple types to an application contract and add an input to the application's input box to signal such operation. The caller must enable approval for the portal to manage all of their tokens beforehand, by calling the `setApprovalForAll` function in the token contract.\"},\"getInputBox()\":{\"notice\":\"Get the input box used by this portal.\"}},\"notice\":\"This contract allows anyone to perform batch transfers of ERC-1155 tokens to an application contract while informing the off-chain machine.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/portals/ERC1155BatchPortal.sol\":\"ERC1155BatchPortal\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the value of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155Received} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `value` amount.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.\\n *\\n * Requirements:\\n *\\n * - `ids` and `values` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x6caffc9cfdc623eca9f87a686071708af5d5c17454d65022843fdddbc53c0cce\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the value of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the value of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\\n * caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\\n * allowance mechanism. `value` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 value) external returns (bool);\\n}\\n\",\"keccak256\":\"0xc6a8ff0ea489379b61faa647490411b80102578440ab9d84e9a957cc12164e70\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or\\n * {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the address zero.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5ef46daa3b58ef2702279d514780316efaa952915ee1aa3396f041ee2982b0b4\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x4296879f55019b23e135000eb36896057e7101fb7fb859c5ef690cf14643757b\",\"license\":\"MIT\"},\"contracts/common/InputEncoding.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title Input Encoding Library\\n\\n/// @notice Defines the encoding of inputs added by core trustless and\\n/// permissionless contracts, such as portals.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Wei being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeEtherDeposit(\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-20 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param value The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeERC20Deposit(\\n IERC20 token,\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-721 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param tokenId The token identifier\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeERC721Deposit(\\n IERC721 token,\\n address sender,\\n uint256 tokenId,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 single token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenId The identifier of the token being transferred\\n /// @param value Transfer amount\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeSingleERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256 tokenId,\\n uint256 value,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n value, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 batch token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenIds The identifiers of the tokens being transferred\\n /// @param values Transfer amounts per token type\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeBatchERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256[] calldata tokenIds,\\n uint256[] calldata values,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(\\n tokenIds,\\n values,\\n baseLayerData,\\n execLayerData\\n );\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n data // arbitrary size\\n );\\n }\\n}\\n\",\"keccak256\":\"0x1a7e17a9739f27dd761234c388bc6ba30b4aacdf31fc750a29e5c11f0b08bcae\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputBox.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @notice Provides data availability of inputs for applications.\\n/// @notice Each application has its own append-only list of inputs.\\n/// @notice Off-chain, inputs can be retrieved via events.\\n/// @notice On-chain, only the input hashes are stored.\\n/// @notice See `LibInput` for more details on how such hashes are computed.\\ninterface IInputBox {\\n /// @notice MUST trigger when an input is added.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @param input The input blob\\n event InputAdded(\\n address indexed appContract,\\n uint256 indexed index,\\n bytes input\\n );\\n\\n /// @notice Input is too large.\\n /// @param appContract The application contract address\\n /// @param inputLength The input length\\n /// @param maxInputLength The maximum input length\\n error InputTooLarge(\\n address appContract,\\n uint256 inputLength,\\n uint256 maxInputLength\\n );\\n\\n /// @notice Send an input to an application.\\n /// @param appContract The application contract address\\n /// @param payload The input payload\\n /// @return The hash of the input blob\\n /// @dev MUST fire an `InputAdded` event.\\n function addInput(\\n address appContract,\\n bytes calldata payload\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs sent to an application.\\n /// @param appContract The application contract address\\n function getNumberOfInputs(\\n address appContract\\n ) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in an application's input box.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @dev The provided index must be valid.\\n function getInputHash(\\n address appContract,\\n uint256 index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xae7730cd7ab2b31a86d7c4933215853ea6c0b1b4dc60d4ec24e5cfc2ec005fe3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/ERC1155BatchPortal.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\nimport {IERC1155BatchPortal} from \\\"./IERC1155BatchPortal.sol\\\";\\nimport {Portal} from \\\"./Portal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {InputEncoding} from \\\"../common/InputEncoding.sol\\\";\\n\\n/// @title ERC-1155 Batch Transfer Portal\\n///\\n/// @notice This contract allows anyone to perform batch transfers of\\n/// ERC-1155 tokens to an application contract while informing the off-chain machine.\\ncontract ERC1155BatchPortal is IERC1155BatchPortal, Portal {\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) Portal(inputBox) {}\\n\\n function depositBatchERC1155Token(\\n IERC1155 token,\\n address appContract,\\n uint256[] calldata tokenIds,\\n uint256[] calldata values,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) external override {\\n token.safeBatchTransferFrom(\\n msg.sender,\\n appContract,\\n tokenIds,\\n values,\\n baseLayerData\\n );\\n\\n bytes memory payload = InputEncoding.encodeBatchERC1155Deposit(\\n token,\\n msg.sender,\\n tokenIds,\\n values,\\n baseLayerData,\\n execLayerData\\n );\\n\\n _inputBox.addInput(appContract, payload);\\n }\\n}\\n\",\"keccak256\":\"0xb147f8d6b0a145ddd1c23fdbb58213f2dabc94a6a6adab9ec7646b58346534dd\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IERC1155BatchPortal.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IPortal} from \\\"./IPortal.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title ERC-1155 Batch Transfer Portal interface\\ninterface IERC1155BatchPortal is IPortal {\\n // Permissionless functions\\n\\n /// @notice Transfer a batch of ERC-1155 tokens of multiple types to an application contract\\n /// and add an input to the application's input box to signal such operation.\\n ///\\n /// The caller must enable approval for the portal to manage all of their tokens\\n /// beforehand, by calling the `setApprovalForAll` function in the token contract.\\n ///\\n /// @param token The ERC-1155 token contract\\n /// @param appContract The application contract address\\n /// @param tokenIds The identifiers of the tokens being transferred\\n /// @param values Transfer amounts per token type\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n ///\\n /// @dev Please make sure the arrays `tokenIds` and `values` have the same length.\\n function depositBatchERC1155Token(\\n IERC1155 token,\\n address appContract,\\n uint256[] calldata tokenIds,\\n uint256[] calldata values,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0xb8b26505036fc698af4e6ab71b6c20267c67e22d0252b99569fa93ed9c9baf23\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IPortal.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\n\\n/// @title Portal interface\\ninterface IPortal {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this portal.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x390bc7ed84639e38e40bef8085486119d6c42057f91f3ab8286a9246198682e2\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/Portal.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IPortal} from \\\"./IPortal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\n\\n/// @title Portal\\n/// @notice This contract serves as a base for all the other portals.\\ncontract Portal is IPortal {\\n /// @notice The input box used by the portal.\\n IInputBox internal immutable _inputBox;\\n\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) {\\n _inputBox = inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return _inputBox;\\n }\\n}\\n\",\"keccak256\":\"0x0597a118880f0fe29f38931452342e8294dafc3699100cbf3454b6c5faa5f48a\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", "bytecode": "0x60a060405234801561001057600080fd5b5060405161064538038061064583398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516105b461009160003960008181603c015261012601526105b46000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806324d15c6714610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a6100853660046102c1565b61008c565b005b604051631759616b60e11b81526001600160a01b038b1690632eb2c2d6906100c69033908d908d908d908d908d908d908d90600401610404565b600060405180830381600087803b1580156100e057600080fd5b505af11580156100f4573d6000803e3d6000fd5b50505050600061010c8b338b8b8b8b8b8b8b8b6101ae565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061015d908d90859060040161048c565b6020604051808303816000875af115801561017c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a091906104ce565b505050505050505050505050565b6060600089898989898989896040516020016101d19897969594939291906104e7565b60405160208183030381529060405290508b8b826040516020016101f793929190610538565b6040516020818303038152906040529150509a9950505050505050505050565b80356001600160a01b038116811461022e57600080fd5b919050565b60008083601f84011261024557600080fd5b50813567ffffffffffffffff81111561025d57600080fd5b6020830191508360208260051b850101111561027857600080fd5b9250929050565b60008083601f84011261029157600080fd5b50813567ffffffffffffffff8111156102a957600080fd5b60208301915083602082850101111561027857600080fd5b60008060008060008060008060008060c08b8d0312156102e057600080fd5b6102e98b610217565b99506102f760208c01610217565b985060408b013567ffffffffffffffff8082111561031457600080fd5b6103208e838f01610233565b909a50985060608d013591508082111561033957600080fd5b6103458e838f01610233565b909850965060808d013591508082111561035e57600080fd5b61036a8e838f0161027f565b909650945060a08d013591508082111561038357600080fd5b506103908d828e0161027f565b915080935050809150509295989b9194979a5092959850565b81835260006001600160fb1b038311156103c257600080fd5b8260051b80836020870137939093016020019392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0389811682528816602082015260a060408201819052600090610431908301888a6103a9565b82810360608401526104448187896103a9565b905082810360808401526104598185876103db565b9b9a5050505050505050505050565b60005b8381101561048357818101518382015260200161046b565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526104b9816060850160208701610468565b601f01601f1916919091016060019392505050565b6000602082840312156104e057600080fd5b5051919050565b6080815260006104fb608083018a8c6103a9565b828103602084015261050e81898b6103a9565b905082810360408401526105238187896103db565b905082810360608401526104598185876103db565b60006bffffffffffffffffffffffff19808660601b168352808560601b16601484015250825161056f816028850160208701610468565b9190910160280194935050505056fea264697066735822122035db86f04505cf3f941203bf956d2dde8c705c85e4bb9bdbc3fdac6c5b1e565564736f6c63430008170033", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806324d15c6714610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a6100853660046102c1565b61008c565b005b604051631759616b60e11b81526001600160a01b038b1690632eb2c2d6906100c69033908d908d908d908d908d908d908d90600401610404565b600060405180830381600087803b1580156100e057600080fd5b505af11580156100f4573d6000803e3d6000fd5b50505050600061010c8b338b8b8b8b8b8b8b8b6101ae565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061015d908d90859060040161048c565b6020604051808303816000875af115801561017c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a091906104ce565b505050505050505050505050565b6060600089898989898989896040516020016101d19897969594939291906104e7565b60405160208183030381529060405290508b8b826040516020016101f793929190610538565b6040516020818303038152906040529150509a9950505050505050505050565b80356001600160a01b038116811461022e57600080fd5b919050565b60008083601f84011261024557600080fd5b50813567ffffffffffffffff81111561025d57600080fd5b6020830191508360208260051b850101111561027857600080fd5b9250929050565b60008083601f84011261029157600080fd5b50813567ffffffffffffffff8111156102a957600080fd5b60208301915083602082850101111561027857600080fd5b60008060008060008060008060008060c08b8d0312156102e057600080fd5b6102e98b610217565b99506102f760208c01610217565b985060408b013567ffffffffffffffff8082111561031457600080fd5b6103208e838f01610233565b909a50985060608d013591508082111561033957600080fd5b6103458e838f01610233565b909850965060808d013591508082111561035e57600080fd5b61036a8e838f0161027f565b909650945060a08d013591508082111561038357600080fd5b506103908d828e0161027f565b915080935050809150509295989b9194979a5092959850565b81835260006001600160fb1b038311156103c257600080fd5b8260051b80836020870137939093016020019392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0389811682528816602082015260a060408201819052600090610431908301888a6103a9565b82810360608401526104448187896103a9565b905082810360808401526104598185876103db565b9b9a5050505050505050505050565b60005b8381101561048357818101518382015260200161046b565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526104b9816060850160208701610468565b601f01601f1916919091016060019392505050565b6000602082840312156104e057600080fd5b5051919050565b6080815260006104fb608083018a8c6103a9565b828103602084015261050e81898b6103a9565b905082810360408401526105238187896103db565b905082810360608401526104598185876103db565b60006bffffffffffffffffffffffff19808660601b168352808560601b16601484015250825161056f816028850160208701610468565b9190910160280194935050505056fea264697066735822122035db86f04505cf3f941203bf956d2dde8c705c85e4bb9bdbc3fdac6c5b1e565564736f6c63430008170033", diff --git a/deployments/sepolia/ERC1155SinglePortal.json b/deployments/sepolia/ERC1155SinglePortal.json index 7a595a21..f6c9be9b 100644 --- a/deployments/sepolia/ERC1155SinglePortal.json +++ b/deployments/sepolia/ERC1155SinglePortal.json @@ -64,11 +64,27 @@ "type": "function" } ], + "transactionHash": "0xd32f7dc4f084f0d6b8800a6dc022dae7864e499620c35ddd31af8f27e9f00632", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0xeA4037a524309056545fbAd9A688f449E7e05ffB", + "contractAddress": null, + "transactionIndex": 157, + "gasUsed": "317542", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x58f3cf075e0d5ba351de0b170ae896322e0919d3273cd00177a508a2ab2373e2", + "transactionHash": "0xd32f7dc4f084f0d6b8800a6dc022dae7864e499620c35ddd31af8f27e9f00632", + "logs": [], + "blockNumber": 6850938, + "cumulativeGasUsed": "6913790", + "status": 1, + "byzantium": true + }, "args": [ "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6" ], - "numDeployments": 1, - "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "numDeployments": 5, + "solcInputHash": "8db616d9d86bc002576bd1bb74fd4f72", "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"inputBox\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"contract IERC1155\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"baseLayerData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"execLayerData\",\"type\":\"bytes\"}],\"name\":\"depositSingleERC1155Token\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getInputBox\",\"outputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"inputBox\":\"The input box used by the portal\"}},\"depositSingleERC1155Token(address,address,uint256,uint256,bytes,bytes)\":{\"params\":{\"appContract\":\"The application contract address\",\"baseLayerData\":\"Additional data to be interpreted by the base layer\",\"execLayerData\":\"Additional data to be interpreted by the execution layer\",\"token\":\"The ERC-1155 token contract\",\"tokenId\":\"The identifier of the token being transferred\",\"value\":\"Transfer amount\"}},\"getInputBox()\":{\"returns\":{\"_0\":\"The input box\"}}},\"title\":\"ERC-1155 Single Transfer Portal\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs the portal.\"},\"depositSingleERC1155Token(address,address,uint256,uint256,bytes,bytes)\":{\"notice\":\"Transfer ERC-1155 tokens of a single type to an application contract and add an input to the application's input box to signal such operation. The caller must enable approval for the portal to manage all of their tokens beforehand, by calling the `setApprovalForAll` function in the token contract.\"},\"getInputBox()\":{\"notice\":\"Get the input box used by this portal.\"}},\"notice\":\"This contract allows anyone to perform single transfers of ERC-1155 tokens to an application contract while informing the off-chain machine.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/portals/ERC1155SinglePortal.sol\":\"ERC1155SinglePortal\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the value of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155Received} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `value` amount.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.\\n *\\n * Requirements:\\n *\\n * - `ids` and `values` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x6caffc9cfdc623eca9f87a686071708af5d5c17454d65022843fdddbc53c0cce\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the value of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the value of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\\n * caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\\n * allowance mechanism. `value` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 value) external returns (bool);\\n}\\n\",\"keccak256\":\"0xc6a8ff0ea489379b61faa647490411b80102578440ab9d84e9a957cc12164e70\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or\\n * {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the address zero.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5ef46daa3b58ef2702279d514780316efaa952915ee1aa3396f041ee2982b0b4\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x4296879f55019b23e135000eb36896057e7101fb7fb859c5ef690cf14643757b\",\"license\":\"MIT\"},\"contracts/common/InputEncoding.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title Input Encoding Library\\n\\n/// @notice Defines the encoding of inputs added by core trustless and\\n/// permissionless contracts, such as portals.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Wei being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeEtherDeposit(\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-20 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param value The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeERC20Deposit(\\n IERC20 token,\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-721 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param tokenId The token identifier\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeERC721Deposit(\\n IERC721 token,\\n address sender,\\n uint256 tokenId,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 single token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenId The identifier of the token being transferred\\n /// @param value Transfer amount\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeSingleERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256 tokenId,\\n uint256 value,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n value, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 batch token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenIds The identifiers of the tokens being transferred\\n /// @param values Transfer amounts per token type\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeBatchERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256[] calldata tokenIds,\\n uint256[] calldata values,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(\\n tokenIds,\\n values,\\n baseLayerData,\\n execLayerData\\n );\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n data // arbitrary size\\n );\\n }\\n}\\n\",\"keccak256\":\"0x1a7e17a9739f27dd761234c388bc6ba30b4aacdf31fc750a29e5c11f0b08bcae\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputBox.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @notice Provides data availability of inputs for applications.\\n/// @notice Each application has its own append-only list of inputs.\\n/// @notice Off-chain, inputs can be retrieved via events.\\n/// @notice On-chain, only the input hashes are stored.\\n/// @notice See `LibInput` for more details on how such hashes are computed.\\ninterface IInputBox {\\n /// @notice MUST trigger when an input is added.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @param input The input blob\\n event InputAdded(\\n address indexed appContract,\\n uint256 indexed index,\\n bytes input\\n );\\n\\n /// @notice Input is too large.\\n /// @param appContract The application contract address\\n /// @param inputLength The input length\\n /// @param maxInputLength The maximum input length\\n error InputTooLarge(\\n address appContract,\\n uint256 inputLength,\\n uint256 maxInputLength\\n );\\n\\n /// @notice Send an input to an application.\\n /// @param appContract The application contract address\\n /// @param payload The input payload\\n /// @return The hash of the input blob\\n /// @dev MUST fire an `InputAdded` event.\\n function addInput(\\n address appContract,\\n bytes calldata payload\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs sent to an application.\\n /// @param appContract The application contract address\\n function getNumberOfInputs(\\n address appContract\\n ) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in an application's input box.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @dev The provided index must be valid.\\n function getInputHash(\\n address appContract,\\n uint256 index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xae7730cd7ab2b31a86d7c4933215853ea6c0b1b4dc60d4ec24e5cfc2ec005fe3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/ERC1155SinglePortal.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\nimport {IERC1155SinglePortal} from \\\"./IERC1155SinglePortal.sol\\\";\\nimport {Portal} from \\\"./Portal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {InputEncoding} from \\\"../common/InputEncoding.sol\\\";\\n\\n/// @title ERC-1155 Single Transfer Portal\\n///\\n/// @notice This contract allows anyone to perform single transfers of\\n/// ERC-1155 tokens to an application contract while informing the off-chain machine.\\ncontract ERC1155SinglePortal is IERC1155SinglePortal, Portal {\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) Portal(inputBox) {}\\n\\n function depositSingleERC1155Token(\\n IERC1155 token,\\n address appContract,\\n uint256 tokenId,\\n uint256 value,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) external override {\\n token.safeTransferFrom(\\n msg.sender,\\n appContract,\\n tokenId,\\n value,\\n baseLayerData\\n );\\n\\n bytes memory payload = InputEncoding.encodeSingleERC1155Deposit(\\n token,\\n msg.sender,\\n tokenId,\\n value,\\n baseLayerData,\\n execLayerData\\n );\\n\\n _inputBox.addInput(appContract, payload);\\n }\\n}\\n\",\"keccak256\":\"0x4180bab75b3ecf0e7880ffc32dcaf658326d9fb02490523c2288a537a315606a\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IERC1155SinglePortal.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IPortal} from \\\"./IPortal.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title ERC-1155 Single Transfer Portal interface\\ninterface IERC1155SinglePortal is IPortal {\\n // Permissionless functions\\n\\n /// @notice Transfer ERC-1155 tokens of a single type to an application contract\\n /// and add an input to the application's input box to signal such operation.\\n ///\\n /// The caller must enable approval for the portal to manage all of their tokens\\n /// beforehand, by calling the `setApprovalForAll` function in the token contract.\\n ///\\n /// @param token The ERC-1155 token contract\\n /// @param appContract The application contract address\\n /// @param tokenId The identifier of the token being transferred\\n /// @param value Transfer amount\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n function depositSingleERC1155Token(\\n IERC1155 token,\\n address appContract,\\n uint256 tokenId,\\n uint256 value,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0x0e239fc05c89858218fb6e663ccb7c26171afe6be7e63d4ba93423cf823e445a\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IPortal.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\n\\n/// @title Portal interface\\ninterface IPortal {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this portal.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x390bc7ed84639e38e40bef8085486119d6c42057f91f3ab8286a9246198682e2\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/Portal.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IPortal} from \\\"./IPortal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\n\\n/// @title Portal\\n/// @notice This contract serves as a base for all the other portals.\\ncontract Portal is IPortal {\\n /// @notice The input box used by the portal.\\n IInputBox internal immutable _inputBox;\\n\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) {\\n _inputBox = inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return _inputBox;\\n }\\n}\\n\",\"keccak256\":\"0x0597a118880f0fe29f38931452342e8294dafc3699100cbf3454b6c5faa5f48a\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", "bytecode": "0x60a060405234801561001057600080fd5b5060405161054e38038061054e83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516104bd61009160003960008181603c015261012001526104bd6000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a578063dec07dca14610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a61008536600461026a565b61008c565b005b604051637921219560e11b81526001600160a01b0389169063f242432a906100c29033908b908b908b908b908b9060040161033b565b600060405180830381600087803b1580156100dc57600080fd5b505af11580156100f0573d6000803e3d6000fd5b50505050600061010689338989898989896101a6565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd6390610157908b9085906004016103a6565b6020604051808303816000875af1158015610176573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019a91906103e8565b50505050505050505050565b60606000858585856040516020016101c19493929190610401565b604051602081830303815290604052905089898989846040516020016101eb959493929190610433565b60405160208183030381529060405291505098975050505050505050565b6001600160a01b038116811461021e57600080fd5b50565b60008083601f84011261023357600080fd5b50813567ffffffffffffffff81111561024b57600080fd5b60208301915083602082850101111561026357600080fd5b9250929050565b60008060008060008060008060c0898b03121561028657600080fd5b883561029181610209565b975060208901356102a181610209565b96506040890135955060608901359450608089013567ffffffffffffffff808211156102cc57600080fd5b6102d88c838d01610221565b909650945060a08b01359150808211156102f157600080fd5b506102fe8b828c01610221565b999c989b5096995094979396929594505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03878116825286166020820152604081018590526060810184905260a0608082018190526000906103769083018486610312565b98975050505050505050565b60005b8381101561039d578181015183820152602001610385565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526103d3816060850160208701610382565b601f01601f1916919091016060019392505050565b6000602082840312156103fa57600080fd5b5051919050565b604081526000610415604083018688610312565b8281036020840152610428818587610312565b979650505050505050565b60006bffffffffffffffffffffffff19808860601b168352808760601b166014840152508460288301528360488301528251610476816068850160208701610382565b91909101606801969550505050505056fea2646970667358221220d41fd809f8973ec185f1d3497cbb7b9e865e5fedf38a2c16ada1c6b0ec7c11ee64736f6c63430008170033", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a578063dec07dca14610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a61008536600461026a565b61008c565b005b604051637921219560e11b81526001600160a01b0389169063f242432a906100c29033908b908b908b908b908b9060040161033b565b600060405180830381600087803b1580156100dc57600080fd5b505af11580156100f0573d6000803e3d6000fd5b50505050600061010689338989898989896101a6565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd6390610157908b9085906004016103a6565b6020604051808303816000875af1158015610176573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019a91906103e8565b50505050505050505050565b60606000858585856040516020016101c19493929190610401565b604051602081830303815290604052905089898989846040516020016101eb959493929190610433565b60405160208183030381529060405291505098975050505050505050565b6001600160a01b038116811461021e57600080fd5b50565b60008083601f84011261023357600080fd5b50813567ffffffffffffffff81111561024b57600080fd5b60208301915083602082850101111561026357600080fd5b9250929050565b60008060008060008060008060c0898b03121561028657600080fd5b883561029181610209565b975060208901356102a181610209565b96506040890135955060608901359450608089013567ffffffffffffffff808211156102cc57600080fd5b6102d88c838d01610221565b909650945060a08b01359150808211156102f157600080fd5b506102fe8b828c01610221565b999c989b5096995094979396929594505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03878116825286166020820152604081018590526060810184905260a0608082018190526000906103769083018486610312565b98975050505050505050565b60005b8381101561039d578181015183820152602001610385565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526103d3816060850160208701610382565b601f01601f1916919091016060019392505050565b6000602082840312156103fa57600080fd5b5051919050565b604081526000610415604083018688610312565b8281036020840152610428818587610312565b979650505050505050565b60006bffffffffffffffffffffffff19808860601b168352808760601b166014840152508460288301528360488301528251610476816068850160208701610382565b91909101606801969550505050505056fea2646970667358221220d41fd809f8973ec185f1d3497cbb7b9e865e5fedf38a2c16ada1c6b0ec7c11ee64736f6c63430008170033", diff --git a/deployments/sepolia/ERC20Portal.json b/deployments/sepolia/ERC20Portal.json index a18b49d7..a851c2db 100644 --- a/deployments/sepolia/ERC20Portal.json +++ b/deployments/sepolia/ERC20Portal.json @@ -59,11 +59,27 @@ "type": "function" } ], + "transactionHash": "0xdcf8770360fa0764400d68df0aa6ac61e7ca5172561d227817c64c8722be9966", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0xeA4037a524309056545fbAd9A688f449E7e05ffB", + "contractAddress": null, + "transactionIndex": 27, + "gasUsed": "269088", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x02ec49ee9f2f61247496cce9b7cd6176cedbd6758d1201ff60af476e9dd1ba98", + "transactionHash": "0xdcf8770360fa0764400d68df0aa6ac61e7ca5172561d227817c64c8722be9966", + "logs": [], + "blockNumber": 6850936, + "cumulativeGasUsed": "4866979", + "status": 1, + "byzantium": true + }, "args": [ "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6" ], - "numDeployments": 1, - "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "numDeployments": 9, + "solcInputHash": "8db616d9d86bc002576bd1bb74fd4f72", "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"inputBox\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ERC20TransferFailed\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"execLayerData\",\"type\":\"bytes\"}],\"name\":\"depositERC20Tokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getInputBox\",\"outputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"inputBox\":\"The input box used by the portal\"}},\"depositERC20Tokens(address,address,uint256,bytes)\":{\"params\":{\"appContract\":\"The application contract address\",\"execLayerData\":\"Additional data to be interpreted by the execution layer\",\"token\":\"The ERC-20 token contract\",\"value\":\"The amount of tokens to be transferred\"}},\"getInputBox()\":{\"returns\":{\"_0\":\"The input box\"}}},\"title\":\"ERC-20 Portal\",\"version\":1},\"userdoc\":{\"errors\":{\"ERC20TransferFailed()\":[{\"notice\":\"Failed to transfer ERC-20 tokens to application\"}]},\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs the portal.\"},\"depositERC20Tokens(address,address,uint256,bytes)\":{\"notice\":\"Transfer ERC-20 tokens to an application contract and add an input to the application's input box to signal such operation. The caller must allow the portal to withdraw at least `value` tokens from their account beforehand, by calling the `approve` function in the token contract.\"},\"getInputBox()\":{\"notice\":\"Get the input box used by this portal.\"}},\"notice\":\"This contract allows anyone to perform transfers of ERC-20 tokens to an application contract while informing the off-chain machine.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/portals/ERC20Portal.sol\":\"ERC20Portal\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the value of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155Received} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `value` amount.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.\\n *\\n * Requirements:\\n *\\n * - `ids` and `values` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x6caffc9cfdc623eca9f87a686071708af5d5c17454d65022843fdddbc53c0cce\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the value of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the value of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\\n * caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\\n * allowance mechanism. `value` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 value) external returns (bool);\\n}\\n\",\"keccak256\":\"0xc6a8ff0ea489379b61faa647490411b80102578440ab9d84e9a957cc12164e70\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or\\n * {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the address zero.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5ef46daa3b58ef2702279d514780316efaa952915ee1aa3396f041ee2982b0b4\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x4296879f55019b23e135000eb36896057e7101fb7fb859c5ef690cf14643757b\",\"license\":\"MIT\"},\"contracts/common/InputEncoding.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title Input Encoding Library\\n\\n/// @notice Defines the encoding of inputs added by core trustless and\\n/// permissionless contracts, such as portals.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Wei being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeEtherDeposit(\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-20 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param value The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeERC20Deposit(\\n IERC20 token,\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-721 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param tokenId The token identifier\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeERC721Deposit(\\n IERC721 token,\\n address sender,\\n uint256 tokenId,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 single token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenId The identifier of the token being transferred\\n /// @param value Transfer amount\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeSingleERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256 tokenId,\\n uint256 value,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n value, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 batch token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenIds The identifiers of the tokens being transferred\\n /// @param values Transfer amounts per token type\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeBatchERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256[] calldata tokenIds,\\n uint256[] calldata values,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(\\n tokenIds,\\n values,\\n baseLayerData,\\n execLayerData\\n );\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n data // arbitrary size\\n );\\n }\\n}\\n\",\"keccak256\":\"0x1a7e17a9739f27dd761234c388bc6ba30b4aacdf31fc750a29e5c11f0b08bcae\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputBox.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @notice Provides data availability of inputs for applications.\\n/// @notice Each application has its own append-only list of inputs.\\n/// @notice Off-chain, inputs can be retrieved via events.\\n/// @notice On-chain, only the input hashes are stored.\\n/// @notice See `LibInput` for more details on how such hashes are computed.\\ninterface IInputBox {\\n /// @notice MUST trigger when an input is added.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @param input The input blob\\n event InputAdded(\\n address indexed appContract,\\n uint256 indexed index,\\n bytes input\\n );\\n\\n /// @notice Input is too large.\\n /// @param appContract The application contract address\\n /// @param inputLength The input length\\n /// @param maxInputLength The maximum input length\\n error InputTooLarge(\\n address appContract,\\n uint256 inputLength,\\n uint256 maxInputLength\\n );\\n\\n /// @notice Send an input to an application.\\n /// @param appContract The application contract address\\n /// @param payload The input payload\\n /// @return The hash of the input blob\\n /// @dev MUST fire an `InputAdded` event.\\n function addInput(\\n address appContract,\\n bytes calldata payload\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs sent to an application.\\n /// @param appContract The application contract address\\n function getNumberOfInputs(\\n address appContract\\n ) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in an application's input box.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @dev The provided index must be valid.\\n function getInputHash(\\n address appContract,\\n uint256 index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xae7730cd7ab2b31a86d7c4933215853ea6c0b1b4dc60d4ec24e5cfc2ec005fe3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/ERC20Portal.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {IERC20Portal} from \\\"./IERC20Portal.sol\\\";\\nimport {Portal} from \\\"./Portal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {InputEncoding} from \\\"../common/InputEncoding.sol\\\";\\n\\n/// @title ERC-20 Portal\\n///\\n/// @notice This contract allows anyone to perform transfers of\\n/// ERC-20 tokens to an application contract while informing the off-chain machine.\\ncontract ERC20Portal is IERC20Portal, Portal {\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) Portal(inputBox) {}\\n\\n function depositERC20Tokens(\\n IERC20 token,\\n address appContract,\\n uint256 value,\\n bytes calldata execLayerData\\n ) external override {\\n bool success = token.transferFrom(msg.sender, appContract, value);\\n\\n if (!success) {\\n revert ERC20TransferFailed();\\n }\\n\\n bytes memory payload = InputEncoding.encodeERC20Deposit(\\n token,\\n msg.sender,\\n value,\\n execLayerData\\n );\\n\\n _inputBox.addInput(appContract, payload);\\n }\\n}\\n\",\"keccak256\":\"0x4ae5d4ce43579aa46e86bf18a82d04dce812eeec7e89ad9aac88d510eefc6de8\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IERC20Portal.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IPortal} from \\\"./IPortal.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title ERC-20 Portal interface\\ninterface IERC20Portal is IPortal {\\n // Errors\\n\\n /// @notice Failed to transfer ERC-20 tokens to application\\n error ERC20TransferFailed();\\n\\n // Permissionless functions\\n\\n /// @notice Transfer ERC-20 tokens to an application contract\\n /// and add an input to the application's input box to signal such operation.\\n ///\\n /// The caller must allow the portal to withdraw at least `value` tokens\\n /// from their account beforehand, by calling the `approve` function in the\\n /// token contract.\\n ///\\n /// @param token The ERC-20 token contract\\n /// @param appContract The application contract address\\n /// @param value The amount of tokens to be transferred\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n function depositERC20Tokens(\\n IERC20 token,\\n address appContract,\\n uint256 value,\\n bytes calldata execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0x21cec3e05b4901bdb2334b214437c9b588a547850a221b04a3a0a45dd6074aa0\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IPortal.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\n\\n/// @title Portal interface\\ninterface IPortal {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this portal.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x390bc7ed84639e38e40bef8085486119d6c42057f91f3ab8286a9246198682e2\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/Portal.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IPortal} from \\\"./IPortal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\n\\n/// @title Portal\\n/// @notice This contract serves as a base for all the other portals.\\ncontract Portal is IPortal {\\n /// @notice The input box used by the portal.\\n IInputBox internal immutable _inputBox;\\n\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) {\\n _inputBox = inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return _inputBox;\\n }\\n}\\n\",\"keccak256\":\"0x0597a118880f0fe29f38931452342e8294dafc3699100cbf3454b6c5faa5f48a\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", "bytecode": "0x60a060405234801561001057600080fd5b5060405161046e38038061046e83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516103dd61009160003960008181603c015261015201526103dd6000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806395854b8114610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a610085366004610223565b61008c565b005b6040516323b872dd60e01b81523360048201526001600160a01b03858116602483015260448201859052600091908716906323b872dd906064016020604051808303816000875af11580156100e5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061010991906102c2565b90508061012957604051633c9fd93960e21b815260040160405180910390fd5b600061013887338787876101d6565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061018990899085906004016102eb565b6020604051808303816000875af11580156101a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101cc919061034a565b5050505050505050565b606085858585856040516020016101f1959493929190610363565b604051602081830303815290604052905095945050505050565b6001600160a01b038116811461022057600080fd5b50565b60008060008060006080868803121561023b57600080fd5b85356102468161020b565b945060208601356102568161020b565b935060408601359250606086013567ffffffffffffffff8082111561027a57600080fd5b818801915088601f83011261028e57600080fd5b81358181111561029d57600080fd5b8960208285010111156102af57600080fd5b9699959850939650602001949392505050565b6000602082840312156102d457600080fd5b815180151581146102e457600080fd5b9392505050565b60018060a01b03831681526000602060406020840152835180604085015260005b818110156103285785810183015185820160600152820161030c565b506000606082860101526060601f19601f830116850101925050509392505050565b60006020828403121561035c57600080fd5b5051919050565b60006bffffffffffffffffffffffff19808860601b168352808760601b1660148401525084602883015282846048840137506000910160480190815294935050505056fea26469706673582212206e9c57997e262a5573f4d46a834e8afe9777fcbdf098307d8711bdff9b91b3dd64736f6c63430008170033", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806395854b8114610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a610085366004610223565b61008c565b005b6040516323b872dd60e01b81523360048201526001600160a01b03858116602483015260448201859052600091908716906323b872dd906064016020604051808303816000875af11580156100e5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061010991906102c2565b90508061012957604051633c9fd93960e21b815260040160405180910390fd5b600061013887338787876101d6565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061018990899085906004016102eb565b6020604051808303816000875af11580156101a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101cc919061034a565b5050505050505050565b606085858585856040516020016101f1959493929190610363565b604051602081830303815290604052905095945050505050565b6001600160a01b038116811461022057600080fd5b50565b60008060008060006080868803121561023b57600080fd5b85356102468161020b565b945060208601356102568161020b565b935060408601359250606086013567ffffffffffffffff8082111561027a57600080fd5b818801915088601f83011261028e57600080fd5b81358181111561029d57600080fd5b8960208285010111156102af57600080fd5b9699959850939650602001949392505050565b6000602082840312156102d457600080fd5b815180151581146102e457600080fd5b9392505050565b60018060a01b03831681526000602060406020840152835180604085015260005b818110156103285785810183015185820160600152820161030c565b506000606082860101526060601f19601f830116850101925050509392505050565b60006020828403121561035c57600080fd5b5051919050565b60006bffffffffffffffffffffffff19808860601b168352808760601b1660148401525084602883015282846048840137506000910160480190815294935050505056fea26469706673582212206e9c57997e262a5573f4d46a834e8afe9777fcbdf098307d8711bdff9b91b3dd64736f6c63430008170033", diff --git a/deployments/sepolia/ERC721Portal.json b/deployments/sepolia/ERC721Portal.json index c808a22e..c9898a72 100644 --- a/deployments/sepolia/ERC721Portal.json +++ b/deployments/sepolia/ERC721Portal.json @@ -59,11 +59,27 @@ "type": "function" } ], + "transactionHash": "0xd326bebdf996cbb50dcaa855bc894e94521584385e3f2d6b42a0d1c35623c129", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0xeA4037a524309056545fbAd9A688f449E7e05ffB", + "contractAddress": null, + "transactionIndex": 28, + "gasUsed": "308450", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x812730cc2168edb6b60dd2b2dd1065be0a8aa06d5d45613ca9875d4314d859c0", + "transactionHash": "0xd326bebdf996cbb50dcaa855bc894e94521584385e3f2d6b42a0d1c35623c129", + "logs": [], + "blockNumber": 6850937, + "cumulativeGasUsed": "7514155", + "status": 1, + "byzantium": true + }, "args": [ "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6" ], - "numDeployments": 1, - "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "numDeployments": 9, + "solcInputHash": "8db616d9d86bc002576bd1bb74fd4f72", "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"inputBox\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"contract IERC721\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"baseLayerData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"execLayerData\",\"type\":\"bytes\"}],\"name\":\"depositERC721Token\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getInputBox\",\"outputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"inputBox\":\"The input box used by the portal\"}},\"depositERC721Token(address,address,uint256,bytes,bytes)\":{\"params\":{\"appContract\":\"The application contract address\",\"baseLayerData\":\"Additional data to be interpreted by the base layer\",\"execLayerData\":\"Additional data to be interpreted by the execution layer\",\"token\":\"The ERC-721 token contract\",\"tokenId\":\"The identifier of the token being transferred\"}},\"getInputBox()\":{\"returns\":{\"_0\":\"The input box\"}}},\"title\":\"ERC-721 Portal\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs the portal.\"},\"depositERC721Token(address,address,uint256,bytes,bytes)\":{\"notice\":\"Transfer an ERC-721 token to an application contract and add an input to the application's input box to signal such operation. The caller must change the approved address for the ERC-721 token to the portal address beforehand, by calling the `approve` function in the token contract.\"},\"getInputBox()\":{\"notice\":\"Get the input box used by this portal.\"}},\"notice\":\"This contract allows anyone to perform transfers of ERC-721 tokens to an application contract while informing the off-chain machine.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/portals/ERC721Portal.sol\":\"ERC721Portal\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the value of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155Received} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `value` amount.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.\\n *\\n * Requirements:\\n *\\n * - `ids` and `values` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x6caffc9cfdc623eca9f87a686071708af5d5c17454d65022843fdddbc53c0cce\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the value of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the value of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\\n * caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\\n * allowance mechanism. `value` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 value) external returns (bool);\\n}\\n\",\"keccak256\":\"0xc6a8ff0ea489379b61faa647490411b80102578440ab9d84e9a957cc12164e70\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or\\n * {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the address zero.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5ef46daa3b58ef2702279d514780316efaa952915ee1aa3396f041ee2982b0b4\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x4296879f55019b23e135000eb36896057e7101fb7fb859c5ef690cf14643757b\",\"license\":\"MIT\"},\"contracts/common/InputEncoding.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title Input Encoding Library\\n\\n/// @notice Defines the encoding of inputs added by core trustless and\\n/// permissionless contracts, such as portals.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Wei being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeEtherDeposit(\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-20 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param value The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeERC20Deposit(\\n IERC20 token,\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-721 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param tokenId The token identifier\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeERC721Deposit(\\n IERC721 token,\\n address sender,\\n uint256 tokenId,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 single token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenId The identifier of the token being transferred\\n /// @param value Transfer amount\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeSingleERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256 tokenId,\\n uint256 value,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n value, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 batch token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenIds The identifiers of the tokens being transferred\\n /// @param values Transfer amounts per token type\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeBatchERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256[] calldata tokenIds,\\n uint256[] calldata values,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(\\n tokenIds,\\n values,\\n baseLayerData,\\n execLayerData\\n );\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n data // arbitrary size\\n );\\n }\\n}\\n\",\"keccak256\":\"0x1a7e17a9739f27dd761234c388bc6ba30b4aacdf31fc750a29e5c11f0b08bcae\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputBox.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @notice Provides data availability of inputs for applications.\\n/// @notice Each application has its own append-only list of inputs.\\n/// @notice Off-chain, inputs can be retrieved via events.\\n/// @notice On-chain, only the input hashes are stored.\\n/// @notice See `LibInput` for more details on how such hashes are computed.\\ninterface IInputBox {\\n /// @notice MUST trigger when an input is added.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @param input The input blob\\n event InputAdded(\\n address indexed appContract,\\n uint256 indexed index,\\n bytes input\\n );\\n\\n /// @notice Input is too large.\\n /// @param appContract The application contract address\\n /// @param inputLength The input length\\n /// @param maxInputLength The maximum input length\\n error InputTooLarge(\\n address appContract,\\n uint256 inputLength,\\n uint256 maxInputLength\\n );\\n\\n /// @notice Send an input to an application.\\n /// @param appContract The application contract address\\n /// @param payload The input payload\\n /// @return The hash of the input blob\\n /// @dev MUST fire an `InputAdded` event.\\n function addInput(\\n address appContract,\\n bytes calldata payload\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs sent to an application.\\n /// @param appContract The application contract address\\n function getNumberOfInputs(\\n address appContract\\n ) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in an application's input box.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @dev The provided index must be valid.\\n function getInputHash(\\n address appContract,\\n uint256 index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xae7730cd7ab2b31a86d7c4933215853ea6c0b1b4dc60d4ec24e5cfc2ec005fe3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/ERC721Portal.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\nimport {IERC721Portal} from \\\"./IERC721Portal.sol\\\";\\nimport {Portal} from \\\"./Portal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {InputEncoding} from \\\"../common/InputEncoding.sol\\\";\\n\\n/// @title ERC-721 Portal\\n///\\n/// @notice This contract allows anyone to perform transfers of\\n/// ERC-721 tokens to an application contract while informing the off-chain machine.\\ncontract ERC721Portal is IERC721Portal, Portal {\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) Portal(inputBox) {}\\n\\n function depositERC721Token(\\n IERC721 token,\\n address appContract,\\n uint256 tokenId,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) external override {\\n token.safeTransferFrom(msg.sender, appContract, tokenId, baseLayerData);\\n\\n bytes memory payload = InputEncoding.encodeERC721Deposit(\\n token,\\n msg.sender,\\n tokenId,\\n baseLayerData,\\n execLayerData\\n );\\n\\n _inputBox.addInput(appContract, payload);\\n }\\n}\\n\",\"keccak256\":\"0x7cd8a4f2e1d99940790a5d644965752f1ae257bbbefc7103d4be9e51730bad97\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IERC721Portal.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IPortal} from \\\"./IPortal.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title ERC-721 Portal interface\\ninterface IERC721Portal is IPortal {\\n // Permissionless functions\\n\\n /// @notice Transfer an ERC-721 token to an application contract\\n /// and add an input to the application's input box to signal such operation.\\n ///\\n /// The caller must change the approved address for the ERC-721 token\\n /// to the portal address beforehand, by calling the `approve` function in the\\n /// token contract.\\n ///\\n /// @param token The ERC-721 token contract\\n /// @param appContract The application contract address\\n /// @param tokenId The identifier of the token being transferred\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n function depositERC721Token(\\n IERC721 token,\\n address appContract,\\n uint256 tokenId,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) external;\\n}\\n\",\"keccak256\":\"0x6efef50a83bbd007d4bdcc856227ebf781a937b692ddf60845f29a4ff9e52918\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IPortal.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\n\\n/// @title Portal interface\\ninterface IPortal {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this portal.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x390bc7ed84639e38e40bef8085486119d6c42057f91f3ab8286a9246198682e2\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/Portal.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IPortal} from \\\"./IPortal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\n\\n/// @title Portal\\n/// @notice This contract serves as a base for all the other portals.\\ncontract Portal is IPortal {\\n /// @notice The input box used by the portal.\\n IInputBox internal immutable _inputBox;\\n\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) {\\n _inputBox = inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return _inputBox;\\n }\\n}\\n\",\"keccak256\":\"0x0597a118880f0fe29f38931452342e8294dafc3699100cbf3454b6c5faa5f48a\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", "bytecode": "0x60a060405234801561001057600080fd5b5060405161052438038061052483398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b60805161049361009160003960008181603c015261011d01526104936000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806328911e8314610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a610085366004610263565b61008c565b005b604051635c46a7ef60e11b81526001600160a01b0388169063b88d4fde906100c09033908a908a908a908a9060040161032b565b600060405180830381600087803b1580156100da57600080fd5b505af11580156100ee573d6000803e3d6000fd5b505050506000610103883388888888886101a2565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd6390610154908a90859060040161038e565b6020604051808303816000875af1158015610173573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019791906103d0565b505050505050505050565b60606000858585856040516020016101bd94939291906103e9565b6040516020818303038152906040529050888888836040516020016101e59493929190610410565b604051602081830303815290604052915050979650505050505050565b6001600160a01b038116811461021757600080fd5b50565b60008083601f84011261022c57600080fd5b50813567ffffffffffffffff81111561024457600080fd5b60208301915083602082850101111561025c57600080fd5b9250929050565b600080600080600080600060a0888a03121561027e57600080fd5b873561028981610202565b9650602088013561029981610202565b955060408801359450606088013567ffffffffffffffff808211156102bd57600080fd5b6102c98b838c0161021a565b909650945060808a01359150808211156102e257600080fd5b506102ef8a828b0161021a565b989b979a50959850939692959293505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038681168252851660208201526040810184905260806060820181905260009061035f9083018486610302565b979650505050505050565b60005b8381101561038557818101518382015260200161036d565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526103bb81606085016020870161036a565b601f01601f1916919091016060019392505050565b6000602082840312156103e257600080fd5b5051919050565b6040815260006103fd604083018688610302565b828103602084015261035f818587610302565b60006bffffffffffffffffffffffff19808760601b168352808660601b16601484015250836028830152825161044d81604885016020870161036a565b919091016048019594505050505056fea264697066735822122009038c6a3d5cfcce855ebe74770593d9af2426033a9dba50dac6b7c3ff7e335564736f6c63430008170033", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100355760003560e01c8062aace9a1461003a57806328911e8314610077575b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a610085366004610263565b61008c565b005b604051635c46a7ef60e11b81526001600160a01b0388169063b88d4fde906100c09033908a908a908a908a9060040161032b565b600060405180830381600087803b1580156100da57600080fd5b505af11580156100ee573d6000803e3d6000fd5b505050506000610103883388888888886101a2565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd6390610154908a90859060040161038e565b6020604051808303816000875af1158015610173573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019791906103d0565b505050505050505050565b60606000858585856040516020016101bd94939291906103e9565b6040516020818303038152906040529050888888836040516020016101e59493929190610410565b604051602081830303815290604052915050979650505050505050565b6001600160a01b038116811461021757600080fd5b50565b60008083601f84011261022c57600080fd5b50813567ffffffffffffffff81111561024457600080fd5b60208301915083602082850101111561025c57600080fd5b9250929050565b600080600080600080600060a0888a03121561027e57600080fd5b873561028981610202565b9650602088013561029981610202565b955060408801359450606088013567ffffffffffffffff808211156102bd57600080fd5b6102c98b838c0161021a565b909650945060808a01359150808211156102e257600080fd5b506102ef8a828b0161021a565b989b979a50959850939692959293505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038681168252851660208201526040810184905260806060820181905260009061035f9083018486610302565b979650505050505050565b60005b8381101561038557818101518382015260200161036d565b50506000910152565b60018060a01b038316815260406020820152600082518060408401526103bb81606085016020870161036a565b601f01601f1916919091016060019392505050565b6000602082840312156103e257600080fd5b5051919050565b6040815260006103fd604083018688610302565b828103602084015261035f818587610302565b60006bffffffffffffffffffffffff19808760601b168352808660601b16601484015250836028830152825161044d81604885016020870161036a565b919091016048019594505050505056fea264697066735822122009038c6a3d5cfcce855ebe74770593d9af2426033a9dba50dac6b7c3ff7e335564736f6c63430008170033", diff --git a/deployments/sepolia/EtherPortal.json b/deployments/sepolia/EtherPortal.json index 030087ec..53c3a69f 100644 --- a/deployments/sepolia/EtherPortal.json +++ b/deployments/sepolia/EtherPortal.json @@ -49,11 +49,27 @@ "type": "function" } ], + "transactionHash": "0x9ca23a79ea4ff97005b94cfd2daf7634694bc4e363e26d24cab8d0543d27282c", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0xeA4037a524309056545fbAd9A688f449E7e05ffB", + "contractAddress": null, + "transactionIndex": 26, + "gasUsed": "238142", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x8c30d4b8c9581659d38216045c7d1542255b0a024051d211ec2be8df0733a039", + "transactionHash": "0x9ca23a79ea4ff97005b94cfd2daf7634694bc4e363e26d24cab8d0543d27282c", + "logs": [], + "blockNumber": 6850935, + "cumulativeGasUsed": "5130560", + "status": 1, + "byzantium": true + }, "args": [ "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6" ], - "numDeployments": 1, - "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "numDeployments": 9, + "solcInputHash": "8db616d9d86bc002576bd1bb74fd4f72", "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"inputBox\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"EtherTransferFailed\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"execLayerData\",\"type\":\"bytes\"}],\"name\":\"depositEther\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getInputBox\",\"outputs\":[{\"internalType\":\"contract IInputBox\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"inputBox\":\"The input box used by the portal\"}},\"depositEther(address,bytes)\":{\"details\":\"Any Ether sent through this function will be forwarded to the application contract. If the transfer fails, an `EtherTransferFailed` error will be raised.\",\"params\":{\"appContract\":\"The application contract address\",\"execLayerData\":\"Additional data to be interpreted by the execution layer\"}},\"getInputBox()\":{\"returns\":{\"_0\":\"The input box\"}}},\"title\":\"Ether Portal\",\"version\":1},\"userdoc\":{\"errors\":{\"EtherTransferFailed()\":[{\"notice\":\"Failed to transfer Ether to application\"}]},\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs the portal.\"},\"depositEther(address,bytes)\":{\"notice\":\"Transfer Ether to an application contract and add an input to the application's input box to signal such operation.\"},\"getInputBox()\":{\"notice\":\"Get the input box used by this portal.\"}},\"notice\":\"This contract allows anyone to perform transfers of Ether to an application contract while informing the off-chain machine.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/portals/EtherPortal.sol\":\"EtherPortal\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the value of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155Received} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `value` amount.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\\n * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver.\\n * Ensure to follow the checks-effects-interactions pattern and consider employing\\n * reentrancy guards when interacting with untrusted contracts.\\n *\\n * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.\\n *\\n * Requirements:\\n *\\n * - `ids` and `values` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x6caffc9cfdc623eca9f87a686071708af5d5c17454d65022843fdddbc53c0cce\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the value of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the value of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\\n * caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\\n * allowance mechanism. `value` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 value) external returns (bool);\\n}\\n\",\"keccak256\":\"0xc6a8ff0ea489379b61faa647490411b80102578440ab9d84e9a957cc12164e70\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or\\n * {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the address zero.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5ef46daa3b58ef2702279d514780316efaa952915ee1aa3396f041ee2982b0b4\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x4296879f55019b23e135000eb36896057e7101fb7fb859c5ef690cf14643757b\",\"license\":\"MIT\"},\"contracts/common/InputEncoding.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\n\\n/// @title Input Encoding Library\\n\\n/// @notice Defines the encoding of inputs added by core trustless and\\n/// permissionless contracts, such as portals.\\nlibrary InputEncoding {\\n /// @notice Encode an Ether deposit.\\n /// @param sender The Ether sender\\n /// @param value The amount of Wei being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeEtherDeposit(\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-20 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param value The amount of tokens being sent\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n function encodeERC20Deposit(\\n IERC20 token,\\n address sender,\\n uint256 value,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n value, // 32B\\n execLayerData // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-721 token deposit.\\n /// @param token The token contract\\n /// @param sender The token sender\\n /// @param tokenId The token identifier\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeERC721Deposit(\\n IERC721 token,\\n address sender,\\n uint256 tokenId,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 single token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenId The identifier of the token being transferred\\n /// @param value Transfer amount\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeSingleERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256 tokenId,\\n uint256 value,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(baseLayerData, execLayerData);\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n tokenId, // 32B\\n value, // 32B\\n data // arbitrary size\\n );\\n }\\n\\n /// @notice Encode an ERC-1155 batch token deposit.\\n /// @param token The ERC-1155 token contract\\n /// @param sender The token sender\\n /// @param tokenIds The identifiers of the tokens being transferred\\n /// @param values Transfer amounts per token type\\n /// @param baseLayerData Additional data to be interpreted by the base layer\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n /// @return The encoded input payload\\n /// @dev `baseLayerData` should be forwarded to `token`.\\n function encodeBatchERC1155Deposit(\\n IERC1155 token,\\n address sender,\\n uint256[] calldata tokenIds,\\n uint256[] calldata values,\\n bytes calldata baseLayerData,\\n bytes calldata execLayerData\\n ) internal pure returns (bytes memory) {\\n bytes memory data = abi.encode(\\n tokenIds,\\n values,\\n baseLayerData,\\n execLayerData\\n );\\n return\\n abi.encodePacked(\\n token, // 20B\\n sender, // 20B\\n data // arbitrary size\\n );\\n }\\n}\\n\",\"keccak256\":\"0x1a7e17a9739f27dd761234c388bc6ba30b4aacdf31fc750a29e5c11f0b08bcae\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputBox.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @notice Provides data availability of inputs for applications.\\n/// @notice Each application has its own append-only list of inputs.\\n/// @notice Off-chain, inputs can be retrieved via events.\\n/// @notice On-chain, only the input hashes are stored.\\n/// @notice See `LibInput` for more details on how such hashes are computed.\\ninterface IInputBox {\\n /// @notice MUST trigger when an input is added.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @param input The input blob\\n event InputAdded(\\n address indexed appContract,\\n uint256 indexed index,\\n bytes input\\n );\\n\\n /// @notice Input is too large.\\n /// @param appContract The application contract address\\n /// @param inputLength The input length\\n /// @param maxInputLength The maximum input length\\n error InputTooLarge(\\n address appContract,\\n uint256 inputLength,\\n uint256 maxInputLength\\n );\\n\\n /// @notice Send an input to an application.\\n /// @param appContract The application contract address\\n /// @param payload The input payload\\n /// @return The hash of the input blob\\n /// @dev MUST fire an `InputAdded` event.\\n function addInput(\\n address appContract,\\n bytes calldata payload\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs sent to an application.\\n /// @param appContract The application contract address\\n function getNumberOfInputs(\\n address appContract\\n ) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in an application's input box.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @dev The provided index must be valid.\\n function getInputHash(\\n address appContract,\\n uint256 index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xae7730cd7ab2b31a86d7c4933215853ea6c0b1b4dc60d4ec24e5cfc2ec005fe3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/EtherPortal.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IEtherPortal} from \\\"./IEtherPortal.sol\\\";\\nimport {Portal} from \\\"./Portal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\nimport {InputEncoding} from \\\"../common/InputEncoding.sol\\\";\\n\\n/// @title Ether Portal\\n///\\n/// @notice This contract allows anyone to perform transfers of\\n/// Ether to an application contract while informing the off-chain machine.\\ncontract EtherPortal is IEtherPortal, Portal {\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) Portal(inputBox) {}\\n\\n function depositEther(\\n address appContract,\\n bytes calldata execLayerData\\n ) external payable override {\\n (bool success, ) = appContract.call{value: msg.value}(\\\"\\\");\\n\\n if (!success) {\\n revert EtherTransferFailed();\\n }\\n\\n bytes memory payload = InputEncoding.encodeEtherDeposit(\\n msg.sender,\\n msg.value,\\n execLayerData\\n );\\n\\n _inputBox.addInput(appContract, payload);\\n }\\n}\\n\",\"keccak256\":\"0x2dccf35f2991f89967925ab64c1484ac2615dfb7180f816ae6dc3463762377fb\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IEtherPortal.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IPortal} from \\\"./IPortal.sol\\\";\\n\\n/// @title Ether Portal interface\\ninterface IEtherPortal is IPortal {\\n // Errors\\n\\n /// @notice Failed to transfer Ether to application\\n error EtherTransferFailed();\\n\\n // Permissionless functions\\n\\n /// @notice Transfer Ether to an application contract\\n /// and add an input to the application's input box to signal such operation.\\n ///\\n /// @param appContract The application contract address\\n /// @param execLayerData Additional data to be interpreted by the execution layer\\n ///\\n /// @dev Any Ether sent through this function will be forwarded to the application contract.\\n /// If the transfer fails, an `EtherTransferFailed` error will be raised.\\n function depositEther(\\n address appContract,\\n bytes calldata execLayerData\\n ) external payable;\\n}\\n\",\"keccak256\":\"0xfbb2628d07d5ac3a62e2aa7507be93a8ab68110985086c3af6d2e9e3bfcf4827\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/IPortal.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\n\\n/// @title Portal interface\\ninterface IPortal {\\n // Permissionless functions\\n\\n /// @notice Get the input box used by this portal.\\n /// @return The input box\\n function getInputBox() external view returns (IInputBox);\\n}\\n\",\"keccak256\":\"0x390bc7ed84639e38e40bef8085486119d6c42057f91f3ab8286a9246198682e2\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/portals/Portal.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IPortal} from \\\"./IPortal.sol\\\";\\nimport {IInputBox} from \\\"../inputs/IInputBox.sol\\\";\\n\\n/// @title Portal\\n/// @notice This contract serves as a base for all the other portals.\\ncontract Portal is IPortal {\\n /// @notice The input box used by the portal.\\n IInputBox internal immutable _inputBox;\\n\\n /// @notice Constructs the portal.\\n /// @param inputBox The input box used by the portal\\n constructor(IInputBox inputBox) {\\n _inputBox = inputBox;\\n }\\n\\n function getInputBox() external view override returns (IInputBox) {\\n return _inputBox;\\n }\\n}\\n\",\"keccak256\":\"0x0597a118880f0fe29f38931452342e8294dafc3699100cbf3454b6c5faa5f48a\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", "bytecode": "0x60a060405234801561001057600080fd5b506040516103df3803806103df83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b60805161034e61009160003960008181603c0152610128015261034e6000f3fe6080604052600436106100285760003560e01c8062aace9a1461002d578063938c054f14610077575b600080fd5b34801561003957600080fd5b507f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a6100853660046101dc565b61008c565b005b6000836001600160a01b03163460405160006040518083038185875af1925050503d80600081146100d9576040519150601f19603f3d011682016040523d82523d6000602084013e6100de565b606091505b505090508061010057604051630ce8f45160e31b815260040160405180910390fd5b600061010e333486866101aa565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061015f908890859060040161026d565b6020604051808303816000875af115801561017e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a291906102cc565b505050505050565b6060848484846040516020016101c394939291906102e5565b6040516020818303038152906040529050949350505050565b6000806000604084860312156101f157600080fd5b83356001600160a01b038116811461020857600080fd5b9250602084013567ffffffffffffffff8082111561022557600080fd5b818601915086601f83011261023957600080fd5b81358181111561024857600080fd5b87602082850101111561025a57600080fd5b6020830194508093505050509250925092565b60018060a01b03831681526000602060406020840152835180604085015260005b818110156102aa5785810183015185820160600152820161028e565b506000606082860101526060601f19601f830116850101925050509392505050565b6000602082840312156102de57600080fd5b5051919050565b6bffffffffffffffffffffffff198560601b1681528360148201528183603483013760009101603401908152939250505056fea2646970667358221220e52bd9bc274e5c6b8dd2815a9a07e76c86edd92be566abb0729d8f7b78e6ca4664736f6c63430008170033", "deployedBytecode": "0x6080604052600436106100285760003560e01c8062aace9a1461002d578063938c054f14610077575b600080fd5b34801561003957600080fd5b507f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b61008a6100853660046101dc565b61008c565b005b6000836001600160a01b03163460405160006040518083038185875af1925050503d80600081146100d9576040519150601f19603f3d011682016040523d82523d6000602084013e6100de565b606091505b505090508061010057604051630ce8f45160e31b815260040160405180910390fd5b600061010e333486866101aa565b604051631789cd6360e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631789cd639061015f908890859060040161026d565b6020604051808303816000875af115801561017e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a291906102cc565b505050505050565b6060848484846040516020016101c394939291906102e5565b6040516020818303038152906040529050949350505050565b6000806000604084860312156101f157600080fd5b83356001600160a01b038116811461020857600080fd5b9250602084013567ffffffffffffffff8082111561022557600080fd5b818601915086601f83011261023957600080fd5b81358181111561024857600080fd5b87602082850101111561025a57600080fd5b6020830194508093505050509250925092565b60018060a01b03831681526000602060406020840152835180604085015260005b818110156102aa5785810183015185820160600152820161028e565b506000606082860101526060601f19601f830116850101925050509392505050565b6000602082840312156102de57600080fd5b5051919050565b6bffffffffffffffffffffffff198560601b1681528360148201528183603483013760009101603401908152939250505056fea2646970667358221220e52bd9bc274e5c6b8dd2815a9a07e76c86edd92be566abb0729d8f7b78e6ca4664736f6c63430008170033", diff --git a/deployments/sepolia/InputBox.json b/deployments/sepolia/InputBox.json index 35139a7d..2d3c599f 100644 --- a/deployments/sepolia/InputBox.json +++ b/deployments/sepolia/InputBox.json @@ -115,9 +115,25 @@ "type": "function" } ], + "transactionHash": "0x04cc7acd980738ce5854385a83d27e175e86ae6154768624907454573444f5da", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0xeA4037a524309056545fbAd9A688f449E7e05ffB", + "contractAddress": null, + "transactionIndex": 55, + "gasUsed": "275862", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x71c64ba068730993f9626ece96ab04f816920b3f09d07832ad053e58839ead7e", + "transactionHash": "0x04cc7acd980738ce5854385a83d27e175e86ae6154768624907454573444f5da", + "logs": [], + "blockNumber": 6850934, + "cumulativeGasUsed": "9069402", + "status": 1, + "byzantium": true + }, "args": [], - "numDeployments": 1, - "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "numDeployments": 8, + "solcInputHash": "8db616d9d86bc002576bd1bb74fd4f72", "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"inputLength\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxInputLength\",\"type\":\"uint256\"}],\"name\":\"InputTooLarge\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"input\",\"type\":\"bytes\"}],\"name\":\"InputAdded\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"}],\"name\":\"addInput\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getInputHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"appContract\",\"type\":\"address\"}],\"name\":\"getNumberOfInputs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"InputTooLarge(address,uint256,uint256)\":[{\"params\":{\"appContract\":\"The application contract address\",\"inputLength\":\"The input length\",\"maxInputLength\":\"The maximum input length\"}}]},\"events\":{\"InputAdded(address,uint256,bytes)\":{\"params\":{\"appContract\":\"The application contract address\",\"index\":\"The input index\",\"input\":\"The input blob\"}}},\"kind\":\"dev\",\"methods\":{\"addInput(address,bytes)\":{\"details\":\"MUST fire an `InputAdded` event.\",\"params\":{\"appContract\":\"The application contract address\",\"payload\":\"The input payload\"},\"returns\":{\"_0\":\"The hash of the input blob\"}},\"getInputHash(address,uint256)\":{\"details\":\"The provided index must be valid.\",\"params\":{\"appContract\":\"The application contract address\",\"index\":\"The input index\"}},\"getNumberOfInputs(address)\":{\"params\":{\"appContract\":\"The application contract address\"}}},\"version\":1},\"userdoc\":{\"errors\":{\"InputTooLarge(address,uint256,uint256)\":[{\"notice\":\"Input is too large.\"}]},\"events\":{\"InputAdded(address,uint256,bytes)\":{\"notice\":\"MUST trigger when an input is added.\"}},\"kind\":\"user\",\"methods\":{\"addInput(address,bytes)\":{\"notice\":\"Send an input to an application.\"},\"getInputHash(address,uint256)\":{\"notice\":\"Get the hash of an input in an application's input box.\"},\"getNumberOfInputs(address)\":{\"notice\":\"Get the number of inputs sent to an application.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/inputs/InputBox.sol\":\"InputBox\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/common/CanonicalMachine.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @title Canonical Machine Constants Library\\n///\\n/// @notice Defines several constants related to the reference implementation\\n/// of the RISC-V machine that runs Linux, also known as the \\\"Cartesi Machine\\\".\\nlibrary CanonicalMachine {\\n /// @notice Maximum input size (2 megabytes).\\n uint256 constant INPUT_MAX_SIZE = 1 << 21;\\n\\n /// @notice Log2 of maximum number of outputs.\\n uint256 constant LOG2_MAX_OUTPUTS = 63;\\n}\\n\",\"keccak256\":\"0xd433ed779b77fa74a86514a17eb76c9d4f250c5506a223541eb12963192d7ce0\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/common/Inputs.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @title Inputs\\n/// @notice Defines the signatures of inputs.\\ninterface Inputs {\\n /// @notice An advance request from an EVM-compatible blockchain to a Cartesi Machine.\\n /// @param chainId The chain ID\\n /// @param appContract The application contract address\\n /// @param msgSender The address of whoever sent the input\\n /// @param blockNumber The number of the block in which the input was added\\n /// @param blockTimestamp The timestamp of the block in which the input was added\\n /// @param prevRandao The latest RANDAO mix of the post beacon state of the previous block\\n /// @param index The index of the input in the input box\\n /// @param payload The payload provided by the message sender\\n /// @dev See EIP-4399 for safe usage of `prevRandao`.\\n function EvmAdvance(\\n uint256 chainId,\\n address appContract,\\n address msgSender,\\n uint256 blockNumber,\\n uint256 blockTimestamp,\\n uint256 prevRandao,\\n uint256 index,\\n bytes calldata payload\\n ) external;\\n}\\n\",\"keccak256\":\"0x7aecef1d525512ceb9daa886f8c4488e8221941ec928a0319827e50491eae053\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/IInputBox.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @notice Provides data availability of inputs for applications.\\n/// @notice Each application has its own append-only list of inputs.\\n/// @notice Off-chain, inputs can be retrieved via events.\\n/// @notice On-chain, only the input hashes are stored.\\n/// @notice See `LibInput` for more details on how such hashes are computed.\\ninterface IInputBox {\\n /// @notice MUST trigger when an input is added.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @param input The input blob\\n event InputAdded(\\n address indexed appContract,\\n uint256 indexed index,\\n bytes input\\n );\\n\\n /// @notice Input is too large.\\n /// @param appContract The application contract address\\n /// @param inputLength The input length\\n /// @param maxInputLength The maximum input length\\n error InputTooLarge(\\n address appContract,\\n uint256 inputLength,\\n uint256 maxInputLength\\n );\\n\\n /// @notice Send an input to an application.\\n /// @param appContract The application contract address\\n /// @param payload The input payload\\n /// @return The hash of the input blob\\n /// @dev MUST fire an `InputAdded` event.\\n function addInput(\\n address appContract,\\n bytes calldata payload\\n ) external returns (bytes32);\\n\\n /// @notice Get the number of inputs sent to an application.\\n /// @param appContract The application contract address\\n function getNumberOfInputs(\\n address appContract\\n ) external view returns (uint256);\\n\\n /// @notice Get the hash of an input in an application's input box.\\n /// @param appContract The application contract address\\n /// @param index The input index\\n /// @dev The provided index must be valid.\\n function getInputHash(\\n address appContract,\\n uint256 index\\n ) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xae7730cd7ab2b31a86d7c4933215853ea6c0b1b4dc60d4ec24e5cfc2ec005fe3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/inputs/InputBox.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.18;\\n\\nimport {IInputBox} from \\\"./IInputBox.sol\\\";\\nimport {CanonicalMachine} from \\\"../common/CanonicalMachine.sol\\\";\\nimport {Inputs} from \\\"../common/Inputs.sol\\\";\\n\\ncontract InputBox is IInputBox {\\n /// @notice Mapping of application contract addresses to arrays of input hashes.\\n mapping(address => bytes32[]) private _inputBoxes;\\n\\n /// @inheritdoc IInputBox\\n function addInput(\\n address appContract,\\n bytes calldata payload\\n ) external override returns (bytes32) {\\n bytes32[] storage inputBox = _inputBoxes[appContract];\\n\\n uint256 index = inputBox.length;\\n\\n bytes memory input = abi.encodeCall(\\n Inputs.EvmAdvance,\\n (\\n block.chainid,\\n appContract,\\n msg.sender,\\n block.number,\\n block.timestamp,\\n block.prevrandao,\\n index,\\n payload\\n )\\n );\\n\\n if (input.length > CanonicalMachine.INPUT_MAX_SIZE) {\\n revert InputTooLarge(\\n appContract,\\n input.length,\\n CanonicalMachine.INPUT_MAX_SIZE\\n );\\n }\\n\\n bytes32 inputHash = keccak256(input);\\n\\n inputBox.push(inputHash);\\n\\n emit InputAdded(appContract, index, input);\\n\\n return inputHash;\\n }\\n\\n /// @inheritdoc IInputBox\\n function getNumberOfInputs(\\n address appContract\\n ) external view override returns (uint256) {\\n return _inputBoxes[appContract].length;\\n }\\n\\n /// @inheritdoc IInputBox\\n function getInputHash(\\n address appContract,\\n uint256 index\\n ) external view override returns (bytes32) {\\n return _inputBoxes[appContract][index];\\n }\\n}\\n\",\"keccak256\":\"0x635160a90d6dcb47dc6f697093f7b1349621f1a7914b050f70d1983d7f67627e\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b50610404806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80631789cd631461004657806361a93c871461006b578063677087c914610094575b600080fd5b610059610054366004610226565b6100a7565b60405190815260200160405180910390f35b6100596100793660046102a9565b6001600160a01b031660009081526020819052604090205490565b6100596100a23660046102cb565b6101cd565b6001600160a01b0383166000908152602081905260408082208054915190919083906100e79046908990339043904290449089908e908e906024016102f5565b60408051601f198184030181529190526020810180516001600160e01b031663415bf36360e01b179052805190915062200000101561015b5780516040516304f90dc560e51b81526001600160a01b0389166004820152602481019190915262200000604482015260640160405180910390fd5b8051602080830191909120845460018101865560008681529290922090910181905560405183906001600160a01b038a16907fc05d337121a6e8605c6ec0b72aa29c4210ffe6e5b9cefdd6a7058188a8f66f98906101ba908690610369565b60405180910390a3979650505050505050565b6001600160a01b03821660009081526020819052604081208054839081106101f7576101f76103b8565b9060005260206000200154905092915050565b80356001600160a01b038116811461022157600080fd5b919050565b60008060006040848603121561023b57600080fd5b6102448461020a565b9250602084013567ffffffffffffffff8082111561026157600080fd5b818601915086601f83011261027557600080fd5b81358181111561028457600080fd5b87602082850101111561029657600080fd5b6020830194508093505050509250925092565b6000602082840312156102bb57600080fd5b6102c48261020a565b9392505050565b600080604083850312156102de57600080fd5b6102e78361020a565b946020939093013593505050565b8981526001600160a01b03898116602083015288166040820152606081018790526080810186905260a0810185905260c0810184905261010060e08201819052810182905260006101208385828501376000838501820152601f909301601f19169091019091019998505050505050505050565b60006020808352835180602085015260005b818110156103975785810183015185820160400152820161037b565b506000604082860101526040601f19601f8301168501019250505092915050565b634e487b7160e01b600052603260045260246000fdfea26469706673582212203788fdfb8b6a2c0572bcd866dab8de747866dc2030920f38cce6fb32a7b57abc64736f6c63430008170033", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80631789cd631461004657806361a93c871461006b578063677087c914610094575b600080fd5b610059610054366004610226565b6100a7565b60405190815260200160405180910390f35b6100596100793660046102a9565b6001600160a01b031660009081526020819052604090205490565b6100596100a23660046102cb565b6101cd565b6001600160a01b0383166000908152602081905260408082208054915190919083906100e79046908990339043904290449089908e908e906024016102f5565b60408051601f198184030181529190526020810180516001600160e01b031663415bf36360e01b179052805190915062200000101561015b5780516040516304f90dc560e51b81526001600160a01b0389166004820152602481019190915262200000604482015260640160405180910390fd5b8051602080830191909120845460018101865560008681529290922090910181905560405183906001600160a01b038a16907fc05d337121a6e8605c6ec0b72aa29c4210ffe6e5b9cefdd6a7058188a8f66f98906101ba908690610369565b60405180910390a3979650505050505050565b6001600160a01b03821660009081526020819052604081208054839081106101f7576101f76103b8565b9060005260206000200154905092915050565b80356001600160a01b038116811461022157600080fd5b919050565b60008060006040848603121561023b57600080fd5b6102448461020a565b9250602084013567ffffffffffffffff8082111561026157600080fd5b818601915086601f83011261027557600080fd5b81358181111561028457600080fd5b87602082850101111561029657600080fd5b6020830194508093505050509250925092565b6000602082840312156102bb57600080fd5b6102c48261020a565b9392505050565b600080604083850312156102de57600080fd5b6102e78361020a565b946020939093013593505050565b8981526001600160a01b03898116602083015288166040820152606081018790526080810186905260a0810185905260c0810184905261010060e08201819052810182905260006101208385828501376000838501820152601f909301601f19169091019091019998505050505050505050565b60006020808352835180602085015260005b818110156103975785810183015185820160400152820161037b565b506000604082860101526040601f19601f8301168501019250505092915050565b634e487b7160e01b600052603260045260246000fdfea26469706673582212203788fdfb8b6a2c0572bcd866dab8de747866dc2030920f38cce6fb32a7b57abc64736f6c63430008170033", @@ -199,7 +215,7 @@ "storageLayout": { "storage": [ { - "astId": 3773, + "astId": 3594, "contract": "contracts/inputs/InputBox.sol:InputBox", "label": "_inputBoxes", "offset": 0, diff --git a/deployments/sepolia/QuorumFactory.json b/deployments/sepolia/QuorumFactory.json index a9388c71..44e9089a 100644 --- a/deployments/sepolia/QuorumFactory.json +++ b/deployments/sepolia/QuorumFactory.json @@ -97,9 +97,25 @@ "type": "function" } ], + "transactionHash": "0x55e2aba0d58418dee2a8aa0b9ed7987bf68a425edf0123329cd01410f4148173", + "receipt": { + "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + "from": "0xeA4037a524309056545fbAd9A688f449E7e05ffB", + "contractAddress": null, + "transactionIndex": 20, + "gasUsed": "747585", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xe207835cf5a874030118c49318edeab1018f4670774fd7770d586aa169a0e6c8", + "transactionHash": "0x55e2aba0d58418dee2a8aa0b9ed7987bf68a425edf0123329cd01410f4148173", + "logs": [], + "blockNumber": 6850942, + "cumulativeGasUsed": "5170571", + "status": 1, + "byzantium": true + }, "args": [], - "numDeployments": 1, - "solcInputHash": "3f90f7284d022e9cc827655f4d93f4f9", + "numDeployments": 2, + "solcInputHash": "3277ebc53d2ec4c7847e5faa9f9b26b3", "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract IQuorum\",\"name\":\"quorum\",\"type\":\"address\"}],\"name\":\"QuorumCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"validators\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"epochLength\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"}],\"name\":\"calculateQuorumAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"validators\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"epochLength\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"}],\"name\":\"newQuorum\",\"outputs\":[{\"internalType\":\"contract IQuorum\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"validators\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"epochLength\",\"type\":\"uint256\"}],\"name\":\"newQuorum\",\"outputs\":[{\"internalType\":\"contract IQuorum\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"QuorumCreated(address)\":{\"details\":\"MUST be triggered on a successful call to `newQuorum`.\",\"params\":{\"quorum\":\"The quorum\"}}},\"kind\":\"dev\",\"methods\":{\"calculateQuorumAddress(address[],uint256,bytes32)\":{\"details\":\"Beware that only the `newQuorum` function with the `salt` parameter is able to deterministically deploy a quorum.\",\"params\":{\"epochLength\":\"The epoch length\",\"salt\":\"The salt used to deterministically generate the quorum address\",\"validators\":\"the list of validators\"},\"returns\":{\"_0\":\"The deterministic quorum address\"}},\"newQuorum(address[],uint256)\":{\"details\":\"On success, MUST emit a `QuorumCreated` event.Duplicates in the `validators` array are ignored.Reverts if the epoch length is zero.\",\"params\":{\"epochLength\":\"The epoch length\",\"validators\":\"the list of validators\"},\"returns\":{\"_0\":\"The quorum\"}},\"newQuorum(address[],uint256,bytes32)\":{\"details\":\"On success, MUST emit a `QuorumCreated` event.Duplicates in the `validators` array are ignored.Reverts if the epoch length is zero.\",\"params\":{\"epochLength\":\"The epoch length\",\"salt\":\"The salt used to deterministically generate the quorum address\",\"validators\":\"the list of validators\"},\"returns\":{\"_0\":\"The quorum\"}}},\"title\":\"Quorum Factory\",\"version\":1},\"userdoc\":{\"events\":{\"QuorumCreated(address)\":{\"notice\":\"A new quorum was deployed.\"}},\"kind\":\"user\",\"methods\":{\"calculateQuorumAddress(address[],uint256,bytes32)\":{\"notice\":\"Calculate the address of a quorum to be deployed deterministically.\"},\"newQuorum(address[],uint256)\":{\"notice\":\"Deploy a new quorum.\"},\"newQuorum(address[],uint256,bytes32)\":{\"notice\":\"Deploy a new quorum deterministically.\"}},\"notice\":\"Allows anyone to reliably deploy a new `IQuorum` contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/consensus/quorum/QuorumFactory.sol\":\"QuorumFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Not enough balance for performing a CREATE2 deploy.\\n */\\n error Create2InsufficientBalance(uint256 balance, uint256 needed);\\n\\n /**\\n * @dev There's no code to deploy.\\n */\\n error Create2EmptyBytecode();\\n\\n /**\\n * @dev The deployment failed.\\n */\\n error Create2FailedDeployment();\\n\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\\n if (address(this).balance < amount) {\\n revert Create2InsufficientBalance(address(this).balance, amount);\\n }\\n if (bytecode.length == 0) {\\n revert Create2EmptyBytecode();\\n }\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n if (addr == address(0)) {\\n revert Create2FailedDeployment();\\n }\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2b9807d194b92f1068d868e9587d27037264a9a067c778486f86ae21c61cbd5e\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/structs/BitMaps.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/BitMaps.sol)\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Library for managing uint256 to bool mapping in a compact and efficient way, provided the keys are sequential.\\n * Largely inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor].\\n *\\n * BitMaps pack 256 booleans across each bit of a single 256-bit slot of `uint256` type.\\n * Hence booleans corresponding to 256 _sequential_ indices would only consume a single slot,\\n * unlike the regular `bool` which would consume an entire slot for a single value.\\n *\\n * This results in gas savings in two ways:\\n *\\n * - Setting a zero value to non-zero only once every 256 times\\n * - Accessing the same warm slot for every 256 _sequential_ indices\\n */\\nlibrary BitMaps {\\n struct BitMap {\\n mapping(uint256 bucket => uint256) _data;\\n }\\n\\n /**\\n * @dev Returns whether the bit at `index` is set.\\n */\\n function get(BitMap storage bitmap, uint256 index) internal view returns (bool) {\\n uint256 bucket = index >> 8;\\n uint256 mask = 1 << (index & 0xff);\\n return bitmap._data[bucket] & mask != 0;\\n }\\n\\n /**\\n * @dev Sets the bit at `index` to the boolean `value`.\\n */\\n function setTo(BitMap storage bitmap, uint256 index, bool value) internal {\\n if (value) {\\n set(bitmap, index);\\n } else {\\n unset(bitmap, index);\\n }\\n }\\n\\n /**\\n * @dev Sets the bit at `index`.\\n */\\n function set(BitMap storage bitmap, uint256 index) internal {\\n uint256 bucket = index >> 8;\\n uint256 mask = 1 << (index & 0xff);\\n bitmap._data[bucket] |= mask;\\n }\\n\\n /**\\n * @dev Unsets the bit at `index`.\\n */\\n function unset(BitMap storage bitmap, uint256 index) internal {\\n uint256 bucket = index >> 8;\\n uint256 mask = 1 << (index & 0xff);\\n bitmap._data[bucket] &= ~mask;\\n }\\n}\\n\",\"keccak256\":\"0x3616f1b0d0a9ee1ca8f0953ecaceb9230e36f691c7974d30f964212acff52d2b\",\"license\":\"MIT\"},\"contracts/consensus/AbstractConsensus.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IConsensus} from \\\"./IConsensus.sol\\\";\\n\\n/// @notice Stores accepted claims for several applications.\\n/// @dev This contract was designed to be inherited by implementations of the `IConsensus` interface\\n/// that only need a simple mechanism of storage and retrieval of accepted claims.\\nabstract contract AbstractConsensus is IConsensus {\\n /// @notice The epoch length\\n uint256 private immutable _epochLength;\\n\\n /// @notice Indexes accepted claims by application contract address.\\n mapping(address => mapping(bytes32 => bool)) private _acceptedClaims;\\n\\n /// @param epochLength The epoch length\\n /// @dev Reverts if the epoch length is zero.\\n constructor(uint256 epochLength) {\\n require(epochLength > 0, \\\"epoch length must not be zero\\\");\\n _epochLength = epochLength;\\n }\\n\\n /// @inheritdoc IConsensus\\n function wasClaimAccepted(\\n address appContract,\\n bytes32 claim\\n ) public view override returns (bool) {\\n return _acceptedClaims[appContract][claim];\\n }\\n\\n /// @inheritdoc IConsensus\\n function getEpochLength() public view override returns (uint256) {\\n return _epochLength;\\n }\\n\\n /// @notice Accept a claim.\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The output Merkle root hash\\n /// @dev Emits a `ClaimAcceptance` event.\\n function _acceptClaim(\\n address appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n ) internal {\\n _acceptedClaims[appContract][claim] = true;\\n emit ClaimAcceptance(appContract, lastProcessedBlockNumber, claim);\\n }\\n}\\n\",\"keccak256\":\"0x8d94096a285a068e53dfa65f26d4aa8549c3edf0d80e1b3f4322a2df69e141b7\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/IConsensus.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\n/// @notice Each application has its own stream of inputs.\\n/// See the `IInputBox` interface for calldata-based on-chain data availability.\\n/// @notice When an input is fed to the application, it may yield several outputs.\\n/// @notice Since genesis, a Merkle tree of all outputs ever produced is maintained\\n/// both inside and outside the Cartesi Machine.\\n/// @notice The claim that validators may submit to the consensus contract\\n/// is the root of this Merkle tree after processing all base layer blocks until some height.\\n/// @notice A validator should be able to save transaction fees by not submitting a claim if it was...\\n/// - already submitted by the validator (see the `ClaimSubmission` event) or;\\n/// - already accepted by the consensus (see the `ClaimAcceptance` event).\\n/// @notice The acceptance criteria for claims may depend on the type of consensus, and is not specified by this interface.\\n/// For example, a claim may be accepted if it was...\\n/// - submitted by an authority or;\\n/// - submitted by the majority of a quorum or;\\n/// - submitted and not proven wrong after some period of time or;\\n/// - submitted and proven correct through an on-chain tournament.\\ninterface IConsensus {\\n /// @notice MUST trigger when a claim is submitted.\\n /// @param submitter The submitter address\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The root of the Merkle tree of outputs\\n event ClaimSubmission(\\n address indexed submitter,\\n address indexed appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n );\\n\\n /// @notice MUST trigger when a claim is accepted.\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The root of the Merkle tree of outputs\\n event ClaimAcceptance(\\n address indexed appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n );\\n\\n /// @notice Submit a claim to the consensus.\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The root of the Merkle tree of outputs\\n /// @dev MUST fire a `ClaimSubmission` event.\\n /// @dev MAY fire a `ClaimAcceptance` event, if the acceptance criteria is met.\\n function submitClaim(\\n address appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n ) external;\\n\\n /// @notice Check if an output Merkle root hash was ever accepted by the consensus\\n /// for a particular application.\\n /// @param appContract The application contract address\\n /// @param claim The root of the Merkle tree of outputs\\n function wasClaimAccepted(\\n address appContract,\\n bytes32 claim\\n ) external view returns (bool);\\n\\n /// @notice Get the epoch length, in number of base layer blocks.\\n /// @dev The epoch number of a block is defined as\\n /// the integer division of the block number by the epoch length.\\n function getEpochLength() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x33ef3c4e213b2a3489b37d5ef553dc1165c598c56beb0ed8290723a5c74d821c\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/quorum/IQuorum.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IConsensus} from \\\"../IConsensus.sol\\\";\\n\\n/// @notice A consensus model controlled by a small, immutable set of `n` validators.\\n/// @notice You can know the value of `n` by calling the `numOfValidators` function.\\n/// @notice Upon construction, each validator is assigned a unique number between 1 and `n`.\\n/// These numbers are used internally instead of addresses for gas optimization reasons.\\n/// @notice You can list the validators in the quorum by calling the `validatorById`\\n/// function for each ID from 1 to `n`.\\ninterface IQuorum is IConsensus {\\n /// @notice Get the number of validators.\\n function numOfValidators() external view returns (uint256);\\n\\n /// @notice Get the ID of a validator.\\n /// @param validator The validator address\\n /// @dev Validators have IDs greater than zero.\\n /// @dev Non-validators are assigned to ID zero.\\n function validatorId(address validator) external view returns (uint256);\\n\\n /// @notice Get the address of a validator by its ID.\\n /// @param id The validator ID\\n /// @dev Validator IDs range from 1 to `N`, the total number of validators.\\n /// @dev Invalid IDs map to address zero.\\n function validatorById(uint256 id) external view returns (address);\\n\\n /// @notice Get the number of validators in favor of a claim.\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The output Merkle root hash\\n /// @return Number of validators in favor of claim\\n function numOfValidatorsInFavorOf(\\n address appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n ) external view returns (uint256);\\n\\n /// @notice Check whether a validator is in favor of a claim.\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The output Merkle root hash\\n /// @param id The ID of the validator\\n /// @return Whether validator is in favor of claim\\n /// @dev Assumes the provided ID is valid.\\n function isValidatorInFavorOf(\\n address appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim,\\n uint256 id\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x16194cde8b5d9f4cc290f84a9e812c5722217b3ef8c6aa45155ab136ec23e5e3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/quorum/IQuorumFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {IQuorum} from \\\"./IQuorum.sol\\\";\\n\\n/// @title Quorum Factory interface\\ninterface IQuorumFactory {\\n // Events\\n\\n /// @notice A new quorum was deployed.\\n /// @param quorum The quorum\\n /// @dev MUST be triggered on a successful call to `newQuorum`.\\n event QuorumCreated(IQuorum quorum);\\n\\n // Permissionless functions\\n\\n /// @notice Deploy a new quorum.\\n /// @param validators the list of validators\\n /// @param epochLength The epoch length\\n /// @return The quorum\\n /// @dev On success, MUST emit a `QuorumCreated` event.\\n /// @dev Duplicates in the `validators` array are ignored.\\n /// @dev Reverts if the epoch length is zero.\\n function newQuorum(\\n address[] calldata validators,\\n uint256 epochLength\\n ) external returns (IQuorum);\\n\\n /// @notice Deploy a new quorum deterministically.\\n /// @param validators the list of validators\\n /// @param epochLength The epoch length\\n /// @param salt The salt used to deterministically generate the quorum address\\n /// @return The quorum\\n /// @dev On success, MUST emit a `QuorumCreated` event.\\n /// @dev Duplicates in the `validators` array are ignored.\\n /// @dev Reverts if the epoch length is zero.\\n function newQuorum(\\n address[] calldata validators,\\n uint256 epochLength,\\n bytes32 salt\\n ) external returns (IQuorum);\\n\\n /// @notice Calculate the address of a quorum to be deployed deterministically.\\n /// @param validators the list of validators\\n /// @param epochLength The epoch length\\n /// @param salt The salt used to deterministically generate the quorum address\\n /// @return The deterministic quorum address\\n /// @dev Beware that only the `newQuorum` function with the `salt` parameter\\n /// is able to deterministically deploy a quorum.\\n function calculateQuorumAddress(\\n address[] calldata validators,\\n uint256 epochLength,\\n bytes32 salt\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0xada5bfce326546f17f2b5a963864190e43ca92eb4776f3a7228b198fcae9aac3\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/quorum/Quorum.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {BitMaps} from \\\"@openzeppelin/contracts/utils/structs/BitMaps.sol\\\";\\n\\nimport {IQuorum} from \\\"./IQuorum.sol\\\";\\nimport {AbstractConsensus} from \\\"../AbstractConsensus.sol\\\";\\n\\ncontract Quorum is IQuorum, AbstractConsensus {\\n using BitMaps for BitMaps.BitMap;\\n\\n /// @notice The total number of validators.\\n /// @notice See the `numOfValidators` function.\\n uint256 private immutable _numOfValidators;\\n\\n /// @notice Validator IDs indexed by address.\\n /// @notice See the `validatorId` function.\\n /// @dev Non-validators are assigned to ID zero.\\n /// @dev Validators have IDs greater than zero.\\n mapping(address => uint256) private _validatorId;\\n\\n /// @notice Validator addresses indexed by ID.\\n /// @notice See the `validatorById` function.\\n /// @dev Invalid IDs map to address zero.\\n mapping(uint256 => address) private _validatorById;\\n\\n /// @notice Votes in favor of a particular claim.\\n /// @param inFavorCount The number of validators in favor of the claim\\n /// @param inFavorById The set of validators in favor of the claim\\n /// @dev `inFavorById` is a bitmap indexed by validator IDs.\\n struct Votes {\\n uint256 inFavorCount;\\n BitMaps.BitMap inFavorById;\\n }\\n\\n /// @notice Votes indexed by application contract address,\\n /// last processed block number and claim.\\n /// @dev See the `numOfValidatorsInFavorOf` and `isValidatorInFavorOf` functions.\\n mapping(address => mapping(uint256 => mapping(bytes32 => Votes)))\\n private _votes;\\n\\n /// @param validators The array of validator addresses\\n /// @param epochLength The epoch length\\n /// @dev Duplicates in the `validators` array are ignored.\\n /// @dev Reverts if the epoch length is zero.\\n constructor(\\n address[] memory validators,\\n uint256 epochLength\\n ) AbstractConsensus(epochLength) {\\n uint256 n;\\n for (uint256 i; i < validators.length; ++i) {\\n address validator = validators[i];\\n if (_validatorId[validator] == 0) {\\n uint256 id = ++n;\\n _validatorId[validator] = id;\\n _validatorById[id] = validator;\\n }\\n }\\n _numOfValidators = n;\\n }\\n\\n function submitClaim(\\n address appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n ) external override {\\n uint256 id = _validatorId[msg.sender];\\n require(id > 0, \\\"Quorum: caller is not validator\\\");\\n\\n emit ClaimSubmission(\\n msg.sender,\\n appContract,\\n lastProcessedBlockNumber,\\n claim\\n );\\n\\n Votes storage votes = _getVotes(\\n appContract,\\n lastProcessedBlockNumber,\\n claim\\n );\\n\\n if (!votes.inFavorById.get(id)) {\\n votes.inFavorById.set(id);\\n if (++votes.inFavorCount == 1 + _numOfValidators / 2) {\\n _acceptClaim(appContract, lastProcessedBlockNumber, claim);\\n }\\n }\\n }\\n\\n function numOfValidators() external view override returns (uint256) {\\n return _numOfValidators;\\n }\\n\\n function validatorId(\\n address validator\\n ) external view override returns (uint256) {\\n return _validatorId[validator];\\n }\\n\\n function validatorById(\\n uint256 id\\n ) external view override returns (address) {\\n return _validatorById[id];\\n }\\n\\n function numOfValidatorsInFavorOf(\\n address appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n ) external view override returns (uint256) {\\n return\\n _getVotes(appContract, lastProcessedBlockNumber, claim)\\n .inFavorCount;\\n }\\n\\n function isValidatorInFavorOf(\\n address appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim,\\n uint256 id\\n ) external view override returns (bool) {\\n return\\n _getVotes(appContract, lastProcessedBlockNumber, claim)\\n .inFavorById\\n .get(id);\\n }\\n\\n /// @notice Get a `Votes` structure from storage from a given claim.\\n /// @param appContract The application contract address\\n /// @param lastProcessedBlockNumber The number of the last processed block\\n /// @param claim The output Merkle root hash\\n /// @return The `Votes` structure related to a given claim\\n function _getVotes(\\n address appContract,\\n uint256 lastProcessedBlockNumber,\\n bytes32 claim\\n ) internal view returns (Votes storage) {\\n return _votes[appContract][lastProcessedBlockNumber][claim];\\n }\\n}\\n\",\"keccak256\":\"0x4e850dc37778ce8cd0017f81decc6cdd40492de6e221c1d2cdfc4c2762252367\",\"license\":\"Apache-2.0 (see LICENSE)\"},\"contracts/consensus/quorum/QuorumFactory.sol\":{\"content\":\"// (c) Cartesi and individual authors (see AUTHORS)\\n// SPDX-License-Identifier: Apache-2.0 (see LICENSE)\\n\\npragma solidity ^0.8.8;\\n\\nimport {Create2} from \\\"@openzeppelin/contracts/utils/Create2.sol\\\";\\n\\nimport {IQuorumFactory} from \\\"./IQuorumFactory.sol\\\";\\nimport {IQuorum} from \\\"./IQuorum.sol\\\";\\nimport {Quorum} from \\\"./Quorum.sol\\\";\\n\\n/// @title Quorum Factory\\n/// @notice Allows anyone to reliably deploy a new `IQuorum` contract.\\ncontract QuorumFactory is IQuorumFactory {\\n function newQuorum(\\n address[] calldata validators,\\n uint256 epochLength\\n ) external override returns (IQuorum) {\\n IQuorum quorum = new Quorum(validators, epochLength);\\n\\n emit QuorumCreated(quorum);\\n\\n return quorum;\\n }\\n\\n function newQuorum(\\n address[] calldata validators,\\n uint256 epochLength,\\n bytes32 salt\\n ) external override returns (IQuorum) {\\n IQuorum quorum = new Quorum{salt: salt}(validators, epochLength);\\n\\n emit QuorumCreated(quorum);\\n\\n return quorum;\\n }\\n\\n function calculateQuorumAddress(\\n address[] calldata validators,\\n uint256 epochLength,\\n bytes32 salt\\n ) external view override returns (address) {\\n return\\n Create2.computeAddress(\\n salt,\\n keccak256(\\n abi.encodePacked(\\n type(Quorum).creationCode,\\n abi.encode(validators, epochLength)\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x515c9f35a19239c71437e975ab8e57e87790b55ab650f3d6ee039b6b47d49932\",\"license\":\"Apache-2.0 (see LICENSE)\"}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b50610c90806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80632f74f86214610046578063ca8f271c14610075578063d4af3bc814610088575b600080fd5b6100596100543660046102bb565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b6100596100833660046102bb565b610123565b61005961009636600461030c565b6101a2565b600080828686866040516100ae90610262565b6100ba93929190610358565b8190604051809103906000f59050801580156100da573d6000803e3d6000fd5b506040516001600160a01b03821681529091507f446698b70271bce331e53210572bd37ac8c590b6cdca2e6763e6448243cba8029060200160405180910390a195945050505050565b6000610199826040518060200161013990610262565b601f1982820381018352601f90910116604081905261016090899089908990602001610358565b60408051601f198184030181529082905261017e92916020016103e4565b60405160208183030381529060405280519060200120610224565b95945050505050565b6000808484846040516101b490610262565b6101c093929190610358565b604051809103906000f0801580156101dc573d6000803e3d6000fd5b506040516001600160a01b03821681529091507f446698b70271bce331e53210572bd37ac8c590b6cdca2e6763e6448243cba8029060200160405180910390a1949350505050565b6000610231838330610238565b9392505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b6108598061040283390190565b60008083601f84011261028157600080fd5b50813567ffffffffffffffff81111561029957600080fd5b6020830191508360208260051b85010111156102b457600080fd5b9250929050565b600080600080606085870312156102d157600080fd5b843567ffffffffffffffff8111156102e857600080fd5b6102f48782880161026f565b90989097506020870135966040013595509350505050565b60008060006040848603121561032157600080fd5b833567ffffffffffffffff81111561033857600080fd5b6103448682870161026f565b909790965060209590950135949350505050565b604080825281018390526000846060830182805b878110156103a05783356001600160a01b03811680821461038b578384fd5b8452506020938401939092019160010161036c565b505060209390930193909352509392505050565b6000815160005b818110156103d557602081850181015186830152016103bb565b50600093019283525090919050565b60006103f96103f383866103b4565b846103b4565b94935050505056fe60c060405234801561001057600080fd5b5060405161085938038061085983398101604081905261002f9161016e565b80600081116100845760405162461bcd60e51b815260206004820152601d60248201527f65706f6368206c656e677468206d757374206e6f74206265207a65726f000000604482015260640160405180910390fd5b6080526000805b83518110156101305760008482815181106100a8576100a861023a565b6020026020010151905060016000826001600160a01b03166001600160a01b03168152602001908152602001600020546000036101275760006100ea84610250565b6001600160a01b03831660008181526001602090815260408083208590558483526002909152902080546001600160a01b03191690911790559350505b5060010161008b565b5060a052506102779050565b634e487b7160e01b600052604160045260246000fd5b80516001600160a01b038116811461016957600080fd5b919050565b6000806040838503121561018157600080fd5b82516001600160401b038082111561019857600080fd5b818501915085601f8301126101ac57600080fd5b81516020828211156101c0576101c061013c565b8160051b604051601f19603f830116810181811086821117156101e5576101e561013c565b60405292835281830193508481018201928984111561020357600080fd5b948201945b838610156102285761021986610152565b85529482019493820193610208565b97909101519698969750505050505050565b634e487b7160e01b600052603260045260246000fd5b60006001820161027057634e487b7160e01b600052601160045260246000fd5b5060010190565b60805160a0516105b66102a36000396000818161010c01526102f70152600061019001526105b66000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c80636470af001161005b5780636470af00146101535780637051bfd5146101685780639618f35b1461017b578063cfe8a73b1461018e57600080fd5b80630a6f1fe81461008d5780631c45396a146100c95780631e526e451461010a5780634b84231c14610130575b600080fd5b6100b661009b36600461044b565b6001600160a01b031660009081526001602052604090205490565b6040519081526020015b60405180910390f35b6100f26100d736600461046d565b6000908152600260205260409020546001600160a01b031690565b6040516001600160a01b0390911681526020016100c0565b7f00000000000000000000000000000000000000000000000000000000000000006100b6565b61014361013e366004610486565b6101b4565b60405190151581526020016100c0565b6101666101613660046104bf565b6101f1565b005b6100b66101763660046104bf565b610353565b6101436101893660046104f2565b610369565b7f00000000000000000000000000000000000000000000000000000000000000006100b6565b60006101e8826101c5878787610395565b600882901c60009081526001918201602052604090205460ff9092161b16151590565b95945050505050565b33600090815260016020526040902054806102525760405162461bcd60e51b815260206004820152601f60248201527f51756f72756d3a2063616c6c6572206973206e6f742076616c696461746f7200604482015260640160405180910390fd5b60408051848152602081018490526001600160a01b0386169133917ff5a28e07a1b89d1ca3f9a2a7ef16bd650503a4791baf2e70dc401c21ee505f0a910160405180910390a360006102a5858585610395565b600883901c6000908152600180830160205260409091205491925060ff84161b1661034c57600882901c600090815260018281016020526040909120805460ff85169290921b909117905561031b60027f0000000000000000000000000000000000000000000000000000000000000000610532565b610326906001610554565b816000016000815461033790610567565b91829055500361034c5761034c8585856103c7565b5050505050565b6000610360848484610395565b54949350505050565b6001600160a01b03821660009081526020818152604080832084845290915290205460ff165b92915050565b6001600160a01b0383166000908152600360209081526040808320858452825280832084845290915290209392505050565b6001600160a01b038316600081815260208181526040808320858452825291829020805460ff1916600117905581518581529081018490527fd3e4892959c6ddb27e02bcaaebc0c1898d0f677b7360bf80339f10a8717957d3910160405180910390a2505050565b80356001600160a01b038116811461044657600080fd5b919050565b60006020828403121561045d57600080fd5b6104668261042f565b9392505050565b60006020828403121561047f57600080fd5b5035919050565b6000806000806080858703121561049c57600080fd5b6104a58561042f565b966020860135965060408601359560600135945092505050565b6000806000606084860312156104d457600080fd5b6104dd8461042f565b95602085013595506040909401359392505050565b6000806040838503121561050557600080fd5b61050e8361042f565b946020939093013593505050565b634e487b7160e01b600052601160045260246000fd5b60008261054f57634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561038f5761038f61051c565b6000600182016105795761057961051c565b506001019056fea2646970667358221220642bb94e1d4dd60f0c8a41a3a000c90390997995461f65183db6e55f56e5032864736f6c63430008170033a264697066735822122056fc82af8dbf74e096ba755e657baedd2a8684ccc11e63a53a44d8ceb691249e64736f6c63430008170033", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80632f74f86214610046578063ca8f271c14610075578063d4af3bc814610088575b600080fd5b6100596100543660046102bb565b61009b565b6040516001600160a01b03909116815260200160405180910390f35b6100596100833660046102bb565b610123565b61005961009636600461030c565b6101a2565b600080828686866040516100ae90610262565b6100ba93929190610358565b8190604051809103906000f59050801580156100da573d6000803e3d6000fd5b506040516001600160a01b03821681529091507f446698b70271bce331e53210572bd37ac8c590b6cdca2e6763e6448243cba8029060200160405180910390a195945050505050565b6000610199826040518060200161013990610262565b601f1982820381018352601f90910116604081905261016090899089908990602001610358565b60408051601f198184030181529082905261017e92916020016103e4565b60405160208183030381529060405280519060200120610224565b95945050505050565b6000808484846040516101b490610262565b6101c093929190610358565b604051809103906000f0801580156101dc573d6000803e3d6000fd5b506040516001600160a01b03821681529091507f446698b70271bce331e53210572bd37ac8c590b6cdca2e6763e6448243cba8029060200160405180910390a1949350505050565b6000610231838330610238565b9392505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b6108598061040283390190565b60008083601f84011261028157600080fd5b50813567ffffffffffffffff81111561029957600080fd5b6020830191508360208260051b85010111156102b457600080fd5b9250929050565b600080600080606085870312156102d157600080fd5b843567ffffffffffffffff8111156102e857600080fd5b6102f48782880161026f565b90989097506020870135966040013595509350505050565b60008060006040848603121561032157600080fd5b833567ffffffffffffffff81111561033857600080fd5b6103448682870161026f565b909790965060209590950135949350505050565b604080825281018390526000846060830182805b878110156103a05783356001600160a01b03811680821461038b578384fd5b8452506020938401939092019160010161036c565b505060209390930193909352509392505050565b6000815160005b818110156103d557602081850181015186830152016103bb565b50600093019283525090919050565b60006103f96103f383866103b4565b846103b4565b94935050505056fe60c060405234801561001057600080fd5b5060405161085938038061085983398101604081905261002f9161016e565b80600081116100845760405162461bcd60e51b815260206004820152601d60248201527f65706f6368206c656e677468206d757374206e6f74206265207a65726f000000604482015260640160405180910390fd5b6080526000805b83518110156101305760008482815181106100a8576100a861023a565b6020026020010151905060016000826001600160a01b03166001600160a01b03168152602001908152602001600020546000036101275760006100ea84610250565b6001600160a01b03831660008181526001602090815260408083208590558483526002909152902080546001600160a01b03191690911790559350505b5060010161008b565b5060a052506102779050565b634e487b7160e01b600052604160045260246000fd5b80516001600160a01b038116811461016957600080fd5b919050565b6000806040838503121561018157600080fd5b82516001600160401b038082111561019857600080fd5b818501915085601f8301126101ac57600080fd5b81516020828211156101c0576101c061013c565b8160051b604051601f19603f830116810181811086821117156101e5576101e561013c565b60405292835281830193508481018201928984111561020357600080fd5b948201945b838610156102285761021986610152565b85529482019493820193610208565b97909101519698969750505050505050565b634e487b7160e01b600052603260045260246000fd5b60006001820161027057634e487b7160e01b600052601160045260246000fd5b5060010190565b60805160a0516105b66102a36000396000818161010c01526102f70152600061019001526105b66000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c80636470af001161005b5780636470af00146101535780637051bfd5146101685780639618f35b1461017b578063cfe8a73b1461018e57600080fd5b80630a6f1fe81461008d5780631c45396a146100c95780631e526e451461010a5780634b84231c14610130575b600080fd5b6100b661009b36600461044b565b6001600160a01b031660009081526001602052604090205490565b6040519081526020015b60405180910390f35b6100f26100d736600461046d565b6000908152600260205260409020546001600160a01b031690565b6040516001600160a01b0390911681526020016100c0565b7f00000000000000000000000000000000000000000000000000000000000000006100b6565b61014361013e366004610486565b6101b4565b60405190151581526020016100c0565b6101666101613660046104bf565b6101f1565b005b6100b66101763660046104bf565b610353565b6101436101893660046104f2565b610369565b7f00000000000000000000000000000000000000000000000000000000000000006100b6565b60006101e8826101c5878787610395565b600882901c60009081526001918201602052604090205460ff9092161b16151590565b95945050505050565b33600090815260016020526040902054806102525760405162461bcd60e51b815260206004820152601f60248201527f51756f72756d3a2063616c6c6572206973206e6f742076616c696461746f7200604482015260640160405180910390fd5b60408051848152602081018490526001600160a01b0386169133917ff5a28e07a1b89d1ca3f9a2a7ef16bd650503a4791baf2e70dc401c21ee505f0a910160405180910390a360006102a5858585610395565b600883901c6000908152600180830160205260409091205491925060ff84161b1661034c57600882901c600090815260018281016020526040909120805460ff85169290921b909117905561031b60027f0000000000000000000000000000000000000000000000000000000000000000610532565b610326906001610554565b816000016000815461033790610567565b91829055500361034c5761034c8585856103c7565b5050505050565b6000610360848484610395565b54949350505050565b6001600160a01b03821660009081526020818152604080832084845290915290205460ff165b92915050565b6001600160a01b0383166000908152600360209081526040808320858452825280832084845290915290209392505050565b6001600160a01b038316600081815260208181526040808320858452825291829020805460ff1916600117905581518581529081018490527fd3e4892959c6ddb27e02bcaaebc0c1898d0f677b7360bf80339f10a8717957d3910160405180910390a2505050565b80356001600160a01b038116811461044657600080fd5b919050565b60006020828403121561045d57600080fd5b6104668261042f565b9392505050565b60006020828403121561047f57600080fd5b5035919050565b6000806000806080858703121561049c57600080fd5b6104a58561042f565b966020860135965060408601359560600135945092505050565b6000806000606084860312156104d457600080fd5b6104dd8461042f565b95602085013595506040909401359392505050565b6000806040838503121561050557600080fd5b61050e8361042f565b946020939093013593505050565b634e487b7160e01b600052601160045260246000fd5b60008261054f57634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561038f5761038f61051c565b6000600182016105795761057961051c565b506001019056fea2646970667358221220642bb94e1d4dd60f0c8a41a3a000c90390997995461f65183db6e55f56e5032864736f6c63430008170033a264697066735822122056fc82af8dbf74e096ba755e657baedd2a8684ccc11e63a53a44d8ceb691249e64736f6c63430008170033",