Sepolia Testnet

Contract

0xE4793Ef0efFF43976b0Bd368B02680F96598e237
Source Code

Overview

ETH Balance

227.465694772899999995 ETH

Token Holdings

Multi Chain

Multichain Addresses

0 address found via
Transaction Hash
Method
Block
From
To
Value
Claim48610622023-12-10 18:14:121 hr 35 mins ago1702232052IN
0xE4793E...6598e237
0 ETH0.000423371.1094
Claim48591682023-12-10 11:14:368 hrs 35 mins ago1702206876IN
0xE4793E...6598e237
0 ETH0.000887762.41908899
Deposit48586182023-12-10 9:13:2410 hrs 36 mins ago1702199604IN
0xE4793E...6598e237
0.0006 ETH0.0044080721.44317577
Deposit48586172023-12-10 9:13:1210 hrs 36 mins ago1702199592IN
0xE4793E...6598e237
0.001456 ETH0.0042347520.60125394
Deposit48586142023-12-10 9:12:2410 hrs 37 mins ago1702199544IN
0xE4793E...6598e237
0.012 ETH0.004992124.28560498
Deposit48586112023-12-10 9:11:4810 hrs 38 mins ago1702199508IN
0xE4793E...6598e237
0.034 ETH0.0056348727.41255569
Deposit48586082023-12-10 9:11:1210 hrs 38 mins ago1702199472IN
0xE4793E...6598e237
0.023 ETH0.005433226.4299639
Deposit48586062023-12-10 9:10:4810 hrs 39 mins ago1702199448IN
0xE4793E...6598e237
0.002 ETH0.0058479428.44910755
Deposit48585992023-12-10 9:09:2410 hrs 40 mins ago1702199364IN
0xE4793E...6598e237
0.001 ETH0.0079971938.90252002
Deposit48585962023-12-10 9:08:4810 hrs 41 mins ago1702199328IN
0xE4793E...6598e237
0.005 ETH0.0074040636.01724075
Deposit48585942023-12-10 9:08:0010 hrs 41 mins ago1702199280IN
0xE4793E...6598e237
0.01 ETH0.0078737238.30414624
Deposit48585912023-12-10 9:07:2410 hrs 42 mins ago1702199244IN
0xE4793E...6598e237
0.02 ETH0.0077984437.93793963
Deposit48585872023-12-10 9:06:1210 hrs 43 mins ago1702199172IN
0xE4793E...6598e237
0.03 ETH0.0069783829.10594502
Deposit48585832023-12-10 9:04:2410 hrs 45 mins ago1702199064IN
0xE4793E...6598e237
0.01 ETH0.0060283229.32662975
Deposit48585802023-12-10 9:03:4810 hrs 46 mins ago1702199028IN
0xE4793E...6598e237
0.01 ETH0.0068427133.28849291
Deposit48585782023-12-10 9:03:2410 hrs 46 mins ago1702199004IN
0xE4793E...6598e237
0.01 ETH0.0071675434.86872976
Deposit48585752023-12-10 9:02:4810 hrs 47 mins ago1702198968IN
0xE4793E...6598e237
0.01 ETH0.0068856833.49752091
Deposit48585732023-12-10 9:02:1210 hrs 47 mins ago1702198932IN
0xE4793E...6598e237
0.01 ETH0.0068428633.28923793
Deposit48585712023-12-10 9:01:3610 hrs 48 mins ago1702198896IN
0xE4793E...6598e237
0.01 ETH0.0073843230.79906677
Deposit48585662023-12-10 9:00:1210 hrs 49 mins ago1702198812IN
0xE4793E...6598e237
0.01 ETH0.0057701328.07059854
Deposit48585642023-12-10 8:59:1210 hrs 50 mins ago1702198752IN
0xE4793E...6598e237
0.009 ETH0.0064200431.23043422
Deposit48585622023-12-10 8:58:4810 hrs 51 mins ago1702198728IN
0xE4793E...6598e237
0.008 ETH0.0062816930.55921509
Deposit48585592023-12-10 8:58:0010 hrs 51 mins ago1702198680IN
0xE4793E...6598e237
0.007 ETH0.0056224227.35040427
Deposit48585572023-12-10 8:57:3610 hrs 52 mins ago1702198656IN
0xE4793E...6598e237
0.006 ETH0.005454126.53316056
Deposit48585552023-12-10 8:57:0010 hrs 52 mins ago1702198620IN
0xE4793E...6598e237
0.005 ETH0.0046590422.66404596
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Txn Hash Block From To Value
48610622023-12-10 18:14:121 hr 35 mins ago1702232052
0xE4793E...6598e237
0.03 ETH
48591682023-12-10 11:14:368 hrs 35 mins ago1702206876
0xE4793E...6598e237
0.101 ETH
48576582023-12-10 5:38:2414 hrs 11 mins ago1702186704
0xE4793E...6598e237
2 ETH
48147632023-12-03 15:09:247 days 4 hrs ago1701616164
0xE4793E...6598e237
0.01 ETH
48140222023-12-03 12:19:007 days 7 hrs ago1701605940
0xE4793E...6598e237
0.00142 ETH
48041322023-12-01 22:06:128 days 21 hrs ago1701468372
0xE4793E...6598e237
1 ETH
48019392023-12-01 13:35:129 days 6 hrs ago1701437712
0xE4793E...6598e237
0.01 ETH
48007602023-12-01 8:58:369 days 10 hrs ago1701421116
0xE4793E...6598e237
0.123 ETH
48007562023-12-01 8:57:489 days 10 hrs ago1701421068
0xE4793E...6598e237
0.1 ETH
48007522023-12-01 8:56:369 days 10 hrs ago1701420996
0xE4793E...6598e237
0.021 ETH
47978222023-11-30 22:16:369 days 21 hrs ago1701382596
0xE4793E...6598e237
0.02 ETH
47974002023-11-30 20:39:009 days 23 hrs ago1701376740
0xE4793E...6598e237
0.001 ETH
47960032023-11-30 15:20:1210 days 4 hrs ago1701357612
0xE4793E...6598e237
0.005 ETH
47960032023-11-30 15:20:1210 days 4 hrs ago1701357612
0xE4793E...6598e237
0.0101 ETH
47959552023-11-30 15:09:0010 days 4 hrs ago1701356940
0xE4793E...6598e237
0.0291 ETH
47959542023-11-30 15:08:4810 days 4 hrs ago1701356928
0xE4793E...6598e237
0.0185 ETH
47959522023-11-30 15:08:2410 days 4 hrs ago1701356904
0xE4793E...6598e237
0.0238 ETH
47959522023-11-30 15:08:2410 days 4 hrs ago1701356904
0xE4793E...6598e237
0.0134 ETH
47959472023-11-30 15:07:2410 days 4 hrs ago1701356844
0xE4793E...6598e237
0.0117 ETH
47959472023-11-30 15:07:2410 days 4 hrs ago1701356844
0xE4793E...6598e237
0.0268 ETH
47959472023-11-30 15:07:2410 days 4 hrs ago1701356844
0xE4793E...6598e237
0.0135 ETH
47959092023-11-30 14:58:4810 days 4 hrs ago1701356328
0xE4793E...6598e237
0.0287 ETH
47959092023-11-30 14:58:4810 days 4 hrs ago1701356328
0xE4793E...6598e237
0.028 ETH
47959092023-11-30 14:58:4810 days 4 hrs ago1701356328
0xE4793E...6598e237
0.0299 ETH
47959032023-11-30 14:57:3610 days 4 hrs ago1701356256
0xE4793E...6598e237
0.0244 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ZRP

Compiler Version
v0.8.21+commit.d9974bed

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 7 : ZRP.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.21;

import {IERC20} from "openzeppelin/token/ERC20/IERC20.sol";
import {Ownable} from "openzeppelin/access/Ownable.sol";
import {Pausable} from "openzeppelin/security/Pausable.sol";
import {IRiscZeroVerifier} from "./risczero/IRiscZeroVerifier.sol";
import {Errors, Events, Types} from "./ZRPLibs.sol";

/**
 * @title ZRP Contract
 * @author RISC Zero
 * @dev A contract for managing deposits, claims, and clawbacks.
 * It also manages the verification of proofs and handles token and ether transfers.
 */
contract ZRP is Ownable, Pausable {

    bytes32 public imageId;
    uint256 public claimFee;
    IRiscZeroVerifier public verifier;

    Types.Deposit[] private deposits;

    mapping(bytes32 => uint256) public claimBalance;
    mapping(bytes32 => uint256) public depositBalance;

    mapping(bytes32 => bool) private depositExists;
    mapping(bytes32 => uint256) private lastClaimIndex;
    mapping(bytes32 => uint256[]) private claimDepositIndices;

    /**
     * @dev Constructor initializes the contract with a verifier and imageId.
     * @param initVerifier The address of the initial verifier contract.
     * @param initImgId The initial image id.
     */
    constructor(IRiscZeroVerifier initVerifier, bytes32 initImgId) {
        verifier = initVerifier;
        imageId = initImgId;
    }

    /**
     * @dev Allows a user to deposit tokens or Ether.
     * @param id An identifier for the deposit.
     * @param token The address of the token contract, or zero-address for Ether.
     * @param amount The amount to deposit.
     * @param salt A unique value to avoid deposit id collisions.
     */
    function deposit(bytes memory id, address token, uint256 amount, uint256 salt) external payable whenNotPaused {
        bytes32 depositId = getDepositId(msg.sender, id, token, salt);

        if (depositExists[depositId]) {
            revert Errors.DepositAlreadyExists(depositId);
        }

        bytes32 claimId = getClaimId(id, token);

        Types.Deposit memory dep = Types.Deposit({
            state: Types.DepositState.Waiting,
            depositId: depositId,
            claimId: claimId,
            amount: amount,
            token: token,
            salt: salt
        });

        deposits.push(dep);

        depositExists[depositId] = true;

        claimDepositIndices[claimId].push(deposits.length - 1);

        if (token == address(0)) {
            if (msg.value != amount) {
                revert Errors.DepositFailed(claimId);
            }
            depositBalance[depositId] += msg.value;
            claimBalance[claimId] += msg.value;
        } else {
            if (!IERC20(token).transferFrom(msg.sender, address(this), amount)) {
                revert Errors.DepositFailed(claimId);
            }
            depositBalance[depositId] += amount;
            claimBalance[claimId] += amount;
        }
        emit Events.Deposited(id, msg.sender, amount);
    }

    /**
     * @dev Allows a user to claim deposits.
     * @param data The proof data.
     * @param token The address of the token contract, or zero-address for Ether.
     */
    function claim(bytes memory data, address token) external whenNotPaused {
        Types.Proof memory proof = abi.decode(data, (Types.Proof));

        if (!verifier.verify(proof.seal, imageId, proof.postStateDigest, proof.journal)) {
            revert Errors.InvalidProof(proof);
        }

        (address beneficiary, bytes memory id) = abi.decode(proof.journal, (address, bytes));

        if (beneficiary != msg.sender) {
            revert Errors.InvalidProof(proof);
        }

        bytes32 claimId = getClaimId(id, token);
        claimBalance[claimId] = 0;

        uint256 depositCount = claimDepositIndices[claimId].length;

        uint256 amount = 0;

        for (uint256 i = lastClaimIndex[claimId]; i < depositCount; ++i) {
            uint256 index = claimDepositIndices[claimId][i];
            Types.Deposit storage dep = deposits[index];

            if (dep.state == Types.DepositState.Waiting && dep.token == token) {
                depositBalance[dep.depositId] = 0;
                dep.state = Types.DepositState.Claimed;
                amount += dep.amount;
            }
        }

        lastClaimIndex[claimId] = depositCount;

        amount -= calculateFee(amount);

        if (token == address(0)) {
            payable(beneficiary).transfer(amount);
        } else {
            if (!IERC20(token).transfer(beneficiary, amount)) {
                revert Errors.ClaimFailed(claimId);
            }
        }
        emit Events.Claimed(id, beneficiary, amount);
    }

    /**
     * @dev Allows a user to clawback deposits.
     * @param id An identifier for the deposit.
     * @param token The address of the token contract, or zero-address for Ether.
     * @param salt The salt used when the deposit was made.
     */
    function withdrawDeposit(bytes memory id, address token, uint256 salt) external whenNotPaused {
        bytes32 depositId = getDepositId(msg.sender, id, token, salt);

        if (!depositExists[depositId]) {
            revert Errors.WithdrawFailed(depositId);
        }

        bytes32 claimId = getClaimId(id, token);

        uint256 depositCount = claimDepositIndices[claimId].length;

        uint256 amount = 0;

        for (uint256 i = 0; i < depositCount; ++i) {
            uint256 index = claimDepositIndices[claimId][i];
            Types.Deposit storage dep = deposits[index];

            if (dep.depositId == depositId && dep.token == token) {
                if (dep.state != Types.DepositState.Waiting) {
                    revert Errors.InvalidDepositState(depositId);
                }

                dep.state = Types.DepositState.Withdrawn;
                amount += dep.amount;
            }
        }

        depositBalance[depositId] = 0;
        claimBalance[claimId] -= amount;

        if (token == address(0)) {
            payable(msg.sender).transfer(amount);
        } else {
            if (!IERC20(token).transfer(msg.sender, amount)) {
                revert Errors.WithdrawFailed(claimId);
            }
        }
        emit Events.Withdrawn(id, msg.sender, amount);
    }

    /**
     * @dev Pause the contract.
     */
    function pause() external onlyOwner {
        _pause();
    }

    /**
     * @dev Unpause the contract.
     */
    function unpause() external onlyOwner {
        _unpause();
    }

    /**
     * @dev Set the fee percentage.
     * @param feePercentage The new fee percentage.
     */
    function setFee(uint256 feePercentage) external onlyOwner {
        if (feePercentage >= 100) {
            revert Errors.InvalidFee();
        }
        claimFee = feePercentage;
    }

    /**
     * @dev Set a new verifier.
     * @param newVerifier The address of the new verifier contract.
     */

    function setVerifier(IRiscZeroVerifier newVerifier) external onlyOwner {
        verifier = newVerifier;
    }

    /**
     * @dev Set a new image id.
     * @param newImageId The new image id.
     */

    function setImageId(bytes32 newImageId) external onlyOwner {
        imageId = newImageId;
    }

    /**
     * @dev Withdraw the contract balance.
     * @param to The address to withdraw to.
     * @param token The address of the token to withdraw, or zero-address for Ether.
     */
    function withdrawContract(address to, address token) external onlyOwner {
        if (token == address(0)) {
            payable(to).transfer(address(this).balance);
        } else {
            if (!IERC20(token).transfer(to, IERC20(token).balanceOf(address(this)))) {
                revert Errors.WithdrawFailed(bytes32("contract"));
            }
        }
        emit Events.Withdrawn("contract", to, address(this).balance);
    }

    /**
     * @dev Get claim id
     * @param id The claimer identifier.
     * @param token The address of the token for the claim.
     */
    function getClaimId(bytes memory id, address token) public pure returns (bytes32) {
        return _getKey(address(0), "claim", id, token, 0);
    }

    /**
     * @dev Get deposit id
     * @param depositor The depositor address.
     * @param id The deposit identifier.
     * @param token The address of the token for the deposit.
     * @param salt The salt used when the deposit was made.
     */
    function getDepositId(address depositor, bytes memory id, address token, uint256 salt)
        public
        pure
        returns (bytes32)
    {
        return _getKey(depositor, "deposit", id, token, salt);
    }

    /**
     * @dev Calculate the fee for a given amount.
     * @param amount The amount to calculate the fee for.
     */
    function calculateFee(uint256 amount) public view returns (uint256) {
        return (amount * claimFee) / 100;
    }

    /**
     * @dev Internal function to generate a key based on the given parameters.
     * @param about An address value.
     * @param key A string value.
     * @param id An identifier.
     * @param token The address of the token contract, or zero-address for Ether.
     * @param salt A unique value.
     * @return The generated key.
     */
    function _getKey(address about, string memory key, bytes memory id, address token, uint256 salt)
        internal
        pure
        returns (bytes32)
    {
        return keccak256(abi.encodePacked(about, key, id, token, salt));
    }
}

File 2 of 7 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
}

File 3 of 7 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../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.
 *
 * By default, the owner account will be the one that deploys the contract. 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;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @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 {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @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 {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _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 4 of 7 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 5 of 7 : IRiscZeroVerifier.sol
// Copyright 2023 RISC Zero, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// SPDX-License-Identifier: Apache-2.0

pragma solidity ^0.8.21;

/// @notice Indicator for the overall system at the end of execution covered by this proof.
enum SystemExitCode {
    Halted,
    Paused,
    SystemSplit
}

/// @notice Combination of system and user exit codes.
/// @dev If system exit code is SystemSplit, the user exit code must be zero.
struct ExitCode {
    SystemExitCode system;
    uint8 user;
}

/// @notice Data associated with a receipt which is used for both input and
/// output of global state.
struct ReceiptMetadata {
    /// Digest of the SystemState of a segment just before execution has begun.
    bytes32 preStateDigest;
    /// Digest of the SystemState of a segment just after execution has completed.
    bytes32 postStateDigest;
    /// The exit code for a segment
    ExitCode exitCode;
    /// A digest of the input, from the viewpoint of the guest.
    bytes32 input;
    /// A digest of the journal, from the viewpoint of the guest.
    bytes32 output;
}

library ReceiptMetadataLib {
    bytes32 constant TAG_DIGEST = sha256("risc0.ReceiptMeta");

    function digest(ReceiptMetadata memory meta) internal pure returns (bytes32) {
        return sha256(
            abi.encodePacked(
                TAG_DIGEST,
                // down
                meta.input,
                meta.preStateDigest,
                meta.postStateDigest,
                meta.output,
                // data
                uint32(meta.exitCode.system) << 24,
                uint32(meta.exitCode.user) << 24,
                // down.length
                uint16(4) << 8
            )
        );
    }
}

struct Receipt {
    bytes seal;
    ReceiptMetadata meta;
}

interface IRiscZeroVerifier {
    /// @notice verify that the given receipt is a valid Groth16 RISC Zero recursion receipt.
    /// @return true if the receipt passes the verification checks.
    function verify(Receipt calldata receipt) external view returns (bool);

    /// @notice verifies that the given seal is a valid Groth16 RISC Zero proof of execution over the
    ///     given image ID, post-state digest, and journal. Asserts that the input hash
    //      is all-zeros (i.e. no committed input) and the exit code is (Halted, 0).
    /// @return true if the receipt passes the verification checks.
    function verify(bytes calldata seal, bytes32 imageId, bytes32 postStateDigest, bytes32 journalHash)
        external
        view
        returns (bool);

    /// @notice verifies that the given seal is a valid Groth16 RISC Zero proof of execution over the
    ///     given image ID, post-state digest, and full journal. Asserts that the input hash
    //      is all-zeros (i.e. no committed input) and the exit code is (Halted, 0).
    /// @return true if the receipt passes the verification checks.
    function verify(bytes memory seal, bytes32 imageId, bytes32 postStateDigest, bytes calldata journal)
        external
        view
        returns (bool);
}

File 6 of 7 : ZRPLibs.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.21;

library Types {
    enum DepositState {
        Waiting,
        Claimed,
        Withdrawn
    }

    struct Deposit {
        DepositState state;
        uint256 salt;
        address token;
        uint256 amount;
        bytes32 claimId;
        bytes32 depositId;
    }

    struct Proof {
        bytes seal;
        bytes32 postStateDigest;
        bytes journal;
    }
}

library Errors {
    error DepositFailed(bytes32 id);
    error ClaimFailed(bytes32 id);
    error WithdrawFailed(bytes32 id);
    error DepositAlreadyExists(bytes32 id);
    error DepositDoesNotExist(bytes32 id);
    error InvalidProof(Types.Proof proof);
    error InvalidDepositState(bytes32 id);
    error InvalidFee();
}

library Events {
    /**
     * @dev Emitted when a claim is made.
     * @param id An identifier for the claim.
     * @param account The address of the claimant.
     * @param amount The amount claimed.
     */
    event Claimed(bytes indexed id, address indexed account, uint256 amount);

    /**
     * @dev Emitted when a deposit is made.
     * @param id An identifier for the deposit.
     * @param account The address of the depositor.
     * @param amount The amount deposited.
     */
    event Deposited(bytes indexed id, address indexed account, uint256 amount);

    /**
     * @dev Emitted when funds are withdrawn from a deposit.
     * @param id An identifier for the deposit.
     * @param account The address of the account withdrawing funds.
     * @param amount The amount withdrawn.
     */
    event Withdrawn(bytes indexed id, address indexed account, uint256 amount);
}

File 7 of 7 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @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;
    }
}

Settings
{
  "remappings": [
    "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/",
    "openzeppelin/=lib/openzeppelin-contracts/contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "libraries": {}
}

Contract ABI

[{"inputs":[{"internalType":"contract IRiscZeroVerifier","name":"initVerifier","type":"address"},{"internalType":"bytes32","name":"initImgId","type":"bytes32"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"bytes32","name":"id","type":"bytes32"}],"name":"ClaimFailed","type":"error"},{"inputs":[{"internalType":"bytes32","name":"id","type":"bytes32"}],"name":"DepositAlreadyExists","type":"error"},{"inputs":[{"internalType":"bytes32","name":"id","type":"bytes32"}],"name":"DepositFailed","type":"error"},{"inputs":[{"internalType":"bytes32","name":"id","type":"bytes32"}],"name":"InvalidDepositState","type":"error"},{"inputs":[],"name":"InvalidFee","type":"error"},{"inputs":[{"components":[{"internalType":"bytes","name":"seal","type":"bytes"},{"internalType":"bytes32","name":"postStateDigest","type":"bytes32"},{"internalType":"bytes","name":"journal","type":"bytes"}],"internalType":"struct Types.Proof","name":"proof","type":"tuple"}],"name":"InvalidProof","type":"error"},{"inputs":[{"internalType":"bytes32","name":"id","type":"bytes32"}],"name":"WithdrawFailed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes","name":"id","type":"bytes"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes","name":"id","type":"bytes"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes","name":"id","type":"bytes"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calculateFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"address","name":"token","type":"address"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"claimBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"id","type":"bytes"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"salt","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"depositBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"id","type":"bytes"},{"internalType":"address","name":"token","type":"address"}],"name":"getClaimId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"depositor","type":"address"},{"internalType":"bytes","name":"id","type":"bytes"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"salt","type":"uint256"}],"name":"getDepositId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"imageId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"feePercentage","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"newImageId","type":"bytes32"}],"name":"setImageId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IRiscZeroVerifier","name":"newVerifier","type":"address"}],"name":"setVerifier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"verifier","outputs":[{"internalType":"contract IRiscZeroVerifier","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"token","type":"address"}],"name":"withdrawContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"id","type":"bytes"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"salt","type":"uint256"}],"name":"withdrawDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50604051611a50380380611a5083398101604081905261002f916100be565b6100383361006e565b6000805460ff60a01b19169055600380546001600160a01b0319166001600160a01b0393909316929092179091556001556100f8565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080604083850312156100d157600080fd5b82516001600160a01b03811681146100e857600080fd5b6020939093015192949293505050565b611949806101076000396000f3fe60806040526004361061012a5760003560e01c806376ba6fb0116100ab57806399a5d7471161006f57806399a5d7471461033057806399d32fc414610350578063e80f57ef14610366578063ef3f7dd514610393578063f2fde38b146103a9578063f876cbcc146103c957600080fd5b806376ba6fb0146102905780637f28eee5146102bd5780638456cb59146102dd5780638da5cb5b146102f2578063901129c21461031057600080fd5b80635c975abb116100f25780635c975abb146101f15780635f7101b51461021b57806363a87cad1461023b57806369fe0e2d1461025b578063715018a61461027b57600080fd5b80632b7ac3f31461012f5780633f4ba83a1461016c578063415b1f901461018357806341fcb612146101b15780635437988d146101d1575b600080fd5b34801561013b57600080fd5b5060035461014f906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561017857600080fd5b506101816103dc565b005b34801561018f57600080fd5b506101a361019e36600461139d565b6103ee565b604051908152602001610163565b3480156101bd57600080fd5b506101816101cc366004611407565b610425565b3480156101dd57600080fd5b506101816101ec366004611459565b6107a4565b3480156101fd57600080fd5b50600054600160a01b900460ff166040519015158152602001610163565b34801561022757600080fd5b506101a3610236366004611407565b6107ce565b34801561024757600080fd5b5061018161025636600461147d565b610805565b34801561026757600080fd5b506101816102763660046114ab565b6109be565b34801561028757600080fd5b506101816109ec565b34801561029c57600080fd5b506101a36102ab3660046114ab565b60066020526000908152604090205481565b3480156102c957600080fd5b506101816102d83660046114c4565b6109fe565b3480156102e957600080fd5b50610181610cad565b3480156102fe57600080fd5b506000546001600160a01b031661014f565b34801561031c57600080fd5b5061018161032b3660046114ab565b610cbd565b34801561033c57600080fd5b506101a361034b3660046114ab565b610cca565b34801561035c57600080fd5b506101a360025481565b34801561037257600080fd5b506101a36103813660046114ab565b60056020526000908152604090205481565b34801561039f57600080fd5b506101a360015481565b3480156103b557600080fd5b506101816103c4366004611459565b610ce6565b6101816103d736600461151e565b610d5f565b6103e46110a8565b6103ec611102565b565b600061041c856040518060400160405280600781526020016619195c1bdcda5d60ca1b815250868686611157565b95945050505050565b61042d611193565b60008280602001905181019061044391906115ee565b600354815160015460208401516040808601519051631a36ed7560e01b81529596506001600160a01b0390941694631a36ed7594610486949392916004016116cb565b602060405180830381865afa1580156104a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c79190611707565b6104ef57806040516335a9267d60e11b81526004016104e69190611729565b60405180910390fd5b600080826040015180602001905181019061050a919061176c565b90925090506001600160a01b038216331461053a57826040516335a9267d60e11b81526004016104e69190611729565b600061054682866107ce565b600081815260056020908152604080832083905560098252808320546008909252822054929350915b82811015610645576000848152600960205260408120805483908110610597576105976117bd565b906000526020600020015490506000600482815481106105b9576105b96117bd565b6000918252602082206006909102019150815460ff1660028111156105e0576105e06117d3565b1480156105fc575060028101546001600160a01b038b81169116145b15610632576005810154600090815260066020526040812055805460ff19166001178155600381015461062f90856117ff565b93505b50508061063e90611812565b905061056f565b50600083815260086020526040902082905561066081610cca565b61066a908261182b565b90506001600160a01b0387166106b6576040516001600160a01b0386169082156108fc029083906000818181858888f193505050501580156106b0573d6000803e3d6000fd5b50610748565b60405163a9059cbb60e01b81526001600160a01b0386811660048301526024820183905288169063a9059cbb906044016020604051808303816000875af1158015610705573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107299190611707565b61074857604051629c0e8960e71b8152600481018490526024016104e6565b846001600160a01b031684604051610760919061183e565b604051908190038120838252907f97685423965df1732c67ed60f69fbd53f2eafca81dddd0bcfe905b1a76b32d319060200160405180910390a35050505050505050565b6107ac6110a8565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b60006107fc600060405180604001604052806005815260200164636c61696d60d81b81525085856000611157565b90505b92915050565b61080d6110a8565b6001600160a01b038116610856576040516001600160a01b038316904780156108fc02916000818181858888f19350505050158015610850573d6000803e3d6000fd5b50610961565b6040516370a0823160e01b81523060048201526001600160a01b0382169063a9059cbb90849083906370a0823190602401602060405180830381865afa1580156108a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c8919061185a565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015610913573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109379190611707565b6109615760405163750a3f5960e11b81526718dbdb9d1c9858dd60c21b60048201526024016104e6565b6040516718dbdb9d1c9858dd60c21b81526001600160a01b03831690600801604051908190038120478252907f7d4141f03fecf4bb26cb9fd7464e19b32fcf0aaa3937d846a6fa981c82087f029060200160405180910390a35050565b6109c66110a8565b606481106109e7576040516358d620b360e01b815260040160405180910390fd5b600255565b6109f46110a8565b6103ec60006111e0565b610a06611193565b6000610a14338585856103ee565b60008181526007602052604090205490915060ff16610a495760405163750a3f5960e11b8152600481018290526024016104e6565b6000610a5585856107ce565b600081815260096020526040812054919250805b82811015610b53576000848152600960205260408120805483908110610a9157610a916117bd565b90600052602060002001549050600060048281548110610ab357610ab36117bd565b90600052602060002090600602019050868160050154148015610ae5575060028101546001600160a01b038a81169116145b15610b40576000815460ff166002811115610b0257610b026117d3565b14610b2357604051636270a58b60e11b8152600481018890526024016104e6565b805460ff191660021781556003810154610b3d90856117ff565b93505b505080610b4c90611812565b9050610a69565b506000848152600660209081526040808320839055858352600590915281208054839290610b8290849061182b565b90915550506001600160a01b038616610bc857604051339082156108fc029083906000818181858888f19350505050158015610bc2573d6000803e3d6000fd5b50610c59565b60405163a9059cbb60e01b8152336004820152602481018290526001600160a01b0387169063a9059cbb906044016020604051808303816000875af1158015610c15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c399190611707565b610c595760405163750a3f5960e11b8152600481018490526024016104e6565b6040513390610c6990899061183e565b604051908190038120838252907f7d4141f03fecf4bb26cb9fd7464e19b32fcf0aaa3937d846a6fa981c82087f02906020015b60405180910390a350505050505050565b610cb56110a8565b6103ec611230565b610cc56110a8565b600155565b6000606460025483610cdc9190611873565b6107ff919061188a565b610cee6110a8565b6001600160a01b038116610d535760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104e6565b610d5c816111e0565b50565b610d67611193565b6000610d75338686856103ee565b60008181526007602052604090205490915060ff1615610dab57604051633a233a5760e11b8152600481018290526024016104e6565b6000610db786866107ce565b905060006040518060c0016040528060006002811115610dd957610dd96117d3565b8152602081018690526001600160a01b0388166040820152606081018790526080810184905260a0018490526004805460018181018355600092909252825160069091027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01805493945084939092839160ff191690836002811115610e6157610e616117d3565b02179055506020828101516001838101919091556040808501516002850180546001600160a01b0319166001600160a01b0390921691909117905560608501516003850155608085015160048086019190915560a090950151600590940193909355600087815260078352838120805460ff19168317905586815260099092529190209154610ef0919061182b565b815460018101835560009283526020909220909101556001600160a01b038616610f8357843414610f3757604051634d98a88760e11b8152600481018390526024016104e6565b60008381526006602052604081208054349290610f559084906117ff565b909155505060008281526005602052604081208054349290610f789084906117ff565b909155506110619050565b6040516323b872dd60e01b8152336004820152306024820152604481018690526001600160a01b038716906323b872dd906064016020604051808303816000875af1158015610fd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffa9190611707565b61101a57604051634d98a88760e11b8152600481018390526024016104e6565b600083815260066020526040812080548792906110389084906117ff565b90915550506000828152600560205260408120805487929061105b9084906117ff565b90915550505b604051339061107190899061183e565b604051908190038120878252907f4af1fa071b9000a5158e59801a6779410006d4df8be38cc6dd395bc05eb9387d90602001610c9c565b6000546001600160a01b031633146103ec5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104e6565b61110a611273565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600085858585856040516020016111729594939291906118ac565b60405160208183030381529060405280519060200120905095945050505050565b600054600160a01b900460ff16156103ec5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016104e6565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b611238611193565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861113a3390565b600054600160a01b900460ff166103ec5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016104e6565b6001600160a01b0381168114610d5c57600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611317576113176112d8565b604052919050565b600067ffffffffffffffff821115611339576113396112d8565b50601f01601f191660200190565b600082601f83011261135857600080fd5b813561136b6113668261131f565b6112ee565b81815284602083860101111561138057600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080608085870312156113b357600080fd5b84356113be816112c3565b9350602085013567ffffffffffffffff8111156113da57600080fd5b6113e687828801611347565b93505060408501356113f7816112c3565b9396929550929360600135925050565b6000806040838503121561141a57600080fd5b823567ffffffffffffffff81111561143157600080fd5b61143d85828601611347565b925050602083013561144e816112c3565b809150509250929050565b60006020828403121561146b57600080fd5b8135611476816112c3565b9392505050565b6000806040838503121561149057600080fd5b823561149b816112c3565b9150602083013561144e816112c3565b6000602082840312156114bd57600080fd5b5035919050565b6000806000606084860312156114d957600080fd5b833567ffffffffffffffff8111156114f057600080fd5b6114fc86828701611347565b935050602084013561150d816112c3565b929592945050506040919091013590565b6000806000806080858703121561153457600080fd5b843567ffffffffffffffff81111561154b57600080fd5b61155787828801611347565b9450506020850135611568816112c3565b93969395505050506040820135916060013590565b60005b83811015611598578181015183820152602001611580565b50506000910152565b600082601f8301126115b257600080fd5b81516115c06113668261131f565b8181528460208386010111156115d557600080fd5b6115e682602083016020870161157d565b949350505050565b60006020828403121561160057600080fd5b815167ffffffffffffffff8082111561161857600080fd5b908301906060828603121561162c57600080fd5b604051606081018181108382111715611647576116476112d8565b60405282518281111561165957600080fd5b611665878286016115a1565b8252506020830151602082015260408301518281111561168457600080fd5b611690878286016115a1565b60408301525095945050505050565b600081518084526116b781602086016020860161157d565b601f01601f19169290920160200192915050565b6080815260006116de608083018761169f565b85602084015284604084015282810360608401526116fc818561169f565b979650505050505050565b60006020828403121561171957600080fd5b8151801515811461147657600080fd5b602081526000825160606020840152611745608084018261169f565b9050602084015160408401526040840151601f1984830301606085015261041c828261169f565b6000806040838503121561177f57600080fd5b825161178a816112c3565b602084015190925067ffffffffffffffff8111156117a757600080fd5b6117b3858286016115a1565b9150509250929050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808201808211156107ff576107ff6117e9565b600060018201611824576118246117e9565b5060010190565b818103818111156107ff576107ff6117e9565b6000825161185081846020870161157d565b9190910192915050565b60006020828403121561186c57600080fd5b5051919050565b80820281158282048414176107ff576107ff6117e9565b6000826118a757634e487b7160e01b600052601260045260246000fd5b500490565b60006bffffffffffffffffffffffff19808860601b16835286516118d7816014860160208b0161157d565b8651908401906118ee816014840160208b0161157d565b60609690961b919091169401601481019490945250506028820152604801939250505056fea2646970667358221220416c92937a72d454d4b22461614b498e9027beedbff9b6a82fc023b85149471f64736f6c634300081500330000000000000000000000000cbc65909efe3d6fe589dfffb2ac86350b25fcc86f50f38d71230bc1da1593cbedc1433f12a671cb69571a08d39bfafd2e21c5ce

Deployed Bytecode

0x60806040526004361061012a5760003560e01c806376ba6fb0116100ab57806399a5d7471161006f57806399a5d7471461033057806399d32fc414610350578063e80f57ef14610366578063ef3f7dd514610393578063f2fde38b146103a9578063f876cbcc146103c957600080fd5b806376ba6fb0146102905780637f28eee5146102bd5780638456cb59146102dd5780638da5cb5b146102f2578063901129c21461031057600080fd5b80635c975abb116100f25780635c975abb146101f15780635f7101b51461021b57806363a87cad1461023b57806369fe0e2d1461025b578063715018a61461027b57600080fd5b80632b7ac3f31461012f5780633f4ba83a1461016c578063415b1f901461018357806341fcb612146101b15780635437988d146101d1575b600080fd5b34801561013b57600080fd5b5060035461014f906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561017857600080fd5b506101816103dc565b005b34801561018f57600080fd5b506101a361019e36600461139d565b6103ee565b604051908152602001610163565b3480156101bd57600080fd5b506101816101cc366004611407565b610425565b3480156101dd57600080fd5b506101816101ec366004611459565b6107a4565b3480156101fd57600080fd5b50600054600160a01b900460ff166040519015158152602001610163565b34801561022757600080fd5b506101a3610236366004611407565b6107ce565b34801561024757600080fd5b5061018161025636600461147d565b610805565b34801561026757600080fd5b506101816102763660046114ab565b6109be565b34801561028757600080fd5b506101816109ec565b34801561029c57600080fd5b506101a36102ab3660046114ab565b60066020526000908152604090205481565b3480156102c957600080fd5b506101816102d83660046114c4565b6109fe565b3480156102e957600080fd5b50610181610cad565b3480156102fe57600080fd5b506000546001600160a01b031661014f565b34801561031c57600080fd5b5061018161032b3660046114ab565b610cbd565b34801561033c57600080fd5b506101a361034b3660046114ab565b610cca565b34801561035c57600080fd5b506101a360025481565b34801561037257600080fd5b506101a36103813660046114ab565b60056020526000908152604090205481565b34801561039f57600080fd5b506101a360015481565b3480156103b557600080fd5b506101816103c4366004611459565b610ce6565b6101816103d736600461151e565b610d5f565b6103e46110a8565b6103ec611102565b565b600061041c856040518060400160405280600781526020016619195c1bdcda5d60ca1b815250868686611157565b95945050505050565b61042d611193565b60008280602001905181019061044391906115ee565b600354815160015460208401516040808601519051631a36ed7560e01b81529596506001600160a01b0390941694631a36ed7594610486949392916004016116cb565b602060405180830381865afa1580156104a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c79190611707565b6104ef57806040516335a9267d60e11b81526004016104e69190611729565b60405180910390fd5b600080826040015180602001905181019061050a919061176c565b90925090506001600160a01b038216331461053a57826040516335a9267d60e11b81526004016104e69190611729565b600061054682866107ce565b600081815260056020908152604080832083905560098252808320546008909252822054929350915b82811015610645576000848152600960205260408120805483908110610597576105976117bd565b906000526020600020015490506000600482815481106105b9576105b96117bd565b6000918252602082206006909102019150815460ff1660028111156105e0576105e06117d3565b1480156105fc575060028101546001600160a01b038b81169116145b15610632576005810154600090815260066020526040812055805460ff19166001178155600381015461062f90856117ff565b93505b50508061063e90611812565b905061056f565b50600083815260086020526040902082905561066081610cca565b61066a908261182b565b90506001600160a01b0387166106b6576040516001600160a01b0386169082156108fc029083906000818181858888f193505050501580156106b0573d6000803e3d6000fd5b50610748565b60405163a9059cbb60e01b81526001600160a01b0386811660048301526024820183905288169063a9059cbb906044016020604051808303816000875af1158015610705573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107299190611707565b61074857604051629c0e8960e71b8152600481018490526024016104e6565b846001600160a01b031684604051610760919061183e565b604051908190038120838252907f97685423965df1732c67ed60f69fbd53f2eafca81dddd0bcfe905b1a76b32d319060200160405180910390a35050505050505050565b6107ac6110a8565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b60006107fc600060405180604001604052806005815260200164636c61696d60d81b81525085856000611157565b90505b92915050565b61080d6110a8565b6001600160a01b038116610856576040516001600160a01b038316904780156108fc02916000818181858888f19350505050158015610850573d6000803e3d6000fd5b50610961565b6040516370a0823160e01b81523060048201526001600160a01b0382169063a9059cbb90849083906370a0823190602401602060405180830381865afa1580156108a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c8919061185a565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015610913573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109379190611707565b6109615760405163750a3f5960e11b81526718dbdb9d1c9858dd60c21b60048201526024016104e6565b6040516718dbdb9d1c9858dd60c21b81526001600160a01b03831690600801604051908190038120478252907f7d4141f03fecf4bb26cb9fd7464e19b32fcf0aaa3937d846a6fa981c82087f029060200160405180910390a35050565b6109c66110a8565b606481106109e7576040516358d620b360e01b815260040160405180910390fd5b600255565b6109f46110a8565b6103ec60006111e0565b610a06611193565b6000610a14338585856103ee565b60008181526007602052604090205490915060ff16610a495760405163750a3f5960e11b8152600481018290526024016104e6565b6000610a5585856107ce565b600081815260096020526040812054919250805b82811015610b53576000848152600960205260408120805483908110610a9157610a916117bd565b90600052602060002001549050600060048281548110610ab357610ab36117bd565b90600052602060002090600602019050868160050154148015610ae5575060028101546001600160a01b038a81169116145b15610b40576000815460ff166002811115610b0257610b026117d3565b14610b2357604051636270a58b60e11b8152600481018890526024016104e6565b805460ff191660021781556003810154610b3d90856117ff565b93505b505080610b4c90611812565b9050610a69565b506000848152600660209081526040808320839055858352600590915281208054839290610b8290849061182b565b90915550506001600160a01b038616610bc857604051339082156108fc029083906000818181858888f19350505050158015610bc2573d6000803e3d6000fd5b50610c59565b60405163a9059cbb60e01b8152336004820152602481018290526001600160a01b0387169063a9059cbb906044016020604051808303816000875af1158015610c15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c399190611707565b610c595760405163750a3f5960e11b8152600481018490526024016104e6565b6040513390610c6990899061183e565b604051908190038120838252907f7d4141f03fecf4bb26cb9fd7464e19b32fcf0aaa3937d846a6fa981c82087f02906020015b60405180910390a350505050505050565b610cb56110a8565b6103ec611230565b610cc56110a8565b600155565b6000606460025483610cdc9190611873565b6107ff919061188a565b610cee6110a8565b6001600160a01b038116610d535760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104e6565b610d5c816111e0565b50565b610d67611193565b6000610d75338686856103ee565b60008181526007602052604090205490915060ff1615610dab57604051633a233a5760e11b8152600481018290526024016104e6565b6000610db786866107ce565b905060006040518060c0016040528060006002811115610dd957610dd96117d3565b8152602081018690526001600160a01b0388166040820152606081018790526080810184905260a0018490526004805460018181018355600092909252825160069091027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01805493945084939092839160ff191690836002811115610e6157610e616117d3565b02179055506020828101516001838101919091556040808501516002850180546001600160a01b0319166001600160a01b0390921691909117905560608501516003850155608085015160048086019190915560a090950151600590940193909355600087815260078352838120805460ff19168317905586815260099092529190209154610ef0919061182b565b815460018101835560009283526020909220909101556001600160a01b038616610f8357843414610f3757604051634d98a88760e11b8152600481018390526024016104e6565b60008381526006602052604081208054349290610f559084906117ff565b909155505060008281526005602052604081208054349290610f789084906117ff565b909155506110619050565b6040516323b872dd60e01b8152336004820152306024820152604481018690526001600160a01b038716906323b872dd906064016020604051808303816000875af1158015610fd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffa9190611707565b61101a57604051634d98a88760e11b8152600481018390526024016104e6565b600083815260066020526040812080548792906110389084906117ff565b90915550506000828152600560205260408120805487929061105b9084906117ff565b90915550505b604051339061107190899061183e565b604051908190038120878252907f4af1fa071b9000a5158e59801a6779410006d4df8be38cc6dd395bc05eb9387d90602001610c9c565b6000546001600160a01b031633146103ec5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104e6565b61110a611273565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600085858585856040516020016111729594939291906118ac565b60405160208183030381529060405280519060200120905095945050505050565b600054600160a01b900460ff16156103ec5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016104e6565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b611238611193565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861113a3390565b600054600160a01b900460ff166103ec5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016104e6565b6001600160a01b0381168114610d5c57600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611317576113176112d8565b604052919050565b600067ffffffffffffffff821115611339576113396112d8565b50601f01601f191660200190565b600082601f83011261135857600080fd5b813561136b6113668261131f565b6112ee565b81815284602083860101111561138057600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080608085870312156113b357600080fd5b84356113be816112c3565b9350602085013567ffffffffffffffff8111156113da57600080fd5b6113e687828801611347565b93505060408501356113f7816112c3565b9396929550929360600135925050565b6000806040838503121561141a57600080fd5b823567ffffffffffffffff81111561143157600080fd5b61143d85828601611347565b925050602083013561144e816112c3565b809150509250929050565b60006020828403121561146b57600080fd5b8135611476816112c3565b9392505050565b6000806040838503121561149057600080fd5b823561149b816112c3565b9150602083013561144e816112c3565b6000602082840312156114bd57600080fd5b5035919050565b6000806000606084860312156114d957600080fd5b833567ffffffffffffffff8111156114f057600080fd5b6114fc86828701611347565b935050602084013561150d816112c3565b929592945050506040919091013590565b6000806000806080858703121561153457600080fd5b843567ffffffffffffffff81111561154b57600080fd5b61155787828801611347565b9450506020850135611568816112c3565b93969395505050506040820135916060013590565b60005b83811015611598578181015183820152602001611580565b50506000910152565b600082601f8301126115b257600080fd5b81516115c06113668261131f565b8181528460208386010111156115d557600080fd5b6115e682602083016020870161157d565b949350505050565b60006020828403121561160057600080fd5b815167ffffffffffffffff8082111561161857600080fd5b908301906060828603121561162c57600080fd5b604051606081018181108382111715611647576116476112d8565b60405282518281111561165957600080fd5b611665878286016115a1565b8252506020830151602082015260408301518281111561168457600080fd5b611690878286016115a1565b60408301525095945050505050565b600081518084526116b781602086016020860161157d565b601f01601f19169290920160200192915050565b6080815260006116de608083018761169f565b85602084015284604084015282810360608401526116fc818561169f565b979650505050505050565b60006020828403121561171957600080fd5b8151801515811461147657600080fd5b602081526000825160606020840152611745608084018261169f565b9050602084015160408401526040840151601f1984830301606085015261041c828261169f565b6000806040838503121561177f57600080fd5b825161178a816112c3565b602084015190925067ffffffffffffffff8111156117a757600080fd5b6117b3858286016115a1565b9150509250929050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808201808211156107ff576107ff6117e9565b600060018201611824576118246117e9565b5060010190565b818103818111156107ff576107ff6117e9565b6000825161185081846020870161157d565b9190910192915050565b60006020828403121561186c57600080fd5b5051919050565b80820281158282048414176107ff576107ff6117e9565b6000826118a757634e487b7160e01b600052601260045260246000fd5b500490565b60006bffffffffffffffffffffffff19808860601b16835286516118d7816014860160208b0161157d565b8651908401906118ee816014840160208b0161157d565b60609690961b919091169401601481019490945250506028820152604801939250505056fea2646970667358221220416c92937a72d454d4b22461614b498e9027beedbff9b6a82fc023b85149471f64736f6c63430008150033

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

0000000000000000000000000cbc65909efe3d6fe589dfffb2ac86350b25fcc86f50f38d71230bc1da1593cbedc1433f12a671cb69571a08d39bfafd2e21c5ce

-----Decoded View---------------
Arg [0] : initVerifier (address): 0x0cbC65909eFE3d6fE589DfFFb2aC86350b25Fcc8
Arg [1] : initImgId (bytes32): 0x6f50f38d71230bc1da1593cbedc1433f12a671cb69571a08d39bfafd2e21c5ce

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000000cbc65909efe3d6fe589dfffb2ac86350b25fcc8
Arg [1] : 6f50f38d71230bc1da1593cbedc1433f12a671cb69571a08d39bfafd2e21c5ce


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

Txn 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.