ZLinkCore

Description:

Multi-signature wallet contract requiring multiple confirmations for transaction execution.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

{{
  "language": "Solidity",
  "sources": {
    "@openzeppelin/contracts/access/Ownable.sol": {
      "content": "// 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);
    }
}
"
    },
    "@openzeppelin/contracts/interfaces/IERC1363.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1363.sol)

pragma solidity >=0.6.2;

import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";

/**
 * @title IERC1363
 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
 *
 * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
 * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
 */
interface IERC1363 is IERC20, IERC165 {
    /*
     * Note: the ERC-165 identifier for this interface is 0xb0202a11.
     * 0xb0202a11 ===
     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^
     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
     */

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @param data Additional data with no specified format, sent in call to `spender`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}
"
    },
    "@openzeppelin/contracts/interfaces/IERC165.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC165.sol)

pragma solidity >=0.4.16;

import {IERC165} from "../utils/introspection/IERC165.sol";
"
    },
    "@openzeppelin/contracts/interfaces/IERC20.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol)

pragma solidity >=0.4.16;

import {IERC20} from "../token/ERC20/IERC20.sol";
"
    },
    "@openzeppelin/contracts/token/ERC20/IERC20.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)

pragma solidity >=0.4.16;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
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 value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

    /**
     * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` 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 value) external returns (bool);
}
"
    },
    "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC-20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    /**
     * @dev An operation with an ERC-20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.
     */
    function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {
        return _callOptionalReturnBool(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.
     */
    function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {
        return _callOptionalReturnBool(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     *
     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
     * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
     * set here.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            safeTransfer(token, to, value);
        } else if (!token.transferAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
     * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferFromAndCallRelaxed(
        IERC1363 token,
        address from,
        address to,
        uint256 value,
        bytes memory data
    ) internal {
        if (to.code.length == 0) {
            safeTransferFrom(token, from, to, value);
        } else if (!token.transferFromAndCall(from, to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
     * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
     * once without retrying, and relies on the returned value to be true.
     *
     * Reverts if the returned value is other than `true`.
     */
    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            forceApprove(token, to, value);
        } else if (!token.approveAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            // bubble errors
            if iszero(success) {
                let ptr := mload(0x40)
                returndatacopy(ptr, 0, returndatasize())
                revert(ptr, returndatasize())
            }
            returnSize := returndatasize()
            returnValue := mload(0)
        }

        if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        bool success;
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            returnSize := returndatasize()
            returnValue := mload(0)
        }
        return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
    }
}
"
    },
    "@openzeppelin/contracts/utils/Context.sol": {
      "content": "// 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;
    }
}
"
    },
    "@openzeppelin/contracts/utils/introspection/IERC165.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)

pragma solidity >=0.4.16;

/**
 * @dev Interface of the ERC-165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[ERC].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
"
    },
    "@openzeppelin/contracts/utils/Pausable.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (utils/Pausable.sol)

pragma solidity ^0.8.20;

import {Context} from "../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 {
    bool private _paused;

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

    /**
     * @dev The operation failed because the contract is paused.
     */
    error EnforcedPause();

    /**
     * @dev The operation failed because the contract is not paused.
     */
    error ExpectedPause();

    /**
     * @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 {
        if (paused()) {
            revert EnforcedPause();
        }
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        if (!paused()) {
            revert ExpectedPause();
        }
    }

    /**
     * @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());
    }
}
"
    },
    "@openzeppelin/contracts/utils/ReentrancyGuard.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,
 * consider using {ReentrancyGuardTransient} instead.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant NOT_ENTERED = 1;
    uint256 private constant ENTERED = 2;

    uint256 private _status;

    /**
     * @dev Unauthorized reentrant call.
     */
    error ReentrancyGuardReentrantCall();

    constructor() {
        _status = NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be NOT_ENTERED
        if (_status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

        // Any calls to nonReentrant after this point will fail
        _status = ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == ENTERED;
    }
}
"
    },
    "contracts/assetManagerVault.sol": {
      "content": "// SPDX-License-Identifier: MIT\r
pragma solidity ^0.8.28;\r
\r
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";\r
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";\r
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";\r
\r
contract AssetManagerVault is ReentrancyGuard {\r
    using SafeERC20 for IERC20;\r
\r
    address public immutable tokenAddress;\r
    address public immutable zlinkCore;\r
\r
    event FundsTransferred(address indexed to, uint256 amount);\r
\r
    error NotAuthorized();\r
    error ETHTransferFailed();\r
    error NotETHVault();\r
\r
    constructor(address _tokenAddress, address _zlinkCore) {\r
        require(_zlinkCore != address(0), "Invalid core address");\r
        tokenAddress = _tokenAddress;\r
        zlinkCore = _zlinkCore;\r
    }\r
\r
    /// @notice Transfer funds from vault\r
    /// @param _to Recipient address\r
    /// @param _amount Amount to transfer\r
    function transferFunds(\r
        address _to,\r
        uint256 _amount\r
    ) external onlyZlinkCore nonReentrant returns (bool) {\r
        if (_to == address(0)) revert InvalidRecipient();\r
        if (_amount == 0) revert InvalidAmount();\r
\r
        if (tokenAddress == address(0)) {\r
            // Native ETH transfer\r
            (bool success, ) = payable(_to).call{value: _amount}("");\r
            if (!success) revert ETHTransferFailed();\r
        } else {\r
            // ERC20 transfer\r
            IERC20(tokenAddress).safeTransfer(_to, _amount);\r
        }\r
\r
        emit FundsTransferred(_to, _amount);\r
        return true;\r
    }\r
\r
    /// @notice Get current vault balance\r
    function getBalance() external view returns (uint256) {\r
        if (tokenAddress == address(0)) {\r
            return address(this).balance;\r
        }\r
        return IERC20(tokenAddress).balanceOf(address(this));\r
    }\r
\r
    modifier onlyZlinkCore() {\r
        if (msg.sender != zlinkCore) revert NotAuthorized();\r
        _;\r
    }\r
\r
    //handle the received ETH\r
    receive() external payable {}\r
\r
    error InvalidRecipient();\r
    error InvalidAmount();\r
}\r
"
    },
    "contracts/helper.sol": {
      "content": "// SPDX-License-Identifier: MIT\r
pragma solidity ^0.8.28;\r
import "poseidon-solidity/PoseidonT3.sol";\r
import "poseidon-solidity/PoseidonT4.sol";\r
\r
abstract contract Helper {\r
    using PoseidonT3 for uint256;\r
    using PoseidonT4 for uint256;\r
\r
    bytes32 internal PADDING_NULLIFIER;\r
    bytes32 internal PADDING_OUTPUT_COMMITMENT;\r
    bytes32 internal PADDING_ROOT =\r
        0x15fe21adc085eaf101cb44fca741b8ad000d7653bf28d990fa98e5b879a493ad;\r
    uint256 internal DUMMY_SHIELDED_ADDRESS_HASH =\r
        18427227198958812348291273321396455578067858109357633012449718130990174356285;\r
    uint256 private constant FIELD_MODULUS =\r
        21888242871839275222246405745257275088548364400416034343698204186575808495617;\r
\r
    struct Proof {\r
        uint[2] pi_a;\r
        uint[2][2] pi_b;\r
        uint[2] pi_c;\r
    }\r
\r
    constructor() {\r
        PADDING_NULLIFIER = _createPaddingNullifier();\r
        PADDING_OUTPUT_COMMITMENT = _createPaddingCommitment();\r
    }\r
\r
    function _createCommitment(\r
        bytes32 pre_commitment,\r
        uint256 amount,\r
        address tokenAddress\r
    ) internal pure returns (bytes32) {\r
        return\r
            bytes32(\r
                PoseidonT4.hash(\r
                    [\r
                        uint256(pre_commitment),\r
                        amount,\r
                        uint256(uint160(tokenAddress))\r
                    ]\r
                )\r
            );\r
    }\r
\r
    function _createPaddingCommitment() private pure returns (bytes32) {\r
        //hardCoded\r
        return\r
            0x13f768915c1ecd8736e113be0807a9b322814b6d8657ea145a2a8a2e29eebc76;\r
    }\r
\r
    //create a dummy nullifier for padding\r
    function _createPaddingNullifier() private pure returns (bytes32) {\r
        bytes32 paddingCommitment = _createPaddingCommitment();\r
        uint256 paddingPrivateKey = uint256(0);\r
        return\r
            bytes32(\r
                PoseidonT3.hash([uint256(paddingCommitment), paddingPrivateKey])\r
            );\r
    }\r
\r
    function _verifyEncryptedData(\r
        bytes memory encryptedData,\r
        bytes32 publicSignalsEncryptedData\r
    ) internal pure returns (bool) {\r
        uint256 encryptedDataHash = uint256(keccak256(encryptedData));\r
\r
        uint256 publicSignalsEncryptedDataUint = uint256(\r
            publicSignalsEncryptedData\r
        );\r
\r
        return\r
            (encryptedDataHash % FIELD_MODULUS) ==\r
            (publicSignalsEncryptedDataUint % FIELD_MODULUS);\r
    }\r
\r
    function _verifyReceiverUnchanged(\r
        address receiver,\r
        uint256 publicSignalsReceiver\r
    ) internal pure returns (bool) {\r
        uint256 receiverUint = uint256(uint160(receiver));\r
        return\r
            (receiverUint % FIELD_MODULUS) ==\r
            (publicSignalsReceiver % FIELD_MODULUS);\r
    }\r
\r
    function _verifyTokenUnchanged(\r
        address tokenAddress,\r
        bytes32 publicSignalsTokenHash\r
    ) internal pure returns (bool) {\r
        uint256 publicSignalsTokenHashUint = uint256(publicSignalsTokenHash);\r
        uint256 tokenAddressUint = uint256(uint160(tokenAddress));\r
        return\r
            (tokenAddressUint % FIELD_MODULUS) ==\r
            (publicSignalsTokenHashUint % FIELD_MODULUS);\r
    }\r
}\r
"
    },
    "contracts/Tree.sol": {
      "content": "// SPDX-License-Identifier: MIT\r
pragma solidity ^0.8.28;\r
\r
import "poseidon-solidity/PoseidonT3.sol";\r
\r
contract ForestMerkleTree {\r
    using PoseidonT3 for *;\r
\r
    uint256 public constant TREE_DEPTH = 10;\r
    uint256 public constant MAX_LEAVES = 2 ** TREE_DEPTH;\r
\r
    struct Tree {\r
        bytes32 root;\r
        uint256[TREE_DEPTH] filledSubtrees;\r
        uint32 nextIndex;\r
    }\r
\r
    uint256[TREE_DEPTH] public zeros;\r
\r
    Tree[] public trees;\r
\r
    // Root history for each tree\r
    mapping(bytes32 => bool) public isKnownRoot;\r
\r
    constructor() {\r
        _initializeZeros();\r
\r
        // Create first tree\r
        Tree memory newTree;\r
\r
        //convert uint256 to bytes32\r
        newTree.root = bytes32(zeros[TREE_DEPTH - 1]);\r
\r
        for (uint i = 0; i < TREE_DEPTH; i++) {\r
            newTree.filledSubtrees[i] = zeros[i];\r
        }\r
        newTree.nextIndex = 0;\r
        trees.push(newTree);\r
\r
        // Mark initial root as known\r
        isKnownRoot[newTree.root] = true;\r
    }\r
\r
    function insertLeaf(\r
        bytes32 commitment\r
    ) internal returns (uint256 treeIndex, uint32 leafIndex) {\r
        Tree storage currentTree = trees[trees.length - 1];\r
\r
        uint256 uintLeaf = uint256(commitment);\r
\r
        if (currentTree.nextIndex >= MAX_LEAVES) {\r
            Tree memory newTree;\r
            newTree.root = bytes32(zeros[TREE_DEPTH - 1]);\r
            for (uint i = 0; i < TREE_DEPTH; i++) {\r
                newTree.filledSubtrees[i] = zeros[i];\r
            }\r
            newTree.nextIndex = 0;\r
            trees.push(newTree);\r
\r
            currentTree = trees[trees.length - 1];\r
            treeIndex = trees.length - 1;\r
\r
            isKnownRoot[newTree.root] = true;\r
        }\r
\r
        treeIndex = trees.length - 1;\r
        leafIndex = currentTree.nextIndex;\r
        uint32 index = leafIndex;\r
        uint256 currentHash = uintLeaf;\r
\r
        for (uint256 level = 0; level < TREE_DEPTH; level++) {\r
            if (index % 2 == 0) {\r
                currentTree.filledSubtrees[level] = currentHash;\r
                currentHash = _hashLeftRight(currentHash, zeros[level]);\r
            } else {\r
                currentHash = _hashLeftRight(\r
                    currentTree.filledSubtrees[level],\r
                    currentHash\r
                );\r
            }\r
            index /= 2;\r
        }\r
\r
        currentTree.root = bytes32(currentHash);\r
        currentTree.nextIndex += 1;\r
\r
        // Save root to history\r
        isKnownRoot[bytes32(currentHash)] = true;\r
    }\r
\r
    // Hash two values using Poseidon\r
    function _hashLeftRight(\r
        uint256 left,\r
        uint256 right\r
    ) internal pure returns (uint256) {\r
        return PoseidonT3.hash([left, right]);\r
    }\r
\r
    // Initialize zero hashes using Poseidon\r
    function _initializeZeros() internal {\r
        // First zero (empty leaf)\r
        zeros[0] = uint256(0);\r
\r
        // Build up the tree with Poseidon\r
        for (uint256 i = 1; i < TREE_DEPTH; i++) {\r
            zeros[i] = _hashLeftRight(zeros[i - 1], zeros[i - 1]);\r
        }\r
    }\r
\r
    function getActiveTreeIndex() external view returns (uint256) {\r
        return trees.length - 1;\r
    }\r
\r
    function getTreeRoot(uint256 treeIndex) external view returns (bytes32) {\r
        require(treeIndex < trees.length, "Invalid tree index");\r
        return trees[treeIndex].root;\r
    }\r
\r
    function isValidRoot(bytes32 root) external view returns (bool) {\r
        return isKnownRoot[root];\r
    }\r
\r
    function totalTrees() external view returns (uint256) {\r
        return trees.length;\r
    }\r
\r
    error InvalidRoot();\r
}\r
"
    },
    "contracts/verify-transfer.sol": {
      "content": "// SPDX-License-Identifier: GPL-3.0
/*
    Copyright 2021 0KIMS association.

    This file is generated with [snarkJS](https://github.com/iden3/snarkjs).

    snarkJS is a free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    snarkJS is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
    or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
    License for more details.

    You should have received a copy of the GNU General Public License
    along with snarkJS. If not, see <https://www.gnu.org/licenses/>.
*/

pragma solidity >=0.7.0 <0.9.0;

contract Groth16TransferVerifier {
    // Scalar field size
    uint256 constant r =
        21888242871839275222246405745257275088548364400416034343698204186575808495617;
    // Base field size
    uint256 constant q =
        21888242871839275222246405745257275088696311157297823662689037894645226208583;

    // Verification Key data
    uint256 constant alphax =
        20491192805390485299153009773594534940189261866228447918068658471970481763042;
    uint256 constant alphay =
        9383485363053290200918347156157836566562967994039712273449902621266178545958;
    uint256 constant betax1 =
        4252822878758300859123897981450591353533073413197771768651442665752259397132;
    uint256 constant betax2 =
        6375614351688725206403948262868962793625744043794305715222011528459656738731;
    uint256 constant betay1 =
        21847035105528745403288232691147584728191162732299865338377159692350059136679;
    uint256 constant betay2 =
        10505242626370262277552901082094356697409835680220590971873171140371331206856;
    uint256 constant gammax1 =
        11559732032986387107991004021392285783925812861821192530917403151452391805634;
    uint256 constant gammax2 =
        10857046999023057135944570762232829481370756359578518086990519993285655852781;
    uint256 constant gammay1 =
        4082367875863433681332203403145435568316851327593401208105741076214120093531;
    uint256 constant gammay2 =
        8495653923123431417604973247489272438418190587263600148770280649306958101930;
    uint256 constant deltax1 =
        14872918240917628254634844500590513038315690064686358114475150902051064958888;
    uint256 constant deltax2 =
        13627696479508984357783897925224117462623459644149496068879748920811264967125;
    uint256 constant deltay1 =
        21189046845949754343894464066778176248943057053087464154314905270419427887474;
    uint256 constant deltay2 =
        2838085524287892887316329103899891221998528098418460187180267736263625181058;

    uint256 constant IC0x =
        13823718887974999112221666217735071224079869611299204448508275301626548825777;
    uint256 constant IC0y =
        18472116368388956055657357048663681352576699484931148118536125727888492010278;

    uint256 constant IC1x =
        11393286321809325478308985254850574537550141093901738452466004675055614822264;
    uint256 constant IC1y =
        16756293670200862956097612601185683962958231145731264554809733157222459263057;

    uint256 constant IC2x =
        5093913817882725804016997078298827719024660358296852890481823944895499526155;
    uint256 constant IC2y =
        5752540902518131249541280200259997264444781441359350963006365529204004371341;

    uint256 constant IC3x =
        464931383246324969532143409397148585420928129201498735035737342658188134566;
    uint256 constant IC3y =
        21376966266548742741906442765646973860834628073191663576994030666455601487409;

    uint256 constant IC4x =
        14970961026431226709671163533341627082897959187264701843054065213236785269408;
    uint256 constant IC4y =
        21862332551022745218118996288124745629560369166739403869974286614733570104484;

    uint256 constant IC5x =
        4434225877283903796370168556387833576964330339747851677882145160428674032558;
    uint256 constant IC5y =
        8362707983860615610220424723508838320238218186666456474573841971198408211669;

    uint256 constant IC6x =
        9694576827022147883955887063736926386452154221683712199558058725693950452001;
    uint256 constant IC6y =
        2664508310350433619635857080575837751174906589380946620043519162749441602069;

    uint256 constant IC7x =
        7379184258124148212441100904437145814840313235534869353745000638592147501164;
    uint256 constant IC7y =
        3117989139867435012461902959183614365356588498584414843398166480629570891001;

    uint256 constant IC8x =
        1803373247538892666872411719516167777049773397417249880678513172469265675042;
    uint256 constant IC8y =
        7636832409441186415239336810350203371444367398390776947015120249191830152130;

    uint256 constant IC9x =
        7510203300377581056260851089329883798213942819401101458645473352937517861955;
    uint256 constant IC9y =
        11061195911124179194249214956931672736253223793638916384956515297774645601961;

    uint256 constant IC10x =
        4488825774106598212769414108380639928921973501234988576535912353757256653991;
    uint256 constant IC10y =
        13848807428821321293592651610424483490054956917247581828199188001869118387123;

    uint256 constant IC11x =
        1676836034426281789098854146776581200737704020444295821526303564582401151614;
    uint256 constant IC11y =
        11290296782939810429879085179920651358277754771478432183026089690426652057930;

    uint256 constant IC12x =
        2590414484800226763757059747570384295063494505846169554865330997802860908088;
    uint256 constant IC12y =
        5679904452804620818672976617249737581641105893733787883401375690128844226776;

    uint256 constant IC13x =
        15937505261507380124505565862032221111329067985119331746273295530772156058455;
    uint256 constant IC13y =
        19606461754891444417851915133100371766697703250786581839874834949360843398112;

    uint256 constant IC14x =
        4933565543845399245312917136281866611939443962643992004093312093913427963496;
    uint256 constant IC14y =
        21548139373486327968992546827642464093488813037168907820839517610147855632642;

    uint256 constant IC15x =
        3010699028865015326161421590973608196078236959059062927513677022905610582044;
    uint256 constant IC15y =
        16577168844103069108447615198248850117259000560303613654873294455277170698798;

    uint256 constant IC16x =
        1323619039471888285930448160825112853955180962180016790311256966072235397469;
    uint256 constant IC16y =
        21885150620335883973082917740035454616440529299324551238628979648904188152334;

    uint256 constant IC17x =
        12030396101595066024809701848210533252193029396438311773514067816835853967321;
    uint256 constant IC17y =
        2455764459166323285593947452643036017682599307037906541087920346959686779515;

    uint256 constant IC18x =
        11132816729906271156955109495281648499086368669673293223289243545359280976606;
    uint256 constant IC18y =
        2878170394380530780626802799579399919406427727341591801613926397255974035123;

    uint256 constant IC19x =
        15362260963987664942948392671693105501100199533250129759852767566896449333299;
    uint256 constant IC19y =
        9125843518192781555182146828037702314695055088339558973758840996452308436437;

    uint256 constant IC20x =
        18882752988455400170629654889981731648249398491699332334270905453388369121865;
    uint256 constant IC20y =
        914999505342073906863062048249834620380172394585728928094289884275275849170;

    uint256 constant IC21x =
        9173651092823875707198610720728447549847577875060604506562089085013357593245;
    uint256 constant IC21y =
        6144612020737364580953265094728859818515497206046829929401156931643344108642;

    uint256 constant IC22x =
        9666614940582309126539425534097925618410185054250993188860461156496600640665;
    uint256 constant IC22y =
        12063510755592988505016662304323581669926626568220062422728039643580537390952;

    uint256 constant IC23x =
        9489926431802488316427891998845199865271325707813239883866724832502358992463;
    uint256 constant IC23y =
        19649885745985766908862320364702851266641543104909475497248587029777361350648;

    uint256 constant IC24x =
        12659437436808667538571529559045547239741931270502786953602253731494266709757;
    uint256 constant IC24y =
        4985763816434750445549586572792882533246583134258843978163276700159836692834;

    uint256 constant IC25x =
        19210740567112651083868449845767496469729914153272643630693481647040749202585;
    uint256 constant IC25y =
        19522120384453423223309007454675314230400197030994007375601314398232831235071;

    uint256 constant IC26x =
        4082840296620613580409125886466757477109513955592604652465252672291613840115;
    uint256 constant IC26y =
        20243556204614285724478940150164342574199786706747785630250415603387962225666;

    uint256 constant IC27x =
        9549079520291569116686824597950374684614008767339102190177360450052849836218;
    uint256 constant IC27y =
        498302589198520473652070378851940640849258942486817298049340415496953750055;

    uint256 constant IC28x =
        7289132383011388174517321471596679355763127430975622670965291894564511408400;
    uint256 constant IC28y =
        11170239528368478863209442999824886050708423696036841724609917898433531960954;

    uint256 constant IC29x =
        4113789908691068121413194865492252010387313828130248098752444197576387515939;
    uint256 constant IC29y =
        17797413176180541822938565605995630559995184162333013406283186520810405892472;

    uint256 constant IC30x =
        8902079135137363890833325292329830772383991637295118529419966909524100010835;
    uint256 constant IC30y =
        1189528930086762457093021604612114476518203085834605281775632647381499473849;

    // Memory data
    uint16 constant pVk = 0;
    uint16 constant pPairing = 128;

    uint16 constant pLastMem = 896;

    function verifyProof(
        uint[2] calldata _pA,
        uint[2][2] calldata _pB,
        uint[2] calldata _pC,
        uint[30] calldata _pubSignals
    ) public view returns (bool) {
        assembly {
            function checkField(v) {
                if iszero(lt(v, r)) {
                    mstore(0, 0)
                    return(0, 0x20)
                }
            }

            // G1 function to multiply a G1 value(x,y) to value in an address
            function g1_mulAccC(pR, x, y, s) {
                let success
                let mIn := mload(0x40)
                mstore(mIn, x)
                mstore(add(mIn, 32), y)
                mstore(add(mIn, 64), s)

                success := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)

                if iszero(success) {
                    mstore(0, 0)
                    return(0, 0x20)
                }

                mstore(add(mIn, 64), mload(pR))
                mstore(add(mIn, 96), mload(add(pR, 32)))

                success := staticcall(sub(gas(), 2000), 6, mIn, 128, pR, 64)

                if iszero(success) {
                    mstore(0, 0)
                    return(0, 0x20)
                }
            }

            function checkPairing(pA, pB, pC, pubSignals, pMem) -> isOk {
                let _pPairing := add(pMem, pPairing)
                let _pVk := add(pMem, pVk)

                mstore(_pVk, IC0x)
                mstore(add(_pVk, 32), IC0y)

                // Compute the linear combination vk_x

                g1_mulAccC(_pVk, IC1x, IC1y, calldataload(add(pubSignals, 0)))

                g1_mulAccC(_pVk, IC2x, IC2y, calldataload(add(pubSignals, 32)))

                g1_mulAccC(_pVk, IC3x, IC3y, calldataload(add(pubSignals, 64)))

                g1_mulAccC(_pVk, IC4x, IC4y, calldataload(add(pubSignals, 96)))

                g1_mulAccC(_pVk, IC5x, IC5y, calldataload(add(pubSignals, 128)))

                g1_mulAccC(_pVk, IC6x, IC6y, calldataload(add(pubSignals, 160)))

                g1_mulAccC(_pVk, IC7x, IC7y, calldataload(add(pubSignals, 192)))

                g1_mulAccC(_pVk, IC8x, IC8y, calldataload(add(pubSignals, 224)))

                g1_mulAccC(_pVk, IC9x, IC9y, calldataload(add(pubSignals, 256)))

                g1_mulAccC(
                    _pVk,
                    IC10x,
                    IC10y,
                    calldataload(add(pubSignals, 288))
                )

                g1_mulAccC(
                    _pVk,
                    IC11x,
                    IC11y,
                    calldataload(add(pubSignals, 320))
                )

                g1_mulAccC(
                    _pVk,
                    IC12x,
                    IC12y,
                    calldataload(add(pubSignals, 352))
                )

                g1_mulAccC(
                    _pVk,
                    IC13x,
                    IC13y,
                    calldataload(add(pubSignals, 384))
                )

                g1_mulAccC(
                    _pVk,
                    IC14x,
                    IC14y,
                    calldataload(add(pubSignals, 416))
                )

                g1_mulAccC(
                    _pVk,
                    IC15x,
                    IC15y,
                    calldataload(add(pubSignals, 448))
                )

                g1_mulAccC(
                    _pVk,
                    IC16x,
                    IC16y,
                    calldataload(add(pubSignals, 480))
                )

                g1_mulAccC(
                    _pVk,
                    IC17x,
                    IC17y,
                    calldataload(add(pubSignals, 512))
                )

                g1_mulAccC(
                    _pVk,
                    IC18x,
                    IC18y,
                    calldataload(add(pubSignals, 544))
                )

                g1_mulAccC(
                    _pVk,
                    IC19x,
                    IC19y,
                    calldataload(add(pubSignals, 576))
                )

                g1_mulAccC(
                    _pVk,
                    IC20x,
                    IC20y,
                    calldataload(add(pubSignals, 608))
                )

                g1_mulAccC(
                    _pVk,
                    IC21x,
                    IC21y,
                    calldataload(add(pubSignals, 640))
                )

                g1_mulAccC(
                    _pVk,
                    IC22x,
                    IC22y,
                    calldataload(add(pubSignals, 672))
                )

                g1_mulAccC(
                    _pVk,
                    IC23x,
                    IC23y,
                    calldataload(add(pubSignals, 704))
                )

                g1_mulAccC(
                    _pVk,
                    IC24x,
                    IC24y,
                    calldataload(add(pubSignals, 736))
                )

                g1_mulAccC(
                    _pVk,
                    IC25x,
                    IC25y,
                    calldataload(add(pubSignals, 768))
                )

                g1_mulAccC(
                    _pVk,
                    IC26x,
                    IC26y,
                    calldataload(add(pubSignals, 800))
                )

                g1_mulAccC(
                    _pVk,
                    IC27x,
                    IC27y,
                    calldataload(add(pubSignals, 832))
                )

                g1_mulAccC(
                    _pVk,
                    IC28x,
                    IC28y,
                    calldataload(add(pubSignals, 864))
                )

                g1_mulAccC(
                    _pVk,
                    IC29x,
                    IC29y,
                    calldataload(add(pubSignals, 896))
                )

                g1_mulAccC(
                    _pVk,
                    IC30x,
                    IC30y,
                    calldataload(add(pubSignals, 928))
                )

                // -A
                mstore(_pPairing, calldataload(pA))
                mstore(
                    add(_pPairing, 32),
                    mod(sub(q, calldataload(add(pA, 32))), q)
                )

                // B
                mstore(add(_pPairing, 64), calldataload(pB))
                mstore(add(_pPairing, 96), calldataload(add(pB, 32)))
                mstore(add(_pPairing, 128), calldataload(add(pB, 64)))
                mstore(add(_pPairing, 160), calldataload(add(pB, 96)))

                // alpha1
                mstore(add(_pPairing, 192), alphax)
                mstore(add(_pPairing, 224), alphay)

                // beta2
                mstore(add(_pPairing, 256), betax1)
                mstore(add(_pPairing, 288), betax2)
                mstore(add(_pPairing, 320), betay1)
                mstore(add(_pPairing, 352), betay2)

                // vk_x
                mstore(add(_pPairing, 384), mload(add(pMem, pVk)))
                mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32))))

                // gamma2
                mstore(add(_pPairing, 448), gammax1)
                mstore(add(_pPairing, 480), gammax2)
                mstore(add(_pPairing, 512), gammay1)
                mstore(add(_pPairing, 544), gammay2)

                // C
                mstore(add(_pPairing, 576), calldataload(pC))
                mstore(add(_pPairing, 608), calldataload(add(pC, 32)))

                // delta2
                mstore(add(_pPairing, 640), deltax1)
                mstore(add(_pPairing, 672), deltax2)
                mstore(add(_pPairing, 704), deltay1)
                mstore(add(_pPairing, 736), deltay2)

                let success := staticcall(
                    sub(gas(), 2000),
                    8,
                    _pPairing,
                    768,
                    _pPairing,
                    0x20
                )

                isOk := and(success, mload(_pPairing))
            }

            let pMem := mload(0x40)
            mstore(0x40, add(pMem, pLastMem))

            // Validate that all evaluations ∈ F

            checkField(calldataload(add(_pubSignals, 0)))

            checkField(calldataload(add(_pubSignals, 32)))

            checkField(calldataload(add(_pubSignals, 64)))

            checkField(calldataload(add(_pubSignals, 96)))

            checkField(calldataload(add(_pubSignals, 128)))

            checkField(calldataload(add(_pubSignals, 160)))

            checkField(calldataload(add(_pubSignals, 192)))

            checkField(calldataload(add(_pubSignals, 224)))

            checkField(calldataload(add(_pubSignals, 256)))

            checkField(calldataload(add(_pubSignals, 288)))

            checkField(calldataload(add(_pubSignals, 320)))

            checkField(calldataload(add(_pubSignals, 352)))

            checkField(calldataload(add(_pubSignals, 384)))

            checkField(calldataload(add(_pubSignals, 416)))

            checkField(calldataload(add(_pubSignals, 448)))

            checkField(calldataload(add(_pubSignals, 480)))

            checkField(calldataload(add(_pubSignals, 512)))

            checkField(calldataload(add(_pubSignals, 544)))

            checkField(calldataload(add(_pubSignals, 576)))

            checkField(calldataload(add(_pubSignals, 608)))

            checkField(calldataload(add(_pubSignals, 640)))

            checkField(calldataload(add(_pubSignals, 672)))

            checkField(calldataload(add(_pubSignals, 704)))

            checkField(calldataload(add(_pubSignals, 736)))

            checkField(calldataload(add(_pubSignals, 768)))

            checkField(calldataload(add(_pubSignals, 800)))

            checkField(calldataload(add(_pubSignals, 832)))

            checkField(calldataload(add(_pubSignals, 864)))

            checkField(calldataload(add(_pubSignals, 896)))

            checkField(calldataload(add(_pubSignals, 928)))

            // Validate all evaluations
            let isValid := checkPairing(_pA, _pB, _pC, _pubSignals, pMem)

            mstore(0, isValid)
            return(0, 0x20)
        }
    }
}
"
    },
    "contracts/verify.sol": {
      "content": "// SPDX-License-Identifier: GPL-3.0
/*
    Copyright 2021 0KIMS association.

    This file is generated with [snarkJS](https://github.com/iden3/snarkjs).

    snarkJS is a free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    snarkJS is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
    or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
    License for more details.

    You should have received a copy of the GNU General Public License
    along with snarkJS. If not, see <https://www.gnu.org/licenses/>.
*/

pragma solidity >=0.7.0 <0.9.0;

contract Groth16UnshieldVerifier {
    // Scalar field size
    uint256 constant r =
        21888242871839275222246405745257275088548364400416034343698204186575808495617;
    // Base field size
    uint256 constant q =
        21888242871839275222246405745257275088696311157297823662689037894645226208583;

    // Verification Key data
    uint256 constant alphax =
        20491192805390485299153009773594534940189261866228447918068658471970481763042;
    uint256 constant alphay =
        9383485363053290200918347156157836566562967994039712273449902621266178545958;
    uint256 constant betax1 =
        4252822878758300859123897981450591353533073413197771768651442665752259397132;
    uint256 constant betax2 =
        6375614351688725206403948262868962793625744043794305715222011528459656738731;
    uint256 constant betay1 =
        21847035105528745403288232691147584728191162732299865338377159692350059136679;
    uint256 constant betay2 =
        10505242626370262277552901082094356697409835680220590971873171140371331206856;
    uint256 constant gammax1 =
        11559732032986387107991004021392285783925812861821192530917403151452391805634;
    uint256 constant gammax2 =
        10857046999023057135944570762232829481370756359578518086990519993285655852781;
    uint256 constant gammay1 =
        4082367875863433681332203403145435568316851327593401208105741076214120093531;
    uint256 constant gammay2 =
        8495653923123431417604973247489272438418190587263600148770280649306958101930;
    uint256 constant deltax1 =
        12744338258526598371940374151546952005273297886103094659438801813423897068267;
    uint256 constant deltax2 =
        20879963058749420340698873465374474336036952670416222834716495279626419278849;
    uint256 constant deltay1 =
        1528558239339088469983448099959368140148839140300800149241551722403413001809;
    uint256 constant deltay2 =
        9621916376293794023117244197252107962708479376888433273624918066434956320598;

    uint256 constant IC0x =
        4083494527830405189179797611178517012878822825844978484030877394254927380617;
    uint256 constant IC0y =
        18188675028286549627398155537754521599942959495565492407496787449622763571971;

    uint256 constant IC1x =
        9493760218134503369592178205380542342990565508613428767214020652150667696380;
    uint256 constant IC1y =
        19126788263846425246193723673407833925967262101843277784566556061789136340541;

    uint256 constant IC2x =
        11191108084233142069462397594109238010506819096342294278130600085655520787427;
    uint256 constant IC2y =
        826089400024813348807962102668217044363385665398892164764203759240669556302;

    uint256 constant IC3x =
        20960717423303151444106079789125975916810373825837609311745518459982338788216;
    uint256 constant IC3y =
        5734303151034867509078106254324264140130608229544001347880626011373335370689;

    uint256 constant IC4x =
        1783796249272083723211846228950882639098443363574332608001413197211909481384;
    uint256 constant IC4y =
        10143324996917406568024188466942839939946316712840393216387186071353924720662;

    uint256 constant IC5x =
        9042189302258883315525371539372390356336268264355079895253806415275669326798;
    uint256 constant IC5y =
        19245054318229139550167086039383725781148615881538771467738104910513125228554;

    uint256 constant IC6x =
        7398174422102

Tags:
ERC20, ERC165, Multisig, Pausable, Upgradeable, Multi-Signature, Factory|addr:0xa1adcd005edab05e653919ee14505135624aa9f7|verified:true|block:23704310|tx:0xe5bb64db2ec75c4f1c98268ee55ce851e58695b725aa65f7db6fcc01ac78abfc|first_check:1762002815

Submitted on: 2025-11-01 14:13:35

Comments

Log in to comment.

No comments yet.