Sepolia Testnet

Contract

0x72970B499489F535a00c63F9f75B438F4BA01037

Overview

ETH Balance

0 ETH

Multichain Info

N/A
Transaction Hash
Method
Block
From
To
Value
Register Stf56552872024-04-08 16:10:3645 days ago1712592636IN
0x72970B49...F4BA01037
0 ETH0.000118241.33093554

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To Value
56552822024-04-08 16:09:3645 days ago1712592576  Contract Creation0 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
AppInbox

Compiler Version
v0.8.24+commit.e11b9ed9

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 14 : AppInbox.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.19;

import {Registry} from "./Registry.sol";

import {ITicketCreator} from "./interfaces/ITicketCreator.sol";

import "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol";

contract AppInbox is ITicketCreator {
    using MessageHashUtils for bytes32;

    /*//////////////////////////////////////////////////////////////
                                STRUCTS
    //////////////////////////////////////////////////////////////*/
    struct AppData {
        bytes32 stateMachineHash;
        bytes32 genesisStateHash;
    }

    struct HeaderData {
        bytes32 actionRoot;
        bytes32 acknowledgementRoot;
        bytes32 stateRoot;
        uint256 timestamp;
    }

    struct Block {
        bytes32 blockHash;
        bytes32 parentHash;
        bytes32 actionRoot;
        bytes32 acknowledgementRoot;
        bytes32 stateRoot;
        uint256 height;
        uint256 timestamp;
        uint256 appId;
        bytes builderSignature;
        bytes vulcanLeaderSignature;
        bytes operatorSignature;
    }

    /*//////////////////////////////////////////////////////////////
                                STORAGE
    //////////////////////////////////////////////////////////////*/
    uint256 public appId;
    address public bridgeContract;

    address public immutable owner;
    Registry internal _registry;

    uint256 public latestBlockHeight;
    uint256 public currentTicketNumber;

    mapping(bytes32 => HeaderData) hashToBlockHeader;
    mapping(uint256 => bytes32) heightToBlockHash;

    AppData public appData;

    /*//////////////////////////////////////////////////////////////
                                EVENTS
    //////////////////////////////////////////////////////////////*/
    event BlockSubmitted(
        address submitter,
        bytes32 indexed blockHash,
        uint256 indexed height
    );

    event TicketCreated(
        uint256 indexed ticketNumber,
        address indexed sender,
        bytes32 indexed identifier,
        bytes message
    );

    event RegisteredSTF(
        bytes32 stateMachineHash,
        bytes32 genesisStateHash,
        address operator
    );

    /*//////////////////////////////////////////////////////////////
                                MODIFIERS
    //////////////////////////////////////////////////////////////*/
    modifier onlyOwner() {
        require(msg.sender == owner, "NOT_OWNER");
        _;
    }

    modifier onlyRouter() {
        require(msg.sender == _registry.router(), "NOT_ROUTER");
        _;
    }

    modifier onlyBridge() {
        require(msg.sender == bridgeContract, "NOT_BRIDGE");
        _;
    }

    /*//////////////////////////////////////////////////////////////
                                CONSTRUCTOR
    //////////////////////////////////////////////////////////////*/
    constructor(uint256 _appId, address _operator) {
        appId = _appId;
        owner = _operator;
        _registry = Registry(msg.sender);
    }

    /*//////////////////////////////////////////////////////////////
                            CORE FUNCTIONS
    //////////////////////////////////////////////////////////////*/

    function registerStf(
        AppData memory _appData,
        bytes memory _operatorSignature
    ) external onlyOwner {
        bytes32 messageHash = keccak256(
            abi.encodePacked(
                _appData.stateMachineHash,
                _appData.genesisStateHash
            )
        );
        require(
            SignatureChecker.isValidSignatureNow(
                msg.sender,
                messageHash.toEthSignedMessageHash(),
                _operatorSignature
            ),
            "INVALID_OPERATOR_SIGNATURE"
        );
        appData = _appData;

        emit RegisteredSTF(
            _appData.stateMachineHash,
            _appData.genesisStateHash,
            msg.sender
        );

        _registry.initializeApp(appId);
    }

    function submit(
        Block calldata _block,
        address _submitter
    ) external onlyRouter {
        (, , bool initialized) = _registry.appData(appId);
        require(initialized, "APP_NOT_INITIALIZED");
        require(_block.height == latestBlockHeight + 1, "INVALID_BLOCK_HEIGHT");
        require(
            heightToBlockHash[latestBlockHeight] == _block.parentHash,
            "INVALID_PARENT_HASH"
        );

        require(
            SignatureChecker.isValidSignatureNow(
                owner,
                _block.blockHash.toEthSignedMessageHash(),
                _block.operatorSignature
            ),
            "INVALID_OPERATOR_SIGNATURE"
        );
        require(
            SignatureChecker.isValidSignatureNow(
                _submitter,
                keccak256(_block.operatorSignature).toEthSignedMessageHash(),
                _block.vulcanLeaderSignature
            ),
            "INVALID_VULCAN_LEADER_SIGNATURE"
        );

        hashToBlockHeader[_block.blockHash] = HeaderData({
            actionRoot: _block.actionRoot,
            acknowledgementRoot: _block.acknowledgementRoot,
            stateRoot: _block.stateRoot,
            timestamp: _block.timestamp
        });
        heightToBlockHash[_block.height] = _block.blockHash;

        latestBlockHeight = _block.height;

        emit BlockSubmitted(msg.sender, _block.blockHash, latestBlockHeight);
    }

    /*//////////////////////////////////////////////////////////////
                            GMP FUNCTIONS
    //////////////////////////////////////////////////////////////*/

    /**
     * @dev Sets the bridge contract address.
     * @param _bridgeContract address of the bridge contract.
     */
    function setBridgeContract(address _bridgeContract) external onlyOwner {
        bridgeContract = _bridgeContract;
    }

    /**
     * @dev Internal function to create a ticket for passing messages to off-chain operator.
     * Emits a `TicketCreated` event upon successful creation.
     * @param _message bytes containing encoded information for passing.
     */
    function createTicket(
        bytes32 _identifier,
        address msgSender,
        bytes memory _message
    ) external onlyBridge {
        emit TicketCreated(
            ++currentTicketNumber,
            msgSender,
            _identifier,
            _message
        );
    }
}

File 3 of 14 : Registry.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.13;

import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {AppInbox} from "./AppInbox.sol";
import {IAccessController} from "./interfaces/IAccessController.sol";
import {IRouter} from "./interfaces/IRouter.sol";

contract Registry is Ownable {
    /*//////////////////////////////////////////////////////////////
                                EVENTS
    //////////////////////////////////////////////////////////////*/
    event AppRegistered(
        uint256 indexed appId,
        address indexed operator,
        address indexed appInbox
    );
    event AppInitialized(uint256 indexed appId, address indexed registry);
    event RouterUpdated(address router);
    event Bond(address indexed vulcanOperator, string indexed serviceURI);

    /*//////////////////////////////////////////////////////////////
                                STRUCTS
    //////////////////////////////////////////////////////////////*/
    struct VulcanOperator {
        address operator;
        string serviceURI;
        bool isActive;
    }

    struct App {
        address operator;
        address inbox;
        bool initialized;
    }

    /*//////////////////////////////////////////////////////////////
                                STORAGE
    //////////////////////////////////////////////////////////////*/

    IAccessController public appOperatorAccessController;
    address public router;

    address public immutable spock;
    uint256 public basePrice = 0.69 ether;
    uint256 public surgePrice = 1 ether;
    uint256 public appsAllowedAtBasePrice;

    uint256 public appCount = 0;
    mapping(address => uint256) public appCountByOperator;
    mapping(uint256 => App) public appData;

    mapping(address => VulcanOperator) public vulcanOperatorData;
    mapping(address => bool) public allowedVulcans;

    /*//////////////////////////////////////////////////////////////
                                MODIFIERS
    //////////////////////////////////////////////////////////////*/
    modifier isAllowlistedOperator(address _operator) {
        require(
            appOperatorAccessController.isAllowed(_operator),
            "NOT_ALLOWED_OPERATOR"
        );
        _;
    }

    /*//////////////////////////////////////////////////////////////
                                CONSTRUCTOR
    //////////////////////////////////////////////////////////////*/
    constructor(
        address _spock,
        address _appOperatorAccessController,
        uint256 _baseRegistrationPrice,
        uint256 _surgeRegistrationPrice,
        uint256 _appsAllowedAtBasePrice
    ) Ownable(msg.sender) {
        spock = _spock;
        basePrice = _baseRegistrationPrice;
        surgePrice = _surgeRegistrationPrice;
        appsAllowedAtBasePrice = _appsAllowedAtBasePrice;

        setAppOperatorAccessController(
            IAccessController(_appOperatorAccessController)
        );
    }

    /*//////////////////////////////////////////////////////////////
                                FUNCTIONS
    //////////////////////////////////////////////////////////////*/

    function isVulcanOperatorRegisteredAndActive(
        address _vulcan
    ) public view returns (bool) {
        VulcanOperator memory vulcan = vulcanOperatorData[_vulcan];
        if (vulcan.operator == address(0)) return false;
        else return vulcan.isActive;
    }

    function registerVulcanOperator(string memory _serviceURI) external {
        require(allowedVulcans[msg.sender], "NOT_ALLOWED_VULCAN");
        require(bytes(_serviceURI).length != 0, "SERVICE_URI_EMPTY");

        vulcanOperatorData[msg.sender] = VulcanOperator(
            msg.sender,
            _serviceURI,
            true
        );

        emit Bond(msg.sender, _serviceURI);
    }

    function priceToRegisterAppForOperator(
        address operator
    ) public view returns (uint256) {
        if (appCountByOperator[operator] < appsAllowedAtBasePrice) {
            return basePrice;
        }

        return surgePrice;
    }

    function registerApp() external payable isAllowlistedOperator(msg.sender) {
        uint256 price = priceToRegisterAppForOperator(msg.sender);
        require(msg.value >= price, "INSUFFICIENT_PAYMENT");

        (bool success, ) = payable(spock).call{value: msg.value}("");
        require(success, "PAYMENT_FAILED");

        appCount++;
        appCountByOperator[msg.sender]++;

        address appInbox = address(new AppInbox(appCount, msg.sender));
        appData[appCount] = App(msg.sender, appInbox, false);

        emit AppRegistered(appCount, msg.sender, appInbox);
    }

    function initializeApp(uint256 appId) external {
        require(appData[appId].initialized == false, "ALREADY_INITIALIZED");
        require(appData[appId].inbox == msg.sender, "INCORRECT_APP_INBOX");

        appData[appId].initialized = true;
        emit AppInitialized(appId, msg.sender);
    }

    /*//////////////////////////////////////////////////////////////
                            ADMIN FUNCTIONS
    //////////////////////////////////////////////////////////////*/

    function setAppOperatorAccessController(
        IAccessController _appOperatorAccessController
    ) public onlyOwner {
        appOperatorAccessController = _appOperatorAccessController;
    }

    function setRouter(address _router) external onlyOwner {
        require(IRouter(_router).registry() == address(this), "INVALID_ROUTER");
        router = _router;
        emit RouterUpdated(router);
    }

    function allowVulcanOperator(address _operator) external onlyOwner {
        allowedVulcans[_operator] = true;
    }

    function disallowVulcanOperator(address _operator) external onlyOwner {
        allowedVulcans[_operator] = false;
        if (vulcanOperatorData[_operator].operator != address(0)) {
            vulcanOperatorData[_operator].isActive = false;
        }
    }

    function setRegistrationPriceParameters(
        uint256 _basePrice,
        uint256 _surgePrice,
        uint256 _threshold
    ) external onlyOwner {
        basePrice = _basePrice;
        surgePrice = _surgePrice;
        appsAllowedAtBasePrice = _threshold;
    }
}

File 4 of 14 : ITicketCreator.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

interface ITicketCreator {
    function createTicket(
        bytes32 _identifier,
        address msgSender,
        bytes memory _message
    ) external;
}

File 5 of 14 : SignatureChecker.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/SignatureChecker.sol)

pragma solidity ^0.8.20;

import {ECDSA} from "./ECDSA.sol";
import {IERC1271} from "../../interfaces/IERC1271.sol";

/**
 * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA
 * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like
 * Argent and Safe Wallet (previously Gnosis Safe).
 */
library SignatureChecker {
    /**
     * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the
     * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.
     *
     * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
     * change through time. It could return true at block N and false at block N+1 (or the opposite).
     */
    function isValidSignatureNow(address signer, bytes32 hash, bytes memory signature) internal view returns (bool) {
        (address recovered, ECDSA.RecoverError error, ) = ECDSA.tryRecover(hash, signature);
        return
            (error == ECDSA.RecoverError.NoError && recovered == signer) ||
            isValidERC1271SignatureNow(signer, hash, signature);
    }

    /**
     * @dev Checks if a signature is valid for a given signer and data hash. The signature is validated
     * against the signer smart contract using ERC1271.
     *
     * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
     * change through time. It could return true at block N and false at block N+1 (or the opposite).
     */
    function isValidERC1271SignatureNow(
        address signer,
        bytes32 hash,
        bytes memory signature
    ) internal view returns (bool) {
        (bool success, bytes memory result) = signer.staticcall(
            abi.encodeCall(IERC1271.isValidSignature, (hash, signature))
        );
        return (success &&
            result.length >= 32 &&
            abi.decode(result, (bytes32)) == bytes32(IERC1271.isValidSignature.selector));
    }
}

File 6 of 14 : MessageHashUtils.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol)

pragma solidity ^0.8.20;

import {Strings} from "../Strings.sol";

/**
 * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.
 *
 * The library provides methods for generating a hash of a message that conforms to the
 * https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]
 * specifications.
 */
library MessageHashUtils {
    /**
     * @dev Returns the keccak256 digest of an EIP-191 signed data with version
     * `0x45` (`personal_sign` messages).
     *
     * The digest is calculated by prefixing a bytes32 `messageHash` with
     * `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the
     * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
     *
     * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with
     * keccak256, although any bytes32 value can be safely used because the final digest will
     * be re-hashed.
     *
     * See {ECDSA-recover}.
     */
    function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, "\x19Ethereum Signed Message:\n32") // 32 is the bytes-length of messageHash
            mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix
            digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20)
        }
    }

    /**
     * @dev Returns the keccak256 digest of an EIP-191 signed data with version
     * `0x45` (`personal_sign` messages).
     *
     * The digest is calculated by prefixing an arbitrary `message` with
     * `"\x19Ethereum Signed Message:\n" + len(message)` and hashing the result. It corresponds with the
     * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
     *
     * See {ECDSA-recover}.
     */
    function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) {
        return
            keccak256(bytes.concat("\x19Ethereum Signed Message:\n", bytes(Strings.toString(message.length)), message));
    }

    /**
     * @dev Returns the keccak256 digest of an EIP-191 signed data with version
     * `0x00` (data with intended validator).
     *
     * The digest is calculated by prefixing an arbitrary `data` with `"\x19\x00"` and the intended
     * `validator` address. Then hashing the result.
     *
     * See {ECDSA-recover}.
     */
    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked(hex"19_00", validator, data));
    }

    /**
     * @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`).
     *
     * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with
     * `\x19\x01` and hashing the result. It corresponds to the hash signed by the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.
     *
     * See {ECDSA-recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, hex"19_01")
            mstore(add(ptr, 0x02), domainSeparator)
            mstore(add(ptr, 0x22), structHash)
            digest := keccak256(ptr, 0x42)
        }
    }
}

File 7 of 14 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 8 of 14 : IAccessController.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

interface IAccessController {
    function isAllowed(address _operator) external view returns (bool);
}

File 9 of 14 : IRouter.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.13;

interface IRouter {
    function registry() external view returns (address);
}

File 10 of 14 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.20;

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS
    }

    /**
     * @dev The signature derives the `address(0)`.
     */
    error ECDSAInvalidSignature();

    /**
     * @dev The signature has an invalid length.
     */
    error ECDSAInvalidSignatureLength(uint256 length);

    /**
     * @dev The signature has an S value that is in the upper half order.
     */
    error ECDSAInvalidSignatureS(bytes32 s);

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not
     * return address(0) without also returning an error description. Errors are documented using an enum (error type)
     * and a bytes32 providing additional information about the error.
     *
     * If no error is returned, then the address can be used for verification purposes.
     *
     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     */
    function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) {
        unchecked {
            bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
            // We do not check for an overflow here since the shift operation results in 0 or 1.
            uint8 v = uint8((uint256(vs) >> 255) + 27);
            return tryRecover(hash, v, r, s);
        }
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     */
    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError, bytes32) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS, s);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature, bytes32(0));
        }

        return (signer, RecoverError.NoError, bytes32(0));
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.
     */
    function _throwError(RecoverError error, bytes32 errorArg) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert ECDSAInvalidSignature();
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert ECDSAInvalidSignatureLength(uint256(errorArg));
        } else if (error == RecoverError.InvalidSignatureS) {
            revert ECDSAInvalidSignatureS(errorArg);
        }
    }
}

File 11 of 14 : IERC1271.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1271.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC1271 standard signature validation method for
 * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].
 */
interface IERC1271 {
    /**
     * @dev Should return whether the signature provided is valid for the provided data
     * @param hash      Hash of the data to be signed
     * @param signature Signature byte array associated with _data
     */
    function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);
}

File 12 of 14 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)

pragma solidity ^0.8.20;

import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant HEX_DIGITS = "0123456789abcdef";
    uint8 private constant ADDRESS_LENGTH = 20;

    /**
     * @dev The `value` string doesn't fit in the specified `length`.
     */
    error StringsInsufficientHexLength(uint256 value, uint256 length);

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toStringSigned(int256 value) internal pure returns (string memory) {
        return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        uint256 localValue = value;
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = HEX_DIGITS[localValue & 0xf];
            localValue >>= 4;
        }
        if (localValue != 0) {
            revert StringsInsufficientHexLength(value, length);
        }
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal
     * representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);
    }

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

File 13 of 14 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

File 14 of 14 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Muldiv operation overflow.
     */
    error MathOverflowedMulDiv();

    enum Rounding {
        Floor, // Toward negative infinity
        Ceil, // Toward positive infinity
        Trunc, // Toward zero
        Expand // Away from zero
    }

    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds towards infinity instead
     * of rounding towards zero.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        if (b == 0) {
            // Guarantee the same behavior as in a regular Solidity division.
            return a / b;
        }

        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
     * denominator == 0.
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
     * Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0 = x * y; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            if (denominator <= prod1) {
                revert MathOverflowedMulDiv();
            }

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator.
            // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.

            uint256 twos = denominator & (0 - denominator);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
            // works in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
     * towards zero.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
        }
    }

    /**
     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
     */
    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
        return uint8(rounding) % 2 == 1;
    }
}

File 15 of 14 : SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two signed numbers.
     */
    function min(int256 a, int256 b) internal pure returns (int256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

Settings
{
  "remappings": [
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "viaIR": false,
  "libraries": {}
}

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"_appId","type":"uint256"},{"internalType":"address","name":"_operator","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"submitter","type":"address"},{"indexed":true,"internalType":"bytes32","name":"blockHash","type":"bytes32"},{"indexed":true,"internalType":"uint256","name":"height","type":"uint256"}],"name":"BlockSubmitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"stateMachineHash","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"genesisStateHash","type":"bytes32"},{"indexed":false,"internalType":"address","name":"operator","type":"address"}],"name":"RegisteredSTF","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"ticketNumber","type":"uint256"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"bytes32","name":"identifier","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"message","type":"bytes"}],"name":"TicketCreated","type":"event"},{"inputs":[],"name":"appData","outputs":[{"internalType":"bytes32","name":"stateMachineHash","type":"bytes32"},{"internalType":"bytes32","name":"genesisStateHash","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"appId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bridgeContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_identifier","type":"bytes32"},{"internalType":"address","name":"msgSender","type":"address"},{"internalType":"bytes","name":"_message","type":"bytes"}],"name":"createTicket","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentTicketNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestBlockHeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"stateMachineHash","type":"bytes32"},{"internalType":"bytes32","name":"genesisStateHash","type":"bytes32"}],"internalType":"struct AppInbox.AppData","name":"_appData","type":"tuple"},{"internalType":"bytes","name":"_operatorSignature","type":"bytes"}],"name":"registerStf","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_bridgeContract","type":"address"}],"name":"setBridgeContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"blockHash","type":"bytes32"},{"internalType":"bytes32","name":"parentHash","type":"bytes32"},{"internalType":"bytes32","name":"actionRoot","type":"bytes32"},{"internalType":"bytes32","name":"acknowledgementRoot","type":"bytes32"},{"internalType":"bytes32","name":"stateRoot","type":"bytes32"},{"internalType":"uint256","name":"height","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"uint256","name":"appId","type":"uint256"},{"internalType":"bytes","name":"builderSignature","type":"bytes"},{"internalType":"bytes","name":"vulcanLeaderSignature","type":"bytes"},{"internalType":"bytes","name":"operatorSignature","type":"bytes"}],"internalType":"struct AppInbox.Block","name":"_block","type":"tuple"},{"internalType":"address","name":"_submitter","type":"address"}],"name":"submit","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a060405234801561001057600080fd5b5060405161102d38038061102d83398101604081905261002f91610058565b6000919091556001600160a01b0316608052600280546001600160a01b03191633179055610095565b6000806040838503121561006b57600080fd5b825160208401519092506001600160a01b038116811461008a57600080fd5b809150509250929050565b608051610f686100c5600039600081816101350152818161019f015281816104fe01526106fb0152610f686000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c80638aebd348116100665780638aebd3481461010d5780638da5cb5b14610130578063a631c3601461016f578063cd59658314610178578063f3f39ee51461018b57600080fd5b80630b26cf66146100a3578063156087cb146100b857806320ab0c75146100cb57806356fcf123146100de57806380afdea8146100f1575b600080fd5b6100b66100b1366004610b4e565b610194565b005b6100b66100c6366004610c15565b61021f565b6100b66100d9366004610c6e565b6102c2565b6100b66100ec366004610cc6565b6106f0565b6100fa60005481565b6040519081526020015b60405180910390f35b60075460085461011b919082565b60408051928352602083019190915201610104565b6101577f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610104565b6100fa60045481565b600154610157906001600160a01b031681565b6100fa60035481565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146101fd5760405162461bcd60e51b81526020600482015260096024820152682727aa2fa7aba722a960b91b60448201526064015b60405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031633146102665760405162461bcd60e51b815260206004820152600a6024820152694e4f545f42524944474560b01b60448201526064016101f4565b82826001600160a01b031660046000815461028090610d64565b9190508190557fec0eae5189d33f7bbeb17e51de8eb8a908904c58417c749e4f7bb340e5263d3f846040516102b59190610dcd565b60405180910390a4505050565b600260009054906101000a90046001600160a01b03166001600160a01b031663f887ea406040518163ffffffff1660e01b8152600401602060405180830381865afa158015610315573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103399190610de0565b6001600160a01b0316336001600160a01b0316146103865760405162461bcd60e51b815260206004820152600a6024820152692727aa2fa927aaaa22a960b11b60448201526064016101f4565b6002546000805460405163d4a2f19b60e01b815291926001600160a01b03169163d4a2f19b916103bc9160040190815260200190565b606060405180830381865afa1580156103d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103fd9190610dfd565b92505050806104445760405162461bcd60e51b815260206004820152601360248201527210541417d393d517d253925512505312569151606a1b60448201526064016101f4565b600354610452906001610e4f565b8360a001351461049b5760405162461bcd60e51b81526020600482015260146024820152731253959053125117d09313d0d2d7d2115251d21560621b60448201526064016101f4565b826020013560066000600354815260200190815260200160002054146104f95760405162461bcd60e51b81526020600482015260136024820152720929cac82989288bea082a48a9ca8be9082a69606b1b60448201526064016101f4565b61056f7f000000000000000000000000000000000000000000000000000000000000000061052785356108aa565b610535610140870187610e68565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506108dd92505050565b6105bb5760405162461bcd60e51b815260206004820152601a60248201527f494e56414c49445f4f50455241544f525f5349474e415455524500000000000060448201526064016101f4565b6105f9826105eb6105d0610140870187610e68565b6040516105de929190610eb6565b60405180910390206108aa565b610535610120870187610e68565b6106455760405162461bcd60e51b815260206004820152601f60248201527f494e56414c49445f56554c43414e5f4c45414445525f5349474e41545552450060448201526064016101f4565b604080516080808201835285830135825260608087013560208085019182529288013584860190815260c08901359285019283528835600081815260058652878120965187559251600187015590516002860155915160039485015560a088013580825260068452908590208290559283905592513381529192917f2206c577c860bb59ad93d1a618c220577516c74c184c8cd85cf59e6d2f959deb910160405180910390a3505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146107545760405162461bcd60e51b81526020600482015260096024820152682727aa2fa7aba722a960b91b60448201526064016101f4565b60008260000151836020015160405160200161077a929190918252602082015260400190565b6040516020818303038152906040528051906020012090506107a53361079f836108aa565b846108dd565b6107f15760405162461bcd60e51b815260206004820152601a60248201527f494e56414c49445f4f50455241544f525f5349474e415455524500000000000060448201526064016101f4565b82516007819055602080850151600881905560408051938452918301523382820152517facd7d38337678a2901d14c1588fa3783f8d8e5ba568148b63a93694bd626194a9181900360600190a160025460005460405163615fe39560e11b81526001600160a01b039092169163c2bfc72a916108739160040190815260200190565b600060405180830381600087803b15801561088d57600080fd5b505af11580156108a1573d6000803e3d6000fd5b50505050505050565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000006000908152601c91909152603c902090565b60008060006108ec858561093f565b509092509050600081600381111561090657610906610ec6565b1480156109245750856001600160a01b0316826001600160a01b0316145b80610935575061093586868661098c565b9695505050505050565b600080600083516041036109795760208401516040850151606086015160001a61096b88828585610a67565b955095509550505050610985565b50508151600091506002905b9250925092565b6000806000856001600160a01b031685856040516024016109ae929190610edc565b60408051601f198184030181529181526020820180516001600160e01b0316630b135d3f60e11b179052516109e39190610efd565b600060405180830381855afa9150503d8060008114610a1e576040519150601f19603f3d011682016040523d82523d6000602084013e610a23565b606091505b5091509150818015610a3757506020815110155b801561093557508051630b135d3f60e11b90610a5c9083016020908101908401610f19565b149695505050505050565b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115610aa25750600091506003905082610b2c565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015610af6573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610b2257506000925060019150829050610b2c565b9250600091508190505b9450945094915050565b6001600160a01b0381168114610b4b57600080fd5b50565b600060208284031215610b6057600080fd5b8135610b6b81610b36565b9392505050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112610b9957600080fd5b813567ffffffffffffffff80821115610bb457610bb4610b72565b604051601f8301601f19908116603f01168101908282118183101715610bdc57610bdc610b72565b81604052838152866020858801011115610bf557600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080600060608486031215610c2a57600080fd5b833592506020840135610c3c81610b36565b9150604084013567ffffffffffffffff811115610c5857600080fd5b610c6486828701610b88565b9150509250925092565b60008060408385031215610c8157600080fd5b823567ffffffffffffffff811115610c9857600080fd5b83016101608186031215610cab57600080fd5b91506020830135610cbb81610b36565b809150509250929050565b6000808284036060811215610cda57600080fd5b6040811215610ce857600080fd5b506040516040810167ffffffffffffffff8282108183111715610d0d57610d0d610b72565b8160405285358352602086013560208401528294506040860135925080831115610d3657600080fd5b5050610d4485828601610b88565b9150509250929050565b634e487b7160e01b600052601160045260246000fd5b600060018201610d7657610d76610d4e565b5060010190565b60005b83811015610d98578181015183820152602001610d80565b50506000910152565b60008151808452610db9816020860160208601610d7d565b601f01601f19169290920160200192915050565b602081526000610b6b6020830184610da1565b600060208284031215610df257600080fd5b8151610b6b81610b36565b600080600060608486031215610e1257600080fd5b8351610e1d81610b36565b6020850151909350610e2e81610b36565b60408501519092508015158114610e4457600080fd5b809150509250925092565b80820180821115610e6257610e62610d4e565b92915050565b6000808335601e19843603018112610e7f57600080fd5b83018035915067ffffffffffffffff821115610e9a57600080fd5b602001915036819003821315610eaf57600080fd5b9250929050565b8183823760009101908152919050565b634e487b7160e01b600052602160045260246000fd5b828152604060208201526000610ef56040830184610da1565b949350505050565b60008251610f0f818460208701610d7d565b9190910192915050565b600060208284031215610f2b57600080fd5b505191905056fea2646970667358221220406705e0894a21b5b618df74a2b4a947ce6d65d4f86bc6ee35e8ed346428636764736f6c634300081800330000000000000000000000000000000000000000000000000000000000000002000000000000000000000000a0374df63cc1c4233f1c4e470f7733b7e2b12626

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061009e5760003560e01c80638aebd348116100665780638aebd3481461010d5780638da5cb5b14610130578063a631c3601461016f578063cd59658314610178578063f3f39ee51461018b57600080fd5b80630b26cf66146100a3578063156087cb146100b857806320ab0c75146100cb57806356fcf123146100de57806380afdea8146100f1575b600080fd5b6100b66100b1366004610b4e565b610194565b005b6100b66100c6366004610c15565b61021f565b6100b66100d9366004610c6e565b6102c2565b6100b66100ec366004610cc6565b6106f0565b6100fa60005481565b6040519081526020015b60405180910390f35b60075460085461011b919082565b60408051928352602083019190915201610104565b6101577f000000000000000000000000a0374df63cc1c4233f1c4e470f7733b7e2b1262681565b6040516001600160a01b039091168152602001610104565b6100fa60045481565b600154610157906001600160a01b031681565b6100fa60035481565b336001600160a01b037f000000000000000000000000a0374df63cc1c4233f1c4e470f7733b7e2b1262616146101fd5760405162461bcd60e51b81526020600482015260096024820152682727aa2fa7aba722a960b91b60448201526064015b60405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031633146102665760405162461bcd60e51b815260206004820152600a6024820152694e4f545f42524944474560b01b60448201526064016101f4565b82826001600160a01b031660046000815461028090610d64565b9190508190557fec0eae5189d33f7bbeb17e51de8eb8a908904c58417c749e4f7bb340e5263d3f846040516102b59190610dcd565b60405180910390a4505050565b600260009054906101000a90046001600160a01b03166001600160a01b031663f887ea406040518163ffffffff1660e01b8152600401602060405180830381865afa158015610315573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103399190610de0565b6001600160a01b0316336001600160a01b0316146103865760405162461bcd60e51b815260206004820152600a6024820152692727aa2fa927aaaa22a960b11b60448201526064016101f4565b6002546000805460405163d4a2f19b60e01b815291926001600160a01b03169163d4a2f19b916103bc9160040190815260200190565b606060405180830381865afa1580156103d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103fd9190610dfd565b92505050806104445760405162461bcd60e51b815260206004820152601360248201527210541417d393d517d253925512505312569151606a1b60448201526064016101f4565b600354610452906001610e4f565b8360a001351461049b5760405162461bcd60e51b81526020600482015260146024820152731253959053125117d09313d0d2d7d2115251d21560621b60448201526064016101f4565b826020013560066000600354815260200190815260200160002054146104f95760405162461bcd60e51b81526020600482015260136024820152720929cac82989288bea082a48a9ca8be9082a69606b1b60448201526064016101f4565b61056f7f000000000000000000000000a0374df63cc1c4233f1c4e470f7733b7e2b1262661052785356108aa565b610535610140870187610e68565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506108dd92505050565b6105bb5760405162461bcd60e51b815260206004820152601a60248201527f494e56414c49445f4f50455241544f525f5349474e415455524500000000000060448201526064016101f4565b6105f9826105eb6105d0610140870187610e68565b6040516105de929190610eb6565b60405180910390206108aa565b610535610120870187610e68565b6106455760405162461bcd60e51b815260206004820152601f60248201527f494e56414c49445f56554c43414e5f4c45414445525f5349474e41545552450060448201526064016101f4565b604080516080808201835285830135825260608087013560208085019182529288013584860190815260c08901359285019283528835600081815260058652878120965187559251600187015590516002860155915160039485015560a088013580825260068452908590208290559283905592513381529192917f2206c577c860bb59ad93d1a618c220577516c74c184c8cd85cf59e6d2f959deb910160405180910390a3505050565b336001600160a01b037f000000000000000000000000a0374df63cc1c4233f1c4e470f7733b7e2b1262616146107545760405162461bcd60e51b81526020600482015260096024820152682727aa2fa7aba722a960b91b60448201526064016101f4565b60008260000151836020015160405160200161077a929190918252602082015260400190565b6040516020818303038152906040528051906020012090506107a53361079f836108aa565b846108dd565b6107f15760405162461bcd60e51b815260206004820152601a60248201527f494e56414c49445f4f50455241544f525f5349474e415455524500000000000060448201526064016101f4565b82516007819055602080850151600881905560408051938452918301523382820152517facd7d38337678a2901d14c1588fa3783f8d8e5ba568148b63a93694bd626194a9181900360600190a160025460005460405163615fe39560e11b81526001600160a01b039092169163c2bfc72a916108739160040190815260200190565b600060405180830381600087803b15801561088d57600080fd5b505af11580156108a1573d6000803e3d6000fd5b50505050505050565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000006000908152601c91909152603c902090565b60008060006108ec858561093f565b509092509050600081600381111561090657610906610ec6565b1480156109245750856001600160a01b0316826001600160a01b0316145b80610935575061093586868661098c565b9695505050505050565b600080600083516041036109795760208401516040850151606086015160001a61096b88828585610a67565b955095509550505050610985565b50508151600091506002905b9250925092565b6000806000856001600160a01b031685856040516024016109ae929190610edc565b60408051601f198184030181529181526020820180516001600160e01b0316630b135d3f60e11b179052516109e39190610efd565b600060405180830381855afa9150503d8060008114610a1e576040519150601f19603f3d011682016040523d82523d6000602084013e610a23565b606091505b5091509150818015610a3757506020815110155b801561093557508051630b135d3f60e11b90610a5c9083016020908101908401610f19565b149695505050505050565b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115610aa25750600091506003905082610b2c565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015610af6573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610b2257506000925060019150829050610b2c565b9250600091508190505b9450945094915050565b6001600160a01b0381168114610b4b57600080fd5b50565b600060208284031215610b6057600080fd5b8135610b6b81610b36565b9392505050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112610b9957600080fd5b813567ffffffffffffffff80821115610bb457610bb4610b72565b604051601f8301601f19908116603f01168101908282118183101715610bdc57610bdc610b72565b81604052838152866020858801011115610bf557600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080600060608486031215610c2a57600080fd5b833592506020840135610c3c81610b36565b9150604084013567ffffffffffffffff811115610c5857600080fd5b610c6486828701610b88565b9150509250925092565b60008060408385031215610c8157600080fd5b823567ffffffffffffffff811115610c9857600080fd5b83016101608186031215610cab57600080fd5b91506020830135610cbb81610b36565b809150509250929050565b6000808284036060811215610cda57600080fd5b6040811215610ce857600080fd5b506040516040810167ffffffffffffffff8282108183111715610d0d57610d0d610b72565b8160405285358352602086013560208401528294506040860135925080831115610d3657600080fd5b5050610d4485828601610b88565b9150509250929050565b634e487b7160e01b600052601160045260246000fd5b600060018201610d7657610d76610d4e565b5060010190565b60005b83811015610d98578181015183820152602001610d80565b50506000910152565b60008151808452610db9816020860160208601610d7d565b601f01601f19169290920160200192915050565b602081526000610b6b6020830184610da1565b600060208284031215610df257600080fd5b8151610b6b81610b36565b600080600060608486031215610e1257600080fd5b8351610e1d81610b36565b6020850151909350610e2e81610b36565b60408501519092508015158114610e4457600080fd5b809150509250925092565b80820180821115610e6257610e62610d4e565b92915050565b6000808335601e19843603018112610e7f57600080fd5b83018035915067ffffffffffffffff821115610e9a57600080fd5b602001915036819003821315610eaf57600080fd5b9250929050565b8183823760009101908152919050565b634e487b7160e01b600052602160045260246000fd5b828152604060208201526000610ef56040830184610da1565b949350505050565b60008251610f0f818460208701610d7d565b9190910192915050565b600060208284031215610f2b57600080fd5b505191905056fea2646970667358221220406705e0894a21b5b618df74a2b4a947ce6d65d4f86bc6ee35e8ed346428636764736f6c63430008180033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000a0374df63cc1c4233f1c4e470f7733b7e2b12626

-----Decoded View---------------
Arg [0] : _appId (uint256): 2
Arg [1] : _operator (address): 0xA0374df63cc1C4233F1c4E470F7733B7E2b12626

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [1] : 000000000000000000000000a0374df63cc1c4233f1c4e470f7733b7e2b12626


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.