CELO Price: $0.11 (-1.07%)
Gas: 25 GWei

Contract

0x99b37B76025677085bc4A93e52588D9b637F1DAe

Overview

CELO Balance

Celo Mainnet LogoCelo Mainnet LogoCelo Mainnet Logo0 CELO

CELO Value

$0.00

More Info

Private Name Tags

Multichain Info

Transaction Hash
Block
From
To

There are no matching entries

> 10 Token Transfers found.

View more zero value Internal Transactions in Advanced View mode

Advanced mode:

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
AutoUnwrapHook

Compiler Version
v0.8.27+commit.40a35a09

Optimization Enabled:
Yes with 200 runs

Other Settings:
prague EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.19 <0.9.0;

import {ExcessivelySafeCall} from "@nomad-xyz/src/ExcessivelySafeCall.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

import {IReward} from "../../interfaces/external/IReward.sol";
import {ISelfPassportSBT} from "../../interfaces/external/ISelfPassportSBT.sol";
import {IHookRegistry} from "../../interfaces/hooks/IHookRegistry.sol";
import {IERC20Lockbox} from "../../interfaces/external/IERC20Lockbox.sol";
import {IVerifiedERC20} from "../../interfaces/IVerifiedERC20.sol";
import {IHook} from "../../interfaces/hooks/IHook.sol";

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

/**
 * @title AutoUnwrapHook
 * @dev Hook to automatically unwrap the verifiedERC20 into the base token on claim incentive
 */
contract AutoUnwrapHook is BaseTransferHook {
    using SafeERC20 for IERC20;
    using SafeERC20 for IVerifiedERC20;
    using ExcessivelySafeCall for address;

    /// @notice Error thrown when the length of verifiedERC20s and lockboxes arrays do not match
    error AutoUnwrapHook_LengthMismatch();

    /// @notice Error thrown when a zero address is provided
    error AutoUnwrapHook_ZeroAddress();

    /// @notice Error thrown when the caller is not authorized to set the lockbox
    error AutoUnwrapHook_NotAuthorized(address _caller, address _verifiedERC20, address _lockbox);

    /// @notice Emitted when a lockbox is set for a verified ERC20
    event LockboxSet(address indexed verifiedERC20, address indexed lockbox);

    /// @notice Address of the voter contract to check if a transfer is a claim incentive
    address public immutable voter;

    /// @notice The address of the authorized address to check if a transfer is a claim incentive
    address public immutable authorized;

    /// @notice Mapping of verified ERC20 addresses to their corresponding lockbox addresses
    mapping(address _verifiedERC20 => address _lockbox) public lockbox;

    /**
     * @notice Initializes the SelfTransferHook
     * @param _name Name for the hook
     * @param _voter address of the voter contract
     * @param _authorized address to check if a transfer is a claim incentive
     * @param _verifiedERC20s Array of verified ERC20 addresses
     * @param _lockboxes Array of corresponding lockbox addresses for the verified ERC20s
     */
    constructor(
        string memory _name,
        address _voter,
        address _authorized,
        address[] memory _verifiedERC20s,
        address[] memory _lockboxes
    ) BaseTransferHook(_name) {
        voter = _voter;
        authorized = _authorized;

        if (_verifiedERC20s.length != _lockboxes.length) {
            revert AutoUnwrapHook_LengthMismatch();
        }

        for (uint256 i = 0; i < _verifiedERC20s.length;) {
            if (_lockboxes[i] == address(0) || _verifiedERC20s[i] == address(0)) {
                revert AutoUnwrapHook_ZeroAddress();
            }
            _setLockbox({_verifiedERC20: _verifiedERC20s[i], _lockbox: _lockboxes[i]});
            unchecked {
                i++;
            }
        }
    }

    /// @inheritdoc IHook
    function supportsEntrypoint(IHookRegistry.Entrypoint _entrypoint) external pure override returns (bool) {
        return _entrypoint == IHookRegistry.Entrypoint.AFTER_TRANSFER;
    }

    /**
     * @notice Sets the lockbox for a verified ERC20
     * @param _verifiedERC20 The address of the verified ERC20
     * @param _lockbox The address of the lockbox to set
     * @dev Only callable by the owner of the verified ERC20 contract
     */
    function setLockbox(address _verifiedERC20, address _lockbox) external {
        if (_lockbox == address(0) || _verifiedERC20 == address(0)) {
            revert AutoUnwrapHook_ZeroAddress();
        }
        if (msg.sender != Ownable(_verifiedERC20).owner()) {
            revert AutoUnwrapHook_NotAuthorized({
                _caller: msg.sender,
                _verifiedERC20: _verifiedERC20,
                _lockbox: _lockbox
            });
        }

        _setLockbox({_verifiedERC20: _verifiedERC20, _lockbox: _lockbox});
    }

    /**
     * @dev Internal function to set the lockbox for a verified ERC20
     * @param _verifiedERC20 The address of the verified ERC20
     * @param _lockbox The address of the lockbox to set
     */
    function _setLockbox(address _verifiedERC20, address _lockbox) internal {
        lockbox[_verifiedERC20] = _lockbox;

        emit LockboxSet({verifiedERC20: _verifiedERC20, lockbox: _lockbox});
    }

    /**
     * @dev Automatically unwrap on claim incentive when the user is verified
     * @param _caller The address of the caller
     * @param _from The address of the sender
     * @param _to The address of the recipient
     * @param _amount The amount being transferred
     */
    //slither-disable-start unchecked-transfer
    //slither-disable-start reentrancy-no-eth
    function _check(address _caller, address _from, address _to, uint256 _amount) internal override {
        if (_isClaimIncentive({_from: _from})) {
            IVerifiedERC20 verifiedERC20 = IVerifiedERC20(msg.sender);
            IERC20Lockbox _lockbox = IERC20Lockbox(lockbox[msg.sender]);

            /// @dev transferFrom is checked in VerifiedERC20
            // slither-disable-next-line arbitrary-send-erc20
            verifiedERC20.transferFrom({from: _to, to: address(this), value: _amount});
            verifiedERC20.safeIncreaseAllowance({spender: address(_lockbox), value: _amount});
            _lockbox.withdrawTo({_to: _to, _amount: _amount});
        }
    }
    //slither-disable-end unchecked-transfer
    //slither-disable-end reentrancy-no-eth

    /**
     * @dev Check if the transfer is an incentive claim
     * @param _from The sender address
     * @return True if the transfer is a claim incentive, false otherwise
     */
    function _isClaimIncentive(address _from) internal view returns (bool) {
        (bool success, bytes memory data) = _from.excessivelySafeStaticCall({
            _gas: 5_000,
            _maxCopy: 32,
            _calldata: abi.encodeWithSelector(IReward.authorized.selector)
        });

        if (!success || data.length < 32 || authorized != abi.decode(data, (address))) return false;

        (success, data) = _from.excessivelySafeStaticCall({
            _gas: 5_000,
            _maxCopy: 32,
            _calldata: abi.encodeWithSelector(IReward.voter.selector)
        });
        if (!success || data.length < 32 || voter != abi.decode(data, (address))) return false;

        return true;
    }
}

// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.7.6;

library ExcessivelySafeCall {
    uint256 constant LOW_28_MASK =
        0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff;

    /// @notice Use when you _really_ really _really_ don't trust the called
    /// contract. This prevents the called contract from causing reversion of
    /// the caller in as many ways as we can.
    /// @dev The main difference between this and a solidity low-level call is
    /// that we limit the number of bytes that the callee can cause to be
    /// copied to caller memory. This prevents stupid things like malicious
    /// contracts returning 10,000,000 bytes causing a local OOG when copying
    /// to memory.
    /// @param _target The address to call
    /// @param _gas The amount of gas to forward to the remote contract
    /// @param _value The value in wei to send to the remote contract
    /// @param _maxCopy The maximum number of bytes of returndata to copy
    /// to memory.
    /// @param _calldata The data to send to the remote contract
    /// @return success and returndata, as `.call()`. Returndata is capped to
    /// `_maxCopy` bytes.
    function excessivelySafeCall(
        address _target,
        uint256 _gas,
        uint256 _value,
        uint16 _maxCopy,
        bytes memory _calldata
    ) internal returns (bool, bytes memory) {
        // set up for assembly call
        uint256 _toCopy;
        bool _success;
        bytes memory _returnData = new bytes(_maxCopy);
        // dispatch message to recipient
        // by assembly calling "handle" function
        // we call via assembly to avoid memcopying a very large returndata
        // returned by a malicious contract
        assembly {
            _success := call(
                _gas, // gas
                _target, // recipient
                _value, // ether value
                add(_calldata, 0x20), // inloc
                mload(_calldata), // inlen
                0, // outloc
                0 // outlen
            )
            // limit our copy to 256 bytes
            _toCopy := returndatasize()
            if gt(_toCopy, _maxCopy) {
                _toCopy := _maxCopy
            }
            // Store the length of the copied bytes
            mstore(_returnData, _toCopy)
            // copy the bytes from returndata[0:_toCopy]
            returndatacopy(add(_returnData, 0x20), 0, _toCopy)
        }
        return (_success, _returnData);
    }

    /// @notice Use when you _really_ really _really_ don't trust the called
    /// contract. This prevents the called contract from causing reversion of
    /// the caller in as many ways as we can.
    /// @dev The main difference between this and a solidity low-level call is
    /// that we limit the number of bytes that the callee can cause to be
    /// copied to caller memory. This prevents stupid things like malicious
    /// contracts returning 10,000,000 bytes causing a local OOG when copying
    /// to memory.
    /// @param _target The address to call
    /// @param _gas The amount of gas to forward to the remote contract
    /// @param _maxCopy The maximum number of bytes of returndata to copy
    /// to memory.
    /// @param _calldata The data to send to the remote contract
    /// @return success and returndata, as `.call()`. Returndata is capped to
    /// `_maxCopy` bytes.
    function excessivelySafeStaticCall(
        address _target,
        uint256 _gas,
        uint16 _maxCopy,
        bytes memory _calldata
    ) internal view returns (bool, bytes memory) {
        // set up for assembly call
        uint256 _toCopy;
        bool _success;
        bytes memory _returnData = new bytes(_maxCopy);
        // dispatch message to recipient
        // by assembly calling "handle" function
        // we call via assembly to avoid memcopying a very large returndata
        // returned by a malicious contract
        assembly {
            _success := staticcall(
                _gas, // gas
                _target, // recipient
                add(_calldata, 0x20), // inloc
                mload(_calldata), // inlen
                0, // outloc
                0 // outlen
            )
            // limit our copy to 256 bytes
            _toCopy := returndatasize()
            if gt(_toCopy, _maxCopy) {
                _toCopy := _maxCopy
            }
            // Store the length of the copied bytes
            mstore(_returnData, _toCopy)
            // copy the bytes from returndata[0:_toCopy]
            returndatacopy(add(_returnData, 0x20), 0, _toCopy)
        }
        return (_success, _returnData);
    }

    /**
     * @notice Swaps function selectors in encoded contract calls
     * @dev Allows reuse of encoded calldata for functions with identical
     * argument types but different names. It simply swaps out the first 4 bytes
     * for the new selector. This function modifies memory in place, and should
     * only be used with caution.
     * @param _newSelector The new 4-byte selector
     * @param _buf The encoded contract args
     */
    function swapSelector(bytes4 _newSelector, bytes memory _buf)
        internal
        pure
    {
        require(_buf.length >= 4);
        uint256 _mask = LOW_28_MASK;
        assembly {
            // load the first word of
            let _word := mload(add(_buf, 0x20))
            // mask out the top 4 bytes
            // /x
            _word := and(_word, _mask)
            _word := or(_newSelector, _word)
            mstore(add(_buf, 0x20), _word)
        }
    }
}

// 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);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

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

// 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);
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IReward {
    /// @dev Address which has permission to externally call _deposit() & _withdraw()
    function authorized() external view returns (address);

    /// @notice Address of LeafVoter.sol
    function voter() external view returns (address);

    /// @notice Deposit an amount into the rewards contract to earn future rewards associated to a veNFT
    /// @dev Internal notation used as only callable internally by `authorized.module()`.
    /// @param amount Vote weight to deposit
    /// @param tokenId Token ID of weight to deposit
    /// @param timestamp Timestamp of deposit
    function _deposit(uint256 amount, uint256 tokenId, uint256 timestamp) external;

    /// @notice Claim the rewards earned by a veNFT staker
    /// @param _recipient  Address of reward recipient
    /// @param _tokenId  Unique identifier of the veNFT
    /// @param _tokens   Array of tokens to claim rewards of
    function getReward(address _recipient, uint256 _tokenId, address[] memory _tokens) external;

    /// @notice Add rewards for stakers to earn
    /// @param token    Address of token to reward
    /// @param amount   Amount of token to transfer to rewards
    function notifyRewardAmount(address token, uint256 amount) external;
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

// Interface for Self SBT contract
interface ISelfPassportSBT {
    function getTokenIdByAddress(address user) external view returns (uint256 tokenId);
    function isTokenValid(uint256 tokenId) external view returns (bool valid);
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.19 <0.9.0;

interface IHookRegistry {
    /**
     * @dev Enum defining the entrypoints where hooks can be triggered
     */
    enum Entrypoint {
        BEFORE_APPROVE,
        AFTER_APPROVE,
        BEFORE_TRANSFER,
        AFTER_TRANSFER,
        BEFORE_MINT,
        AFTER_MINT,
        BEFORE_BURN,
        AFTER_BURN
    }

    /**
     * @dev Emitted when a hook is registered
     * @param hook Address of the registered hook
     * @param entrypoint The entrypoint assigned to the hook
     */
    event HookRegistered(address indexed hook, Entrypoint indexed entrypoint);

    /**
     * @dev Emitted when a hook is deregistered
     * @param hook Address of the deregistered hook
     */
    event HookDeregistered(address indexed hook);

    /**
     * @dev Error thrown when a zero address is provided
     */
    error HookRegistry_ZeroAddress();

    /**
     * @dev Error thrown when trying to register a hook that is already registered
     */
    error HookRegistry_HookAlreadyRegistered();

    /**
     * @dev Error thrown when trying to deregister a hook that is not registered
     */
    error HookRegistry_HookNotRegistered();

    /**
     * @dev Error thrown when an invalid entrypoint is provided
     */
    error HookRegistry_HookDoesNotSupportEntrypoint(Entrypoint entrypoint);

    /**
     * @dev Registers a hook with the specified entrypoint
     * @param _hook Address of the hook to register
     * @param _entrypoint The entrypoint to assign to the hook
     */
    function registerHook(address _hook, Entrypoint _entrypoint) external;

    /**
     * @dev Deregisters a hook
     * @param _hook Address of the hook to deregister
     */
    function deregisterHook(address _hook) external;

    /**
     * @dev Returns the entrypoint associated with a hook
     * @param _hook The hook address to query
     * @return The entrypoint assigned to the hook
     * @dev Return entrypoint of 0 can mean either 'BEFORE_APPROVE` or that the hook is not registered. `isHookRegistered` should be checked
     */
    function hookEntrypoints(address _hook) external view returns (Entrypoint);

    /**
     * @dev Returns the total number of registered hooks
     * @return The count of registered hooks
     */
    function getHookCount() external view returns (uint256);

    /**
     * @dev Returns the hook address at a given index
     * @param _index The index of the hook to retrieve
     * @return The address of the hook at the specified index
     */
    function getHookAt(uint256 _index) external view returns (address);

    /**
     * @dev Checks if a hook is registered
     * @param _hook The hook address to check
     * @return True if the hook is registered, false otherwise
     */
    function isHookRegistered(address _hook) external view returns (bool);

    /**
     * @dev Returns all registered hooks
     * @return An array of all registered hook addresses
     */
    function getAllHooks() external view returns (address[] memory);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";

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

interface IERC20Lockbox {
    /**
     * @notice Error thrown when a zero address is provided
     */
    error ERC20Lockbox_ZeroAddress();

    /// @notice Emitted when tokens are deposited into the lockbox
    /// @param _sender The address of the user who deposited
    /// @param _amount The amount of tokens deposited
    event Deposit(address indexed _sender, uint256 _amount);

    /// @notice Emitted when tokens are withdrawn from the lockbox
    /// @param _sender The address of the user who withdrew
    /// @param _receiver The address of the user who receives the withdrawn tokens
    /// @param _amount The amount of tokens withdrawn
    event Withdraw(address indexed _sender, address indexed _receiver, uint256 _amount);

    /// @notice The VerifiedERC20 token of this contract
    function verifiedERC20() external view returns (IVerifiedERC20);

    /// @notice The ERC20 token of this contract
    function ERC20() external view returns (IERC20);

    /// @notice Deposit ERC20 tokens into the lockbox
    /// @param _amount The amount of tokens to deposit
    function deposit(uint256 _amount) external;

    /// @notice Withdraw ERC20 tokens from the lockbox
    /// @param _amount The amount of tokens to withdraw
    function withdraw(uint256 _amount) external;

    /// @notice Withdraw ERC20 tokens to a specific address
    /// @param _to The address to withdraw tokens to
    /// @param _amount The amount of tokens to withdraw
    function withdrawTo(address _to, uint256 _amount) external;
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.19 <0.9.0;

import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol";

import {IHookRegistry} from "./hooks/IHookRegistry.sol";

interface IVerifiedERC20 is IERC20 {
    /**
     * @notice Error thrown when a hook is not registered in the hook registry.
     * @param hook Address of the hook.
     */
    error VerifiedERC20_InvalidHook(address hook);

    /**
     * @notice Error thrown when trying to activate a hook that is already activated.
     * @param hook Address of the hook.
     */
    error VerifiedERC20_HookAlreadyActivated(address hook);

    /**
     * @notice Error thrown when trying to deactivate a hook that is not activated.
     * @param hook Address of the hook.
     */
    error VerifiedERC20_HookNotActivated(address hook);

    /**
     * @notice Error thrown when the maximum number of hooks for an entrypoint is exceeded.
     */
    error VerifiedERC20_MaxHooksExceeded();

    /**
     * @notice Error thrown when a hook reverts during execution.
     * @param data The data returned by the hook.
     */
    error VerifiedERC20_HookRevert(bytes data);

    /**
     * @notice Emitted when a hook is activated
     * @param hook Address of the activated hook
     * @param entrypoint The entrypoint of the activated hook
     */
    event HookActivated(address indexed hook, IHookRegistry.Entrypoint indexed entrypoint);

    /**
     * @notice Emitted when a hook is deactivated
     * @param hook Address of the deactivated hook
     * @param entrypoint The entrypoint of the deactivated hook
     */
    event HookDeactivated(address indexed hook, IHookRegistry.Entrypoint indexed entrypoint);

    /**
     * @dev Returns the maximum number of entrypoints
     * @return The maximum number of entrypoints
     */
    function MAX_ENTRYPOINTS() external pure returns (uint256);

    /**
     * @notice Returns the maximum number of hooks allowed per entrypoint
     * @return The maximum number of hooks per entrypoint
     */
    function MAX_HOOKS_PER_ENTRYPOINT() external view returns (uint256);

    /**
     * @notice Returns the maximum gas allowed per hook call
     * @return The maximum gas limit for each hook
     */
    function MAX_GAS_PER_HOOK() external view returns (uint256);

    /**
     * @notice The address of the hook registry contract
     * @return Address of the hook registry
     */
    function hookRegistry() external view returns (address);

    /**
     * @notice Activates a hook for the verifiedERC20 token
     * @param _hook Address of the hook to activate
     */
    function activateHook(address _hook) external;

    /**
     * @notice Deactivates a hook for the verifiedERC20 token
     * @param _hook Address of the hook to deactivate
     */
    function deactivateHook(address _hook) external;

    /**
     * @notice Maps hook addresses to their respective index in the entrypoint array
     * @param _hook The hook address to get the index for
     * @return The index of the hook in its entrypoint array
     * @dev Return index of 0 can mean either the first hook or that the hook is not registered. `isHookActivated` should be checked
     */
    function hookToIndex(address _hook) external view returns (uint256);

    /**
     * @notice Maps hook addresses to their respective entrypoint
     * @param _hook The hook address to get the entrypoint for
     * @return The entrypoint the hook is activated for
     * @dev Return entrypoint of 0 can mean either 'BEFORE_APPROVE` or that the hook is not registered. `isHookActivated` should be checked
     */
    function hookToEntrypoint(address _hook) external view returns (IHookRegistry.Entrypoint);

    /**
     * @notice Maps hook addresses to their activation status
     * @param _hook The hook address to check activation status for
     * @return Whether the hook is currently activated
     */
    function isHookActivated(address _hook) external view returns (bool);

    /**
     * @notice Gets all hooks for a specific entrypoint
     * @param _entrypoint The entrypoint to get hooks for
     * @return Array of hook addresses for the entrypoint
     */
    function getHooksForEntrypoint(IHookRegistry.Entrypoint _entrypoint) external view returns (address[] memory);

    /**
     * @notice Gets a hook at a specific index for an entrypoint
     * @param _entrypoint The entrypoint to get the hook from
     * @param _index The index of the hook to get
     * @return The hook address at the specified index
     */
    function getHookAtIndex(IHookRegistry.Entrypoint _entrypoint, uint256 _index) external view returns (address);

    /**
     * @notice Gets the number of hooks for a specific entrypoint
     * @param _entrypoint The entrypoint to get the count for
     * @return The number of hooks for the entrypoint
     */
    function getHooksCountForEntrypoint(IHookRegistry.Entrypoint _entrypoint) external view returns (uint256);

    /**
     * @notice Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
     * @param _account The address to which the tokens will be minted
     * @param _value The amount of tokens to mint
     */
    function mint(address _account, uint256 _value) external;

    /**
     * @notice Destroys a `value` amount of tokens from `account`, lowering the total supply.
     * @param _account The address from which the tokens will be burned
     * @param _value The amount of tokens to burn
     */
    function burn(address _account, uint256 _value) external;
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

/**
 * @title IHook
 * @notice Interface for hook functionality
 */
interface IHook {
    /**
     * @notice Error thrown when the hook reverts
     */
    error Hook_Revert(bytes _params);

    /**
     * @notice Returns the hook name
     * @return The hook name as a string
     */
    function name() external view returns (string memory);

    /**
     * @notice Checks if the hook supports a specific entrypoint
     * @param _entrypoint The entrypoint to check support for
     * @return True if the hook supports the entrypoint, false otherwise
     */
    function supportsEntrypoint(IHookRegistry.Entrypoint _entrypoint) external view returns (bool);

    /**
     * @notice Calls the hook to check the function is allowed to be executed
     * @param _caller The caller of the VerifiedERC20 function
     * @param _params The function VerifiedERC20 function params encoded
     */
    function check(address _caller, bytes memory _params) external;
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.19 <0.9.0;

import {IHook, IHookRegistry} from "../interfaces/hooks/IHook.sol";

/**
 * @title BaseTransferHook
 * @dev Abstract base contract for hooks that can be registered in a hook registry with transfer as entrypoint
 *      Hook implementations need to override `supportsEntrypoint` to specify the type of entrypoint (BEFORE_TRANSFER or AFTER_TRANSFER)
 */
abstract contract BaseTransferHook is IHook {
    /// @inheritdoc IHook
    string public name;

    /**
     * @notice Constructor for the BaseTransferHook
     * @param _name Name for the hook
     */
    constructor(string memory _name) {
        name = _name;
    }

    /// @inheritdoc IHook
    function supportsEntrypoint(IHookRegistry.Entrypoint _entrypoint) external view virtual returns (bool);

    /// @inheritdoc IHook
    function check(address _caller, bytes memory _params) external {
        (address _from, address _to, uint256 _amount) = _decodeParams({_params: _params});
        _check({_caller: _caller, _from: _from, _to: _to, _amount: _amount});
    }

    /**
     * @dev Internal function to be overriden
     * @param _caller The address of the caller
     * @param _from The address of the sender
     * @param _to The address of the recipient
     * @param _amount The amount being transferred
     */
    function _check(address _caller, address _from, address _to, uint256 _amount) internal virtual;

    /**
     * @dev Helper function to decode parameters passed into check function
     * @param _params The abi encoded parameters
     * @return The decoded transfer parameters
     */
    function _decodeParams(bytes memory _params) internal pure returns (address, address, uint256) {
        return abi.decode(_params, (address, address, uint256));
    }
}

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)

pragma solidity ^0.8.20;

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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC-20
 * applications.
 */
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
    mapping(address account => uint256) private _balances;

    mapping(address account => mapping(address spender => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * Both values are immutable: they can only be set once during construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the default value returned by this function, unless
     * it's overridden.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual returns (uint8) {
        return 18;
    }

    /// @inheritdoc IERC20
    function totalSupply() public view virtual returns (uint256) {
        return _totalSupply;
    }

    /// @inheritdoc IERC20
    function balanceOf(address account) public view virtual returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `value`.
     */
    function transfer(address to, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, value);
        return true;
    }

    /// @inheritdoc IERC20
    function allowance(address owner, address spender) public view virtual returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, value);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Skips emitting an {Approval} event indicating an allowance update. This is not
     * required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve].
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `value`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `value`.
     */
    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, value);
        _transfer(from, to, value);
        return true;
    }

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _transfer(address from, address to, uint256 value) internal {
        if (from == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        if (to == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(from, to, value);
    }

    /**
     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
     * this function.
     *
     * Emits a {Transfer} event.
     */
    function _update(address from, address to, uint256 value) internal virtual {
        if (from == address(0)) {
            // Overflow check required: The rest of the code assumes that totalSupply never overflows
            _totalSupply += value;
        } else {
            uint256 fromBalance = _balances[from];
            if (fromBalance < value) {
                revert ERC20InsufficientBalance(from, fromBalance, value);
            }
            unchecked {
                // Overflow not possible: value <= fromBalance <= totalSupply.
                _balances[from] = fromBalance - value;
            }
        }

        if (to == address(0)) {
            unchecked {
                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
                _totalSupply -= value;
            }
        } else {
            unchecked {
                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
                _balances[to] += value;
            }
        }

        emit Transfer(from, to, value);
    }

    /**
     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
     * Relies on the `_update` mechanism
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _mint(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(address(0), account, value);
    }

    /**
     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
     * Relies on the `_update` mechanism.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead
     */
    function _burn(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        _update(account, address(0), value);
    }

    /**
     * @dev Sets `value` as the allowance of `spender` over the `owner`'s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     *
     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
     */
    function _approve(address owner, address spender, uint256 value) internal {
        _approve(owner, spender, value, true);
    }

    /**
     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
     *
     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
     * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
     * `Approval` event during `transferFrom` operations.
     *
     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
     * true using the following override:
     *
     * ```solidity
     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
     *     super._approve(owner, spender, value, true);
     * }
     * ```
     *
     * Requirements are the same as {_approve}.
     */
    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
        if (owner == address(0)) {
            revert ERC20InvalidApprover(address(0));
        }
        if (spender == address(0)) {
            revert ERC20InvalidSpender(address(0));
        }
        _allowances[owner][spender] = value;
        if (emitEvent) {
            emit Approval(owner, spender, value);
        }
    }

    /**
     * @dev Updates `owner`'s allowance for `spender` based on spent `value`.
     *
     * Does not update the allowance value in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Does not emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance < type(uint256).max) {
            if (currentAllowance < value) {
                revert ERC20InsufficientAllowance(spender, currentAllowance, value);
            }
            unchecked {
                _approve(owner, spender, currentAllowance - value, false);
            }
        }
    }
}

File 16 of 20 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../token/ERC20/IERC20.sol";

File 17 of 20 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../utils/introspection/IERC165.sol";

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.20;

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

/**
 * @dev Interface for the optional metadata functions from the ERC-20 standard.
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;

/**
 * @dev Standard ERC-20 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.
 */
interface IERC20Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC20InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC20InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     * @param allowance Amount of tokens a `spender` is allowed to operate with.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC20InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC20InvalidSpender(address spender);
}

/**
 * @dev Standard ERC-721 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.
 */
interface IERC721Errors {
    /**
     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.
     * Used in balance queries.
     * @param owner Address of the current owner of a token.
     */
    error ERC721InvalidOwner(address owner);

    /**
     * @dev Indicates a `tokenId` whose `owner` is the zero address.
     * @param tokenId Identifier number of a token.
     */
    error ERC721NonexistentToken(uint256 tokenId);

    /**
     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param tokenId Identifier number of a token.
     * @param owner Address of the current owner of a token.
     */
    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC721InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC721InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param tokenId Identifier number of a token.
     */
    error ERC721InsufficientApproval(address operator, uint256 tokenId);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC721InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC721InvalidOperator(address operator);
}

/**
 * @dev Standard ERC-1155 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.
 */
interface IERC1155Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     * @param tokenId Identifier number of a token.
     */
    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC1155InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC1155InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param owner Address of the current owner of a token.
     */
    error ERC1155MissingApprovalForAll(address operator, address owner);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC1155InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC1155InvalidOperator(address operator);

    /**
     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
     * Used in batch transfers.
     * @param idsLength Length of the array of token identifiers
     * @param valuesLength Length of the array of token amounts
     */
    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

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

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"address","name":"_voter","type":"address"},{"internalType":"address","name":"_authorized","type":"address"},{"internalType":"address[]","name":"_verifiedERC20s","type":"address[]"},{"internalType":"address[]","name":"_lockboxes","type":"address[]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AutoUnwrapHook_LengthMismatch","type":"error"},{"inputs":[{"internalType":"address","name":"_caller","type":"address"},{"internalType":"address","name":"_verifiedERC20","type":"address"},{"internalType":"address","name":"_lockbox","type":"address"}],"name":"AutoUnwrapHook_NotAuthorized","type":"error"},{"inputs":[],"name":"AutoUnwrapHook_ZeroAddress","type":"error"},{"inputs":[{"internalType":"bytes","name":"_params","type":"bytes"}],"name":"Hook_Revert","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"verifiedERC20","type":"address"},{"indexed":true,"internalType":"address","name":"lockbox","type":"address"}],"name":"LockboxSet","type":"event"},{"inputs":[],"name":"authorized","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_caller","type":"address"},{"internalType":"bytes","name":"_params","type":"bytes"}],"name":"check","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_verifiedERC20","type":"address"}],"name":"lockbox","outputs":[{"internalType":"address","name":"_lockbox","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_verifiedERC20","type":"address"},{"internalType":"address","name":"_lockbox","type":"address"}],"name":"setLockbox","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum IHookRegistry.Entrypoint","name":"_entrypoint","type":"uint8"}],"name":"supportsEntrypoint","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"voter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60c060405234801561000f575f5ffd5b5060405161109438038061109483398101604081905261002e9161028d565b845f61003a8282610419565b50506001600160a01b03808516608052831660a052805182511461007157604051632668811960e01b815260040160405180910390fd5b5f5b8251811015610147575f6001600160a01b0316828281518110610098576100986104d3565b60200260200101516001600160a01b031614806100df57505f6001600160a01b03168382815181106100cc576100cc6104d3565b60200260200101516001600160a01b0316145b156100fd57604051637c8cf54760e01b815260040160405180910390fd5b61013f838281518110610112576101126104d3565b602002602001015183838151811061012c5761012c6104d3565b602002602001015161015260201b60201c565b600101610073565b5050505050506104e7565b6001600160a01b038281165f8181526001602052604080822080546001600160a01b0319169486169485179055517f7d9dae435b1fe4a1672f56df76f98ef83d8320d80c3915bf2542f21fc694d91a9190a35050565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b03811182821017156101e4576101e46101a8565b604052919050565b80516001600160a01b0381168114610202575f5ffd5b919050565b5f82601f830112610216575f5ffd5b81516001600160401b0381111561022f5761022f6101a8565b8060051b61023f602082016101bc565b9182526020818501810192908101908684111561025a575f5ffd5b6020860192505b8383101561028357610272836101ec565b825260209283019290910190610261565b9695505050505050565b5f5f5f5f5f60a086880312156102a1575f5ffd5b85516001600160401b038111156102b6575f5ffd5b8601601f810188136102c6575f5ffd5b80516001600160401b038111156102df576102df6101a8565b6102f2601f8201601f19166020016101bc565b818152896020838501011115610306575f5ffd5b8160208401602083015e5f6020838301015280975050505061032a602087016101ec565b9350610338604087016101ec565b60608701519093506001600160401b03811115610353575f5ffd5b61035f88828901610207565b608088015190935090506001600160401b0381111561037c575f5ffd5b61038888828901610207565b9150509295509295909350565b600181811c908216806103a957607f821691505b6020821081036103c757634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111561041457805f5260205f20601f840160051c810160208510156103f25750805b601f840160051c820191505b81811015610411575f81556001016103fe565b50505b505050565b81516001600160401b03811115610432576104326101a8565b610446816104408454610395565b846103cd565b6020601f821160018114610478575f83156104615750848201515b5f19600385901b1c1916600184901b178455610411565b5f84815260208120601f198516915b828110156104a75787850151825560209485019460019092019101610487565b50848210156104c457868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b634e487b7160e01b5f52603260045260245ffd5b60805160a051610b806105145f395f818160a1015261054501525f818160e001526105f80152610b805ff3fe608060405234801561000f575f5ffd5b506004361061007a575f3560e01c80636d4e24c3116100585780636d4e24c31461010257806398a05d9014610117578063b5dad3841461013f578063e2b2408514610162575f5ffd5b806306fdde031461007e578063456cb7c61461009c57806346c96aac146100db575b5f5ffd5b610086610175565b60405161009391906108b0565b60405180910390f35b6100c37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610093565b6100c37f000000000000000000000000000000000000000000000000000000000000000081565b6101156101103660046108fc565b610200565b005b6100c3610125366004610933565b60016020525f90815260409020546001600160a01b031681565b61015261014d366004610955565b6102f8565b6040519015158152602001610093565b610115610170366004610987565b610314565b5f805461018190610a4d565b80601f01602080910402602001604051908101604052809291908181526020018280546101ad90610a4d565b80156101f85780601f106101cf576101008083540402835291602001916101f8565b820191905f5260205f20905b8154815290600101906020018083116101db57829003601f168201915b505050505081565b6001600160a01b038116158061021d57506001600160a01b038216155b1561023b57604051637c8cf54760e01b815260040160405180910390fd5b816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610277573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061029b9190610a85565b6001600160a01b0316336001600160a01b0316146102ea57604051634985fcd360e11b81523360048201526001600160a01b038084166024830152821660448201526064015b60405180910390fd5b6102f48282610339565b5050565b5f600382600781111561030d5761030d610aa0565b1492915050565b5f5f5f6103208461038f565b925092509250610332858484846103b3565b5050505050565b6001600160a01b038281165f8181526001602052604080822080546001600160a01b0319169486169485179055517f7d9dae435b1fe4a1672f56df76f98ef83d8320d80c3915bf2542f21fc694d91a9190a35050565b5f5f5f838060200190518101906103a69190610ab4565b9250925092509193909250565b6103bc836104c5565b156104bf57335f81815260016020526040908190205490516323b872dd60e01b81526001600160a01b038581166004830152306024830152604482018590529091169082906323b872dd906064016020604051808303815f875af1158015610426573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061044a9190610af5565b5061045f6001600160a01b038316828561063b565b60405163040b850f60e31b81526001600160a01b0385811660048301526024820185905282169063205c2878906044015f604051808303815f87803b1580156104a6575f5ffd5b505af11580156104b8573d5f5f3e3d5ffd5b5050505050505b50505050565b604080516004815260248101909152602081810180516001600160e01b03166322b65be360e11b1790525f918291829161050e916001600160a01b0387169161138891906106c2565b91509150811580610520575060208151105b8061057057508080602001905181019061053a9190610a85565b6001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031614155b1561057e57505f9392505050565b604080516004815260248101909152602081810180516001600160e01b03166311b25aab60e21b1790526105c0916001600160a01b03871691611388916106c2565b90925090508115806105d3575060208151105b806106235750808060200190518101906105ed9190610a85565b6001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031614155b1561063157505f9392505050565b5060019392505050565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301525f919085169063dd62ed3e90604401602060405180830381865afa158015610688573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106ac9190610b14565b90506104bf84846106bd8585610b2b565b610746565b5f60605f5f5f8661ffff1667ffffffffffffffff8111156106e5576106e5610973565b6040519080825280601f01601f19166020018201604052801561070f576020820181803683370190505b5090505f5f8751602089018c8cfa91503d92508683111561072e578692505b828152825f602083013e909890975095505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b17905261079784826107f9565b6104bf57604080516001600160a01b03851660248201525f6044808301919091528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b1790526107ef908590610844565b6104bf8482610844565b5f5f5f5f60205f8651602088015f8a5af192503d91505f5190508280156108385750811561082a5780600114610838565b5f866001600160a01b03163b115b93505050505b92915050565b5f5f60205f8451602086015f885af180610863576040513d5f823e3d81fd5b50505f513d9150811561087a578060011415610887565b6001600160a01b0384163b155b156104bf57604051635274afe760e01b81526001600160a01b03851660048201526024016102e1565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b6001600160a01b03811681146108f9575f5ffd5b50565b5f5f6040838503121561090d575f5ffd5b8235610918816108e5565b91506020830135610928816108e5565b809150509250929050565b5f60208284031215610943575f5ffd5b813561094e816108e5565b9392505050565b5f60208284031215610965575f5ffd5b81356008811061094e575f5ffd5b634e487b7160e01b5f52604160045260245ffd5b5f5f60408385031215610998575f5ffd5b82356109a3816108e5565b9150602083013567ffffffffffffffff8111156109be575f5ffd5b8301601f810185136109ce575f5ffd5b803567ffffffffffffffff8111156109e8576109e8610973565b604051601f8201601f19908116603f0116810167ffffffffffffffff81118282101715610a1757610a17610973565b604052818152828201602001871015610a2e575f5ffd5b816020840160208301375f602083830101528093505050509250929050565b600181811c90821680610a6157607f821691505b602082108103610a7f57634e487b7160e01b5f52602260045260245ffd5b50919050565b5f60208284031215610a95575f5ffd5b815161094e816108e5565b634e487b7160e01b5f52602160045260245ffd5b5f5f5f60608486031215610ac6575f5ffd5b8351610ad1816108e5565b6020850151909350610ae2816108e5565b6040949094015192959394509192915050565b5f60208284031215610b05575f5ffd5b8151801515811461094e575f5ffd5b5f60208284031215610b24575f5ffd5b5051919050565b8082018082111561083e57634e487b7160e01b5f52601160045260245ffdfea26469706673582212209598532696e181030c8610db18135d8eed34100d29cd16ff469aeffe599268be64736f6c634300081b003300000000000000000000000000000000000000000000000000000000000000a000000000000000000000000097cdbce21b6fd0585d29e539b1b99dad328a1123000000000000000000000000f278761576f45472bdd721eaca19317ce159c011000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000043486f6f6b20666f7220696e63656e7469766520636c61696d7320746f206175746f6d61746963616c6c7920756e7772617020746f20746865206261736520746f6b656e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000083e04b17ce5ccc1b1dcab192c618776114fa064a00000000000000000000000000000000000000000000000000000000000000010000000000000000000000006e2a43f1edb1a87f2b88740bd5ee0a4948f11df0

Deployed Bytecode

0x608060405234801561000f575f5ffd5b506004361061007a575f3560e01c80636d4e24c3116100585780636d4e24c31461010257806398a05d9014610117578063b5dad3841461013f578063e2b2408514610162575f5ffd5b806306fdde031461007e578063456cb7c61461009c57806346c96aac146100db575b5f5ffd5b610086610175565b60405161009391906108b0565b60405180910390f35b6100c37f000000000000000000000000f278761576f45472bdd721eaca19317ce159c01181565b6040516001600160a01b039091168152602001610093565b6100c37f00000000000000000000000097cdbce21b6fd0585d29e539b1b99dad328a112381565b6101156101103660046108fc565b610200565b005b6100c3610125366004610933565b60016020525f90815260409020546001600160a01b031681565b61015261014d366004610955565b6102f8565b6040519015158152602001610093565b610115610170366004610987565b610314565b5f805461018190610a4d565b80601f01602080910402602001604051908101604052809291908181526020018280546101ad90610a4d565b80156101f85780601f106101cf576101008083540402835291602001916101f8565b820191905f5260205f20905b8154815290600101906020018083116101db57829003601f168201915b505050505081565b6001600160a01b038116158061021d57506001600160a01b038216155b1561023b57604051637c8cf54760e01b815260040160405180910390fd5b816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610277573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061029b9190610a85565b6001600160a01b0316336001600160a01b0316146102ea57604051634985fcd360e11b81523360048201526001600160a01b038084166024830152821660448201526064015b60405180910390fd5b6102f48282610339565b5050565b5f600382600781111561030d5761030d610aa0565b1492915050565b5f5f5f6103208461038f565b925092509250610332858484846103b3565b5050505050565b6001600160a01b038281165f8181526001602052604080822080546001600160a01b0319169486169485179055517f7d9dae435b1fe4a1672f56df76f98ef83d8320d80c3915bf2542f21fc694d91a9190a35050565b5f5f5f838060200190518101906103a69190610ab4565b9250925092509193909250565b6103bc836104c5565b156104bf57335f81815260016020526040908190205490516323b872dd60e01b81526001600160a01b038581166004830152306024830152604482018590529091169082906323b872dd906064016020604051808303815f875af1158015610426573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061044a9190610af5565b5061045f6001600160a01b038316828561063b565b60405163040b850f60e31b81526001600160a01b0385811660048301526024820185905282169063205c2878906044015f604051808303815f87803b1580156104a6575f5ffd5b505af11580156104b8573d5f5f3e3d5ffd5b5050505050505b50505050565b604080516004815260248101909152602081810180516001600160e01b03166322b65be360e11b1790525f918291829161050e916001600160a01b0387169161138891906106c2565b91509150811580610520575060208151105b8061057057508080602001905181019061053a9190610a85565b6001600160a01b03167f000000000000000000000000f278761576f45472bdd721eaca19317ce159c0116001600160a01b031614155b1561057e57505f9392505050565b604080516004815260248101909152602081810180516001600160e01b03166311b25aab60e21b1790526105c0916001600160a01b03871691611388916106c2565b90925090508115806105d3575060208151105b806106235750808060200190518101906105ed9190610a85565b6001600160a01b03167f00000000000000000000000097cdbce21b6fd0585d29e539b1b99dad328a11236001600160a01b031614155b1561063157505f9392505050565b5060019392505050565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301525f919085169063dd62ed3e90604401602060405180830381865afa158015610688573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106ac9190610b14565b90506104bf84846106bd8585610b2b565b610746565b5f60605f5f5f8661ffff1667ffffffffffffffff8111156106e5576106e5610973565b6040519080825280601f01601f19166020018201604052801561070f576020820181803683370190505b5090505f5f8751602089018c8cfa91503d92508683111561072e578692505b828152825f602083013e909890975095505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b17905261079784826107f9565b6104bf57604080516001600160a01b03851660248201525f6044808301919091528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b1790526107ef908590610844565b6104bf8482610844565b5f5f5f5f60205f8651602088015f8a5af192503d91505f5190508280156108385750811561082a5780600114610838565b5f866001600160a01b03163b115b93505050505b92915050565b5f5f60205f8451602086015f885af180610863576040513d5f823e3d81fd5b50505f513d9150811561087a578060011415610887565b6001600160a01b0384163b155b156104bf57604051635274afe760e01b81526001600160a01b03851660048201526024016102e1565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b6001600160a01b03811681146108f9575f5ffd5b50565b5f5f6040838503121561090d575f5ffd5b8235610918816108e5565b91506020830135610928816108e5565b809150509250929050565b5f60208284031215610943575f5ffd5b813561094e816108e5565b9392505050565b5f60208284031215610965575f5ffd5b81356008811061094e575f5ffd5b634e487b7160e01b5f52604160045260245ffd5b5f5f60408385031215610998575f5ffd5b82356109a3816108e5565b9150602083013567ffffffffffffffff8111156109be575f5ffd5b8301601f810185136109ce575f5ffd5b803567ffffffffffffffff8111156109e8576109e8610973565b604051601f8201601f19908116603f0116810167ffffffffffffffff81118282101715610a1757610a17610973565b604052818152828201602001871015610a2e575f5ffd5b816020840160208301375f602083830101528093505050509250929050565b600181811c90821680610a6157607f821691505b602082108103610a7f57634e487b7160e01b5f52602260045260245ffd5b50919050565b5f60208284031215610a95575f5ffd5b815161094e816108e5565b634e487b7160e01b5f52602160045260245ffd5b5f5f5f60608486031215610ac6575f5ffd5b8351610ad1816108e5565b6020850151909350610ae2816108e5565b6040949094015192959394509192915050565b5f60208284031215610b05575f5ffd5b8151801515811461094e575f5ffd5b5f60208284031215610b24575f5ffd5b5051919050565b8082018082111561083e57634e487b7160e01b5f52601160045260245ffdfea26469706673582212209598532696e181030c8610db18135d8eed34100d29cd16ff469aeffe599268be64736f6c634300081b0033

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

00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000097cdbce21b6fd0585d29e539b1b99dad328a1123000000000000000000000000f278761576f45472bdd721eaca19317ce159c011000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000043486f6f6b20666f7220696e63656e7469766520636c61696d7320746f206175746f6d61746963616c6c7920756e7772617020746f20746865206261736520746f6b656e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000083e04b17ce5ccc1b1dcab192c618776114fa064a00000000000000000000000000000000000000000000000000000000000000010000000000000000000000006e2a43f1edb1a87f2b88740bd5ee0a4948f11df0

-----Decoded View---------------
Arg [0] : _name (string): Hook for incentive claims to automatically unwrap to the base token
Arg [1] : _voter (address): 0x97cDBCe21B6fd0585d29E539B1B99dAd328a1123
Arg [2] : _authorized (address): 0xF278761576f45472bdD721EACA19317cE159c011
Arg [3] : _verifiedERC20s (address[]): 0x83E04b17cE5CCc1b1dCaB192c618776114Fa064A
Arg [4] : _lockboxes (address[]): 0x6E2A43f1edB1a87F2b88740bD5eE0A4948f11df0

-----Encoded View---------------
13 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [1] : 00000000000000000000000097cdbce21b6fd0585d29e539b1b99dad328a1123
Arg [2] : 000000000000000000000000f278761576f45472bdd721eaca19317ce159c011
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000120
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000160
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000043
Arg [6] : 486f6f6b20666f7220696e63656e7469766520636c61696d7320746f20617574
Arg [7] : 6f6d61746963616c6c7920756e7772617020746f20746865206261736520746f
Arg [8] : 6b656e0000000000000000000000000000000000000000000000000000000000
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [10] : 00000000000000000000000083e04b17ce5ccc1b1dcab192c618776114fa064a
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [12] : 0000000000000000000000006e2a43f1edb1a87f2b88740bd5ee0a4948f11df0


Block Transaction Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
0x99b37B76025677085bc4A93e52588D9b637F1DAe
Loading...
Loading
Loading...
Loading
Loading...
Loading

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.