AssetsRouter

Description:

Proxy contract enabling upgradeable smart contract patterns. Delegates calls to an implementation contract.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

{{
  "language": "Solidity",
  "sources": {
    "src/AssetsRouter.sol": {
      "content": "// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.26;

import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";
import {TransferHelper} from "@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol";

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

import {Errors} from "./libraries/Errors.sol";

/// @title AssetsRouter
/// @author luoyhang003
/// @notice Routes incoming ERC20 token transfers to a designated recipient address.
/// @dev Supports both automatic routing to the active recipient or manual routing by operators.
///      Access is controlled via roles:
///      - DEFAULT_ADMIN_ROLE: manages role assignments
///      - ROUTER_ADMIN_ROLE: can add/remove route recipients
///      - ROUTER_OPERATOR_ROLE: can change active recipient, enable/disable auto-route, or manually route assets
contract AssetsRouter is IAssetsRouter, AccessControl {
    /*//////////////////////////////////////////////////////////////////////////
                                    STATE VARIABLES
    //////////////////////////////////////////////////////////////////////////*/

    /// @notice Role identifier for router admins (manage recipients list).
    /// @dev Only addresses with this role can call `addRouteRecipient` and `removeRouteRecipient`
    /// @dev Calculated as keccak256("ROUTER_ADMIN_ROLE").
    bytes32 public constant ROUTER_ADMIN_ROLE = keccak256("ROUTER_ADMIN_ROLE");

    /// @notice Role identifier for router operators (manage routing settings).
    /// @dev Only addresses with this role can call `setActiveRecipient`, `setAutoRouteEnabled` and `manualRoute`
    /// @dev Calculated as keccak256("ROUTER_OPERATOR_ROLE").
    bytes32 public constant ROUTER_OPERATOR_ROLE =
        keccak256("ROUTER_OPERATOR_ROLE");

    /// @dev List of approved route recipients.
    address[] private _routeRecipients;

    /// @dev Mapping for quick lookup of approved recipients.
    mapping(address => bool) private _isRouteRecipient;

    /// @dev The currently active recipient address where tokens are routed automatically.
    address private _activeRecipient;

    /// @dev Flag indicating whether automatic routing is enabled.
    bool private _isAutoRouteEnabled;

    /*//////////////////////////////////////////////////////////////////////////
                                    CONSTRUCTOR
    //////////////////////////////////////////////////////////////////////////*/

    /// @notice Deploys the AssetsRouter contract.
    /// @param _defaultAdmin Address assigned as DEFAULT_ADMIN_ROLE.
    /// @param _adminRole Address granted the ROUTER_ADMIN_ROLE.
    /// @param _operatorRole Address granted the ROUTER_OPERATOR_ROLE.
    /// @param _recipients Initial list of valid route recipients.
    /// @param _active The active recipient address for auto-routing.
    constructor(
        address _defaultAdmin,
        address _adminRole,
        address _operatorRole,
        address[] memory _recipients,
        address _active
    ) {
        if (
            _defaultAdmin == address(0) ||
            _adminRole == address(0) ||
            _operatorRole == address(0)
        ) revert Errors.ZeroAddress();

        _grantRole(DEFAULT_ADMIN_ROLE, _defaultAdmin);
        _grantRole(ROUTER_ADMIN_ROLE, _adminRole);
        _grantRole(ROUTER_OPERATOR_ROLE, _operatorRole);

        uint256 i;
        uint256 length = _recipients.length;

        for (i; i < length; i++) {
            address recipient = _recipients[i];

            if (recipient == address(0)) revert Errors.ZeroAddress();

            _isRouteRecipient[recipient] = true;
            _routeRecipients.push(recipient);

            emit RouteRecipientAdded(recipient);
        }

        if (!_isRouteRecipient[_active]) revert Errors.NotRouterRecipient();
        _activeRecipient = _active;
        _isAutoRouteEnabled = true;

        emit SetActiveRecipient(_activeRecipient);
        emit SetAutoRouteEnabled(true);
    }

    /*//////////////////////////////////////////////////////////////////////////
                                    PERMISSIONLESS FUNCTIONS
    //////////////////////////////////////////////////////////////////////////*/

    /// @notice Deposit tokens into the router and optionally forward them to the active recipient.
    /// @param _token The ERC20 token address being routed.
    /// @param _amount The amount of tokens to transfer.
    /// @dev Pulls tokens from msg.sender into this contract.
    ///      If auto-route is enabled, immediately forwards them to `_activeRecipient`.
    function route(address _token, uint256 _amount) external {
        if (_token == address(0)) revert Errors.ZeroAddress();
        if (_amount == 0) revert Errors.ZeroAmount();

        TransferHelper.safeTransferFrom(
            _token,
            msg.sender,
            address(this),
            _amount
        );
        emit AssetsReceived(_token, msg.sender, _amount);

        if (_isAutoRouteEnabled) {
            TransferHelper.safeTransfer(_token, _activeRecipient, _amount);

            emit AssetsRouted(_token, _activeRecipient, _amount);
        }
    }

    /*//////////////////////////////////////////////////////////////////////////
                                    VIEW FUNCTIONS
    //////////////////////////////////////////////////////////////////////////*/

    /// @notice Returns the list of approved route recipients.
    /// @dev Returns the full list of route recipients currently registered in the router.
    /// @return routeRecipients_ The array of all registered recipient addresses.
    function getRouteRecipients()
        external
        view
        returns (address[] memory routeRecipients_)
    {
        return _routeRecipients;
    }

    /// @notice Checks if an address is a valid route recipient.
    /// @dev Checks if a given address is a registered route recipient.
    /// @param _addr The address to check.
    /// @return True if the address is a valid route recipient, otherwise false.
    function isRouteRecipient(address _addr) external view returns (bool) {
        return _isRouteRecipient[_addr];
    }

    /// @notice Returns the currently active route recipient.
    /// @dev Returns the currently active route recipient where assets are routed automatically.
    /// @return activeRecipient_ The address of the active route recipient.
    function getActiveRecipient()
        external
        view
        returns (address activeRecipient_)
    {
        return _activeRecipient;
    }

    /// @notice Returns whether auto-routing is enabled.
    /// @dev Indicates whether automatic routing is currently enabled.
    /// @return enabled_ Boolean flag, true if auto-routing is enabled, false otherwise.
    function isAutoRouteEnabled() external view returns (bool enabled_) {
        return _isAutoRouteEnabled;
    }

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

    /// @notice Add a new valid route recipient.
    /// @param _recipient The address to add as a route recipient.
    /// @dev Callable only by ROUTER_ADMIN_ROLE.
    function addRouteRecipient(
        address _recipient
    ) external onlyRole(ROUTER_ADMIN_ROLE) {
        if (_recipient == address(0)) revert Errors.ZeroAddress();
        if (_isRouteRecipient[_recipient])
            revert Errors.RecipientAlreadyAdded();

        _isRouteRecipient[_recipient] = true;
        _routeRecipients.push(_recipient);

        emit RouteRecipientAdded(_recipient);
    }

    /// @notice Remove an existing route recipient.
    /// @param _recipient The address to remove from the recipients list.
    /// @dev Cannot remove the currently active recipient.
    function removeRouteRecipient(
        address _recipient
    ) external onlyRole(ROUTER_ADMIN_ROLE) {
        if (_recipient == address(0)) revert Errors.ZeroAddress();
        if (!_isRouteRecipient[_recipient])
            revert Errors.RecipientAlreadyRemoved();
        if (_recipient == _activeRecipient) revert Errors.RemoveActiveRouter();

        uint256 length = _routeRecipients.length;
        uint256 i;

        for (i; i < length; i++) {
            if (_routeRecipients[i] == _recipient) {
                _routeRecipients[i] = _routeRecipients[length - 1];
                _routeRecipients.pop();
                break;
            }
        }
        _isRouteRecipient[_recipient] = false;

        emit RouteRecipientRemoved(_recipient);
    }

    /// @notice Set the active recipient for auto-routing.
    /// @param _active The address to set as the active recipient.
    /// @dev Callable only by ROUTER_OPERATOR_ROLE.
    function setActiveRecipient(
        address _active
    ) external onlyRole(ROUTER_OPERATOR_ROLE) {
        if (!_isRouteRecipient[_active]) revert Errors.NotRouterRecipient();

        _activeRecipient = _active;
        emit SetActiveRecipient(_activeRecipient);
    }

    /// @notice Enable or disable automatic routing.
    /// @param _enabled Boolean flag to set auto-routing state.
    /// @dev Callable only by ROUTER_OPERATOR_ROLE.
    function setAutoRouteEnabled(
        bool _enabled
    ) external onlyRole(ROUTER_OPERATOR_ROLE) {
        if (_isAutoRouteEnabled == _enabled)
            revert Errors.InvalidRouteEnabledStatus();

        _isAutoRouteEnabled = _enabled;

        emit SetAutoRouteEnabled(_enabled);
    }

    /// @notice Manually route tokens to a specified recipient.
    /// @param _token The ERC20 token address to route.
    /// @param _recipient The destination recipient address.
    /// @param _amount The amount of tokens to transfer.
    /// @dev Callable only by ROUTER_OPERATOR_ROLE.
    function manualRoute(
        address _token,
        address _recipient,
        uint256 _amount
    ) external onlyRole(ROUTER_OPERATOR_ROLE) {
        if (_isAutoRouteEnabled) revert Errors.AutoRouteEnabled();
        if (_token == address(0)) revert Errors.ZeroAddress();
        if (_amount == 0) revert Errors.ZeroAmount();
        if (!_isRouteRecipient[_recipient]) revert Errors.NotRouterRecipient();

        TransferHelper.safeTransfer(_token, _recipient, _amount);

        emit AssetsRouted(_token, _recipient, _amount);
    }
}
"
    },
    "lib/openzeppelin-contracts/contracts/access/AccessControl.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (access/AccessControl.sol)

pragma solidity ^0.8.20;

import {IAccessControl} from "./IAccessControl.sol";
import {Context} from "../utils/Context.sol";
import {IERC165, ERC165} from "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```solidity
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```solidity
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
 * to enforce additional security measures for this role.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address account => bool) hasRole;
        bytes32 adminRole;
    }

    mapping(bytes32 role => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with an {AccessControlUnauthorizedAccount} error including the required role.
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    /// @inheritdoc IERC165
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual returns (bool) {
        return _roles[role].hasRole[account];
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
     * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
     * is missing `role`.
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert AccessControlUnauthorizedAccount(account, role);
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `callerConfirmation`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address callerConfirmation) public virtual {
        if (callerConfirmation != _msgSender()) {
            revert AccessControlBadConfirmation();
        }

        _revokeRole(role, callerConfirmation);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
        if (!hasRole(role, account)) {
            _roles[role].hasRole[account] = true;
            emit RoleGranted(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Attempts to revoke `role` from `account` and returns a boolean indicating if `role` was revoked.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
        if (hasRole(role, account)) {
            _roles[role].hasRole[account] = false;
            emit RoleRevoked(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }
}
"
    },
    "lib/v3-periphery/contracts/libraries/TransferHelper.sol": {
      "content": "// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.6.0;

import '@openzeppelin/contracts/token/ERC20/IERC20.sol';

library TransferHelper {
    /// @notice Transfers tokens from the targeted address to the given destination
    /// @notice Errors with 'STF' if transfer fails
    /// @param token The contract address of the token to be transferred
    /// @param from The originating address from which the tokens will be transferred
    /// @param to The destination address of the transfer
    /// @param value The amount to be transferred
    function safeTransferFrom(
        address token,
        address from,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) =
            token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'STF');
    }

    /// @notice Transfers tokens from msg.sender to a recipient
    /// @dev Errors with ST if transfer fails
    /// @param token The contract address of the token which will be transferred
    /// @param to The recipient of the transfer
    /// @param value The value of the transfer
    function safeTransfer(
        address token,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transfer.selector, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'ST');
    }

    /// @notice Approves the stipulated contract to spend the given allowance in the given token
    /// @dev Errors with 'SA' if transfer fails
    /// @param token The contract address of the token to be approved
    /// @param to The target of the approval
    /// @param value The amount of the given token the target will be allowed to spend
    function safeApprove(
        address token,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.approve.selector, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'SA');
    }

    /// @notice Transfers ETH to the recipient address
    /// @dev Fails with `STE`
    /// @param to The destination of the transfer
    /// @param value The value to be transferred
    function safeTransferETH(address to, uint256 value) internal {
        (bool success, ) = to.call{value: value}(new bytes(0));
        require(success, 'STE');
    }
}
"
    },
    "src/interfaces/IAssetsRouter.sol": {
      "content": "// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.26;

interface IAssetsRouter {
    /*//////////////////////////////////////////////////////////////////////////
                                    EVENTS
    //////////////////////////////////////////////////////////////////////////*/

    /// @notice Emitted when a new route recipient is added
    /// @param recipient The address of the recipient added
    event RouteRecipientAdded(address indexed recipient);

    /// @notice Emitted when a route recipient is removed
    /// @param recipient The address of the recipient removed
    event RouteRecipientRemoved(address indexed recipient);

    /// @notice Emitted when auto-routing is enabled or disabled
    /// @param enabled True if auto-routing is enabled, false otherwise
    event SetAutoRouteEnabled(bool enabled);

    /// @notice Emitted when the active recipient is changed
    /// @param recipient The new active recipient address
    event SetActiveRecipient(address indexed recipient);

    /// @notice Emitted when assets are received by the contract
    /// @param token The ERC20 token address received
    /// @param recipient The address sending the assets
    /// @param amount The amount of tokens received
    event AssetsReceived(
        address indexed token,
        address indexed recipient,
        uint256 amount
    );

    /// @notice Emitted when assets are routed to a recipient
    /// @param token The ERC20 token address routed
    /// @param recipient The address receiving the routed assets
    /// @param amount The amount of tokens routed
    event AssetsRouted(
        address indexed token,
        address indexed recipient,
        uint256 amount
    );

    /*//////////////////////////////////////////////////////////////////////////
                                    PERMISSIONLESS FUNCTIONS
    //////////////////////////////////////////////////////////////////////////*/

    /// @notice Deposit tokens into the router and optionally forward them to the active recipient.
    /// @param _token The ERC20 token address being routed.
    /// @param _amount The amount of tokens to transfer.
    /// @dev Pulls tokens from msg.sender into this contract.
    ///      If auto-route is enabled, immediately forwards them to `_activeRecipient`.
    function route(address _token, uint256 _amount) external;

    /*//////////////////////////////////////////////////////////////////////////
                                    VIEW FUNCTIONS
    //////////////////////////////////////////////////////////////////////////*/

    /// @notice Returns the list of approved route recipients.
    /// @dev Returns the full list of route recipients currently registered in the router.
    /// @return routeRecipients_ The array of all registered recipient addresses.
    function getRouteRecipients()
        external
        view
        returns (address[] memory routeRecipients_);

    /// @notice Checks if an address is a valid route recipient.
    /// @dev Checks if a given address is a registered route recipient.
    /// @param _addr The address to check.
    /// @return True if the address is a valid route recipient, otherwise false.
    function isRouteRecipient(address _addr) external view returns (bool);

    /// @notice Returns the currently active route recipient.
    /// @dev Returns the currently active route recipient where assets are routed automatically.
    /// @return activeRecipient_ The address of the active route recipient.
    function getActiveRecipient()
        external
        view
        returns (address activeRecipient_);

    /// @notice Returns whether auto-routing is enabled.
    /// @dev Indicates whether automatic routing is currently enabled.
    /// @return enabled_ Boolean flag, true if auto-routing is enabled, false otherwise.
    function isAutoRouteEnabled() external view returns (bool enabled_);
}
"
    },
    "src/libraries/Errors.sol": {
      "content": "// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.26;

/// @title Errors Library
/// @author luoyhang003
/// @notice Centralized custom errors for all contracts in the protocol.
/// @dev Each error saves gas compared to revert strings. The @dev comment
///      also includes the corresponding 4-byte selector for debugging
///      and off-chain tooling.
library Errors {
    /*//////////////////////////////////////////////////////////////////////////
                                    GENERAL
    //////////////////////////////////////////////////////////////////////////*/

    /// @notice Thrown when array lengths do not match or are zero.
    /// @dev Selector: 0x9d89020a
    error InvalidArrayLength();

    /// @notice Thrown when a provided address is zero.
    /// @dev Selector: 0xd92e233d
    error ZeroAddress();

    /// @notice Thrown when a provided amount is zero.
    /// @dev Selector: 0x1f2a2005
    error ZeroAmount();

    /// @notice Thrown when an index is out of bounds.
    /// @dev Selector: 0x4e23d035
    error IndexOutOfBounds();

    /// @notice Thrown when a user is not whitelisted but tries to interact.
    /// @dev Selector: 0x2ba75b25
    error UserNotWhitelisted();

    /// @notice Thrown when a token has invalid decimals (e.g., >18).
    /// @dev Selector: 0xd25598a0
    error InvalidDecimals();

    /// @notice Thrown when an asset is not supported.
    /// @dev Selector: 0x24a01144
    error UnsupportedAsset();

    /// @notice Thrown when trying to add an already added asset.
    /// @dev Selector: 0x5ed26801
    error AssetAlreadyAdded();

    /// @notice Thrown when trying to remove an asset that was already removed.
    /// @dev Selector: 0x422afd8f
    error AssetAlreadyRemoved();

    /// @notice Thrown when a common token address conflict with the vault token address.
    /// @dev Selector: 0x8a7ea521
    error ConflictiveToken();

    /// @notice Thrown when an array is reach to the length limit.
    /// @dev Selector: 0x951becfa
    error ExceedArrayLengthLimit();

    /*//////////////////////////////////////////////////////////////////////////
                                    Token.sol
    //////////////////////////////////////////////////////////////////////////*/

    /// @notice Thrown when transfer is attempted by/for a blacklisted address.
    /// @dev Selector: 0x6554e8c5
    error TransferBlacklisted();

    /*//////////////////////////////////////////////////////////////////////////
                                    DepositVault.sol
    //////////////////////////////////////////////////////////////////////////*/

    /// @notice Thrown when deposits are paused.
    /// @dev Selector: 0x35edea30
    error DepositPaused();

    /// @notice Thrown when a deposit exceeds per-token deposit cap.
    /// @dev Selector: 0xcc60dc5b
    error ExceedTokenDepositCap();

    /// @notice Thrown when a deposit exceeds global deposit cap.
    /// @dev Selector: 0x5054f250
    error ExceedTotalDepositCap();

    /// @notice Thrown when minting results in zero shares.
    /// @dev Selector: 0x1d31001e
    error MintZeroShare();

    /// @notice Thrown when attempting to deposit zero assets.
    /// @dev Selector: 0xd69b89cc
    error DepositZeroAsset();

    /// @notice Thrown when the oracle for an asset is invalid or missing.
    /// @dev Selector: 0x9589a27d
    error InvalidOracle();

    /*//////////////////////////////////////////////////////////////////////////
                                WithdrawController.sol
    //////////////////////////////////////////////////////////////////////////*/

    /// @notice Thrown when withdrawals are paused.
    /// @dev Selector: 0xe0a39803
    error WithdrawPaused();

    /// @notice Thrown when attempting to request withdrawal of zero shares.
    /// @dev Selector: 0xef9c351b
    error RequestZeroShare();

    /// @notice Thrown when a withdrawal receipt has invalid status for the operation.
    /// @dev Selector: 0x3bb3ba88
    error InvalidReceiptStatus();

    /// @notice Thrown when a caller is not the original withdrawal requester.
    /// @dev Selector: 0xe39da59e
    error NotRequester();

    /// @notice Thrown when a caller is blacklisted.
    /// @dev Selector: 0x473250af
    error UserBlacklisted();

    /*//////////////////////////////////////////////////////////////////////////
                                  AssetsRouter.sol
    //////////////////////////////////////////////////////////////////////////*/

    /// @notice Thrown when a recipient is already added.
    /// @dev Selector: 0xce2c4eb3
    error RecipientAlreadyAdded();

    /// @notice Thrown when a recipient is already removed.
    /// @dev Selector: 0x1c7dcc84
    error RecipientAlreadyRemoved();

    /// @notice Thrown when attempting to set auto-route to its current state.
    /// @dev Selector: 0xdf2e473d
    error InvalidRouteEnabledStatus();

    /// @notice Thrown when a non-registered recipient is used.
    /// @dev Selector: 0xf29851db
    error NotRouterRecipient();

    /// @notice Thrown when attempting to remove the currently active recipient.
    /// @dev Selector: 0xa453bd1b
    error RemoveActiveRouter();

    /// @notice Thrown when attempting to manual route the asstes when auto route is enabled.
    /// @dev Selector: 0x92d56bf7
    error AutoRouteEnabled();

    /// @notice Thrown when setting the same router address.
    /// @dev Selector: 0x23b920b6
    error SameRouterAddress();

    /*//////////////////////////////////////////////////////////////////////////
                                  AccessRegistry.sol
    //////////////////////////////////////////////////////////////////////////*/

    /// @notice Thrown when trying to blacklist an already blacklisted user.
    /// @dev Selector: 0xf53de75f
    error AlreadyBlacklisted();

    /// @notice Thrown when trying to whitelist an already whitelisted user.
    /// @dev Selector: 0xb73e95e1
    error AlreadyWhitelisted();

    /// @notice Reverts when the requested state matches the current state.
    /// @dev Selector: 0x3fbc93f3
    error AlreadyInSameState();

    /*//////////////////////////////////////////////////////////////////////////
                                  OracleRegister.sol
    //////////////////////////////////////////////////////////////////////////*/

    /// @notice Thrown when an oracle is already registered for an asset.
    /// @dev Selector: 0x652a449e
    error OracleAlreadyAdded();

    /// @notice Thrown when an oracle does not exist for an asset.
    /// @dev Selector: 0x4dca4f7d
    error OracleNotExist();

    /// @notice Thrown when price deviation exceeds maximum allowed.
    /// @dev Selector: 0x8774ad87
    error ExceedMaxDeviation();

    /// @notice Thrown when price updates are attempted too frequently.
    /// @dev Selector: 0x8f46908a
    error PriceUpdateTooFrequent();

    /// @notice Thrown when a price validity period has expired.
    /// @dev Selector: 0x7c9d063a
    error PriceValidityExpired();

    /// @notice Thrown when a price is zero.
    /// @dev Selector: 0x10256287
    error InvalidZeroPrice();

    /*//////////////////////////////////////////////////////////////////////////
                                  ParamRegister.sol
    //////////////////////////////////////////////////////////////////////////*/

    /// @notice Thrown when tolerance basis points exceed maximum deviation.
    /// @dev Selector: 0xb8d855e2
    error ExceedMaxDeviationBps();

    /// @notice Thrown when price update interval is invalid.
    /// @dev Selector: 0xfff67f52
    error InvalidPriceUpdateInterval();

    /// @notice Thrown when price validity duration exceeds allowed maximum.
    /// @dev Selector: 0x6eca7e24
    error PriceMaxValidityExceeded();

    /// @notice Thrown when mint fee rate exceeds maximum allowed.
    /// @dev Selector: 0x8f59faf8
    error ExceedMaxMintFeeRate();

    /// @notice Thrown when redeem fee rate exceeds maximum allowed.
    /// @dev Selector: 0x86871089
    error ExceedMaxRedeemFeeRate();

    /*//////////////////////////////////////////////////////////////////////////
                              ChainlinkOracleFeed.sol
    //////////////////////////////////////////////////////////////////////////*/

    /// @notice Thrown when a reported price is invalid.
    /// @dev Selector: 0x00bfc921
    error InvalidPrice();

    /// @notice Thrown when a reported price is stale.
    /// @dev Selector: 0x19abf40e
    error StalePrice();

    /// @notice Thrown when a Chainlink round is incomplete.
    /// @dev Selector: 0x8ad52bdd
    error IncompleteRound();
}
"
    },
    "lib/openzeppelin-contracts/contracts/access/IAccessControl.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (access/IAccessControl.sol)

pragma solidity >=0.8.4;

/**
 * @dev External interface of AccessControl declared to support ERC-165 detection.
 */
interface IAccessControl {
    /**
     * @dev The `account` is missing a role.
     */
    error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);

    /**
     * @dev The caller of a function is not the expected one.
     *
     * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
     */
    error AccessControlBadConfirmation();

    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted to signal this.
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call. This account bears the admin role (for the granted role).
     * Expected in cases where the role was granted using the internal {AccessControl-_grantRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `callerConfirmation`.
     */
    function renounceRole(bytes32 role, address callerConfirmation) external;
}
"
    },
    "lib/openzeppelin-contracts/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;
    }
}
"
    },
    "lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

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

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC-165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 */
abstract contract ERC165 is IERC165 {
    /// @inheritdoc IERC165
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}
"
    },
    "lib/openzeppelin-contracts/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);
}
"
    },
    "lib/openzeppelin-contracts/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);
}
"
    }
  },
  "settings": {
    "remappings": [
      "@uniswap/v3-periphery/contracts/=lib/v3-periphery/contracts/",
      "@chainlink/contracts/src/v0.8/=lib/chainlink-evm/contracts/src/v0.8/shared/",
      "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
      "chainlink-evm/=lib/chainlink-evm/",
      "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/",
      "v3-periphery/=lib/v3-periphery/contracts/"
    ],
    "optimizer": {
      "enabled": false,
      "runs": 200
    },
    "metadata": {
      "useLiteralContent": false,
      "bytecodeHash": "ipfs",
      "appendCBOR": true
    },
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    },
    "evmVersion": "cancun",
    "viaIR": false
  }
}}

Tags:
ERC20, ERC165, Proxy, Upgradeable, Factory, Oracle|addr:0x219e157c79f5b188397f6ccdb6d0f97600eadfb6|verified:true|block:23628641|tx:0xa68a1230c8de7028ff63b97224e879c80da308cff4d1bd99affab814d33ff8fd|first_check:1761230382

Submitted on: 2025-10-23 16:39:45

Comments

Log in to comment.

No comments yet.