ETH Price: $2,281.28 (+0.23%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Grant Role236284642025-10-21 20:59:35104 days ago1761080375IN
0x29E171Ae...d0aa4EcB3
0 ETH0.000004930.09583728
Set Rate Limit D...236282392025-10-21 20:13:47104 days ago1761077627IN
0x29E171Ae...d0aa4EcB3
0 ETH0.000012590.10891514

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

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

Contract Source Code Verified (Exact Match)

Contract Name:
RateLimits

Compiler Version
v0.8.25+commit.b61c2a91

Optimization Enabled:
Yes with 1 runs

Other Settings:
cancun EvmVersion
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.21;

import { AccessControl } from "openzeppelin-contracts/contracts/access/AccessControl.sol";

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

contract RateLimits is IRateLimits, AccessControl {

    /**********************************************************************************************/
    /*** State variables                                                                        ***/
    /**********************************************************************************************/

    bytes32 public override constant CONTROLLER = keccak256("CONTROLLER");

    mapping(bytes32 => RateLimitData) private _data;

    /**********************************************************************************************/
    /*** Initialization                                                                         ***/
    /**********************************************************************************************/

    constructor(address admin_) {
        _grantRole(DEFAULT_ADMIN_ROLE, admin_);
    }

    /**********************************************************************************************/
    /*** Admin functions                                                                        ***/
    /**********************************************************************************************/

    function setRateLimitData(
        bytes32 key,
        uint256 maxAmount,
        uint256 slope,
        uint256 lastAmount,
        uint256 lastUpdated
    )
        public override onlyRole(DEFAULT_ADMIN_ROLE)
    {
        require(lastAmount  <= maxAmount,       "RateLimits/invalid-lastAmount");
        require(lastUpdated <= block.timestamp, "RateLimits/invalid-lastUpdated");

        _data[key] = RateLimitData({
            maxAmount:   maxAmount,
            slope:       slope,
            lastAmount:  lastAmount,
            lastUpdated: lastUpdated
        });

        emit RateLimitDataSet(key, maxAmount, slope, lastAmount, lastUpdated);
    }

    function setRateLimitData(bytes32 key, uint256 maxAmount, uint256 slope) external override {
        setRateLimitData(key, maxAmount, slope, maxAmount, block.timestamp);
    }

    function setUnlimitedRateLimitData(bytes32 key) external override {
        setRateLimitData(key, type(uint256).max, 0, type(uint256).max, block.timestamp);
    }

    /**********************************************************************************************/
    /*** Getter Functions                                                                       ***/
    /**********************************************************************************************/

    function getRateLimitData(bytes32 key) external override view returns (RateLimitData memory) {
        return _data[key];
    }

    function getCurrentRateLimit(bytes32 key) public override view returns (uint256) {
        RateLimitData memory d = _data[key];

        // Unlimited rate limit case
        if (d.maxAmount == type(uint256).max) {
            return type(uint256).max;
        }

        return _min(
            d.slope * (block.timestamp - d.lastUpdated) + d.lastAmount,
            d.maxAmount
        );
    }

    /**********************************************************************************************/
    /*** Controller functions                                                                   ***/
    /**********************************************************************************************/

    function triggerRateLimitDecrease(bytes32 key, uint256 amountToDecrease)
        external
        override
        onlyRole(CONTROLLER)
        returns (uint256 newLimit)
    {
        RateLimitData storage d = _data[key];
        uint256 maxAmount = d.maxAmount;

        require(maxAmount > 0, "RateLimits/zero-maxAmount");
        if (maxAmount == type(uint256).max) return type(uint256).max;  // Special case unlimited

        uint256 currentRateLimit = getCurrentRateLimit(key);

        require(amountToDecrease <= currentRateLimit, "RateLimits/rate-limit-exceeded");

        d.lastAmount = newLimit = currentRateLimit - amountToDecrease;
        d.lastUpdated = block.timestamp;

        emit RateLimitDecreaseTriggered(key, amountToDecrease, currentRateLimit, newLimit);
    }

    function triggerRateLimitIncrease(bytes32 key, uint256 amountToIncrease)
        external
        override
        onlyRole(CONTROLLER)
        returns (uint256 newLimit)
    {
        RateLimitData storage d = _data[key];
        uint256 maxAmount = d.maxAmount;

        require(maxAmount > 0, "RateLimits/zero-maxAmount");
        if (maxAmount == type(uint256).max) return type(uint256).max;  // Special case unlimited

        uint256 currentRateLimit = getCurrentRateLimit(key);

        d.lastAmount = newLimit = _min(currentRateLimit + amountToIncrease, maxAmount);
        d.lastUpdated = block.timestamp;

        emit RateLimitIncreaseTriggered(key, amountToIncrease, currentRateLimit, newLimit);
    }

    /**********************************************************************************************/
    /*** Internal Utility Functions                                                             ***/
    /**********************************************************************************************/

    function _min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)

pragma solidity ^0.8.20;

import {IAccessControl} from "./IAccessControl.sol";
import {Context} from "../utils/Context.sol";
import {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);
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    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` to `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;
        }
    }
}

// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity >=0.8.0;

import { IAccessControl } from "openzeppelin-contracts/contracts/access/IAccessControl.sol";

interface IRateLimits is IAccessControl {

    /**********************************************************************************************/
    /*** Structs                                                                                ***/
    /**********************************************************************************************/

    /**
     * @dev   Struct representing a rate limit.
     *        The current rate limit is calculated using the formula:
     *        `currentRateLimit = min(slope * (block.timestamp - lastUpdated) + lastAmount, maxAmount)`.
     * @param maxAmount   Maximum allowed amount at any time.
     * @param slope       The slope of the rate limit, used to calculate the new
     *                    limit based on time passed. [tokens / second]
     * @param lastAmount  The amount left available at the last update.
     * @param lastUpdated The timestamp when the rate limit was last updated.
     */
    struct RateLimitData {
        uint256 maxAmount;
        uint256 slope;
        uint256 lastAmount;
        uint256 lastUpdated;
    }

    /**********************************************************************************************/
    /*** Events                                                                                 ***/
    /**********************************************************************************************/

    /**
     * @dev   Emitted when the rate limit data is set.
     * @param key         The identifier for the rate limit.
     * @param maxAmount   The maximum allowed amount for the rate limit.
     * @param slope       The slope value used in the rate limit calculation.
     * @param lastAmount  The amount left available at the last update.
     * @param lastUpdated The timestamp when the rate limit was last updated.
     */
    event RateLimitDataSet(
        bytes32 indexed key,
        uint256 maxAmount,
        uint256 slope,
        uint256 lastAmount,
        uint256 lastUpdated
    );

    /**
     * @dev   Emitted when a rate limit decrease is triggered.
     * @param key              The identifier for the rate limit.
     * @param amountToDecrease The amount to decrease from the current rate limit.
     * @param oldRateLimit     The previous rate limit value before triggering.
     * @param newRateLimit     The new rate limit value after triggering.
     */
    event RateLimitDecreaseTriggered(
        bytes32 indexed key,
        uint256 amountToDecrease,
        uint256 oldRateLimit,
        uint256 newRateLimit
    );

    /**
     * @dev   Emitted when a rate limit increase is triggered.
     * @param key              The identifier for the rate limit.
     * @param amountToIncrease The amount to increase from the current rate limit.
     * @param oldRateLimit     The previous rate limit value before triggering.
     * @param newRateLimit     The new rate limit value after triggering.
     */
    event RateLimitIncreaseTriggered(
        bytes32 indexed key,
        uint256 amountToIncrease,
        uint256 oldRateLimit,
        uint256 newRateLimit
    );

    /**********************************************************************************************/
    /*** State variables                                                                        ***/
    /**********************************************************************************************/

    /**
     * @dev    Returns the controller identifier as a bytes32 value.
     * @return The controller identifier.
     */
    function CONTROLLER() external view returns (bytes32);

    /**********************************************************************************************/
    /*** Admin functions                                                                        ***/
    /**********************************************************************************************/

    /**
     * @dev   Sets rate limit data for a specific key.
     * @param key         The identifier for the rate limit.
     * @param maxAmount   The maximum allowed amount for the rate limit.
     * @param slope       The slope value used in the rate limit calculation.
     * @param lastAmount  The amount left available at the last update.
     * @param lastUpdated The timestamp when the rate limit was last updated.
     */
    function setRateLimitData(
        bytes32 key,
        uint256 maxAmount,
        uint256 slope,
        uint256 lastAmount,
        uint256 lastUpdated
    ) external;

    /**
     * @dev   Sets rate limit data for a specific key with
     *        `lastAmount == maxAmount` and `lastUpdated == block.timestamp`.
     * @param key       The identifier for the rate limit.
     * @param maxAmount The maximum allowed amount for the rate limit.
     * @param slope     The slope value used in the rate limit calculation.
     */
    function setRateLimitData(bytes32 key, uint256 maxAmount, uint256 slope) external;

    /**
     * @dev   Sets an unlimited rate limit.
     * @param key The identifier for the rate limit.
     */
    function setUnlimitedRateLimitData(bytes32 key) external;

    /**********************************************************************************************/
    /*** Getter Functions                                                                       ***/
    /**********************************************************************************************/

    /**
     * @dev    Retrieves the RateLimitData struct associated with a specific key.
     * @param  key The identifier for the rate limit.
     * @return The data associated with the rate limit.
     */
    function getRateLimitData(bytes32 key) external view returns (RateLimitData memory);

    /**
     * @dev    Retrieves the current rate limit for a specific key.
     * @param  key The identifier for the rate limit.
     * @return The current rate limit value for the given key.
     */
    function getCurrentRateLimit(bytes32 key) external view returns (uint256);

    /**********************************************************************************************/
    /*** Controller functions                                                                   ***/
    /**********************************************************************************************/

    /**
     * @dev    Triggers the rate limit for a specific key and reduces the available
     *         amount by the provided value.
     * @param  key              The identifier for the rate limit.
     * @param  amountToDecrease The amount to decrease from the current rate limit.
     * @return newLimit         The updated rate limit after the deduction.
     */
    function triggerRateLimitDecrease(bytes32 key, uint256 amountToDecrease)
        external returns (uint256 newLimit);

    /**
     * @dev    Increases the rate limit for a given key up to the maxAmount. Does not revert if
     *         the new rate limit exceeds the maxAmount.
     * @param  key              The identifier for the rate limit.
     * @param  amountToIncrease The amount to increase from the current rate limit.
     * @return newLimit         The updated rate limit after the addition.
     */
    function triggerRateLimitIncrease(bytes32 key, uint256 amountToIncrease)
        external returns (uint256 newLimit);

}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)

pragma solidity ^0.8.20;

/**
 * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    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;
}

// 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.0.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 ERC165 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 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

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

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * 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[EIP 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": [
    "@layerzerolabs/oft-evm/=lib/devtools/packages/oft-evm/",
    "layerzerolabs/oapp-evm/=lib/devtools/packages/oapp-evm/",
    "@layerzerolabs/lz-evm-protocol-v2/=lib/layerzero-v2/packages/layerzero-v2/evm/protocol/",
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "@layerzerolabs/lz-evm-messagelib-v2/=lib/layerzero-v2/packages/layerzero-v2/evm/messagelib/",
    "solidity-bytes-utils/=lib/solidity-bytes-utils/",
    "@openzeppelin/contracts-upgradeable/=lib/sdai/lib/openzeppelin-contracts-upgradeable/contracts/",
    "LayerZero-v2/=lib/xchain-helpers/lib/",
    "aave-v3-core/=lib/aave-v3-origin/src/core/",
    "aave-v3-origin/=lib/aave-v3-origin/",
    "aave-v3-periphery/=lib/aave-v3-origin/src/periphery/",
    "devtools/=lib/devtools/packages/toolbox-foundry/src/",
    "ds-test/=lib/grove-address-registry/lib/forge-std/lib/ds-test/src/",
    "dss-allocator/=lib/dss-allocator/",
    "dss-interfaces/=lib/dss-test/lib/dss-interfaces/src/",
    "dss-test/=lib/dss-test/src/",
    "erc20-helpers/=lib/erc20-helpers/src/",
    "erc4626-tests/=lib/metamorpho/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "grove-address-registry/=lib/grove-address-registry/src/",
    "layerzero-v2/=lib/layerzero-v2/",
    "metamorpho/=lib/metamorpho/src/",
    "morpho-blue/=lib/metamorpho/lib/morpho-blue/",
    "murky/=lib/metamorpho/lib/universal-rewards-distributor/lib/murky/src/",
    "openzeppelin-contracts-upgradeable/=lib/sdai/lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "openzeppelin-foundry-upgrades/=lib/sdai/lib/openzeppelin-foundry-upgrades/src/",
    "openzeppelin/=lib/metamorpho/lib/universal-rewards-distributor/lib/openzeppelin-contracts/contracts/",
    "sdai/=lib/sdai/",
    "solidity-stringutils/=lib/sdai/lib/openzeppelin-foundry-upgrades/lib/solidity-stringutils/",
    "solidity-utils/=lib/aave-v3-origin/lib/solidity-utils/",
    "spark-address-registry/=lib/spark-address-registry/src/",
    "spark-psm/=lib/spark-psm/",
    "sparklend-address-registry/=lib/spark-psm/lib/xchain-ssr-oracle/lib/sparklend-address-registry/",
    "token-tests/=lib/sdai/lib/token-tests/src/",
    "universal-rewards-distributor/=lib/metamorpho/lib/universal-rewards-distributor/src/",
    "usds/=lib/usds/",
    "xchain-helpers/=lib/xchain-helpers/src/",
    "xchain-ssr-oracle/=lib/spark-psm/lib/xchain-ssr-oracle/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 1
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "cancun",
  "viaIR": false
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"admin_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"key","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"maxAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"slope","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lastAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lastUpdated","type":"uint256"}],"name":"RateLimitDataSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"key","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amountToDecrease","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"oldRateLimit","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newRateLimit","type":"uint256"}],"name":"RateLimitDecreaseTriggered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"key","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amountToIncrease","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"oldRateLimit","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newRateLimit","type":"uint256"}],"name":"RateLimitIncreaseTriggered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"CONTROLLER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"key","type":"bytes32"}],"name":"getCurrentRateLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"key","type":"bytes32"}],"name":"getRateLimitData","outputs":[{"components":[{"internalType":"uint256","name":"maxAmount","type":"uint256"},{"internalType":"uint256","name":"slope","type":"uint256"},{"internalType":"uint256","name":"lastAmount","type":"uint256"},{"internalType":"uint256","name":"lastUpdated","type":"uint256"}],"internalType":"struct IRateLimits.RateLimitData","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"key","type":"bytes32"},{"internalType":"uint256","name":"maxAmount","type":"uint256"},{"internalType":"uint256","name":"slope","type":"uint256"}],"name":"setRateLimitData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"key","type":"bytes32"},{"internalType":"uint256","name":"maxAmount","type":"uint256"},{"internalType":"uint256","name":"slope","type":"uint256"},{"internalType":"uint256","name":"lastAmount","type":"uint256"},{"internalType":"uint256","name":"lastUpdated","type":"uint256"}],"name":"setRateLimitData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"key","type":"bytes32"}],"name":"setUnlimitedRateLimitData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"key","type":"bytes32"},{"internalType":"uint256","name":"amountToDecrease","type":"uint256"}],"name":"triggerRateLimitDecrease","outputs":[{"internalType":"uint256","name":"newLimit","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"key","type":"bytes32"},{"internalType":"uint256","name":"amountToIncrease","type":"uint256"}],"name":"triggerRateLimitIncrease","outputs":[{"internalType":"uint256","name":"newLimit","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]

608060405234801561000f575f80fd5b50604051610bab380380610bab83398101604081905261002e916100e8565b6100385f8261003f565b5050610115565b5f828152602081815260408083206001600160a01b038516845290915281205460ff166100df575f838152602081815260408083206001600160a01b03861684529091529020805460ff191660011790556100973390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45060016100e2565b505f5b92915050565b5f602082840312156100f8575f80fd5b81516001600160a01b038116811461010e575f80fd5b9392505050565b610a89806101225f395ff3fe608060405234801561000f575f80fd5b50600436106100c3575f3560e01c806301ffc9a7146100c7578063248a9ca3146100ef5780632f2ff15d1461011057806334323fba1461012557806336568abe146101385780633bf076b01461014b5780635c093b741461015e57806369d4ac031461017157806391d1485414610184578063a217fddf14610197578063c88175031461019e578063d547741f146101b1578063ee0fc121146101c4578063f6a82d1a146101d8578063ff7a9fa4146101eb575b5f80fd5b6100da6100d53660046108a2565b610231565b60405190151581526020015b60405180910390f35b6101026100fd3660046108c9565b610267565b6040519081526020016100e6565b61012361011e3660046108e0565b61027b565b005b610123610133366004610919565b61029d565b6101236101463660046108e0565b6102af565b610102610159366004610942565b6102e2565b61010261016c366004610942565b610401565b61010261017f3660046108c9565b6104bd565b6100da6101923660046108e0565b610548565b6101025f81565b6101236101ac3660046108c9565b610570565b6101236101bf3660046108e0565b610582565b6101025f80516020610a3483398151915281565b6101236101e6366004610962565b61059e565b6101fe6101f93660046108c9565b6106e4565b6040516100e691908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b5f6001600160e01b03198216637965db0b60e01b148061026157506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f9081526020819052604090206001015490565b61028482610267565b61028d8161074e565b6102978383610758565b50505050565b6102aa838383854261059e565b505050565b6001600160a01b03811633146102d85760405163334bd91960e11b815260040160405180910390fd5b6102aa82826107e7565b5f5f80516020610a348339815191526102fa8161074e565b5f84815260016020526040902080548061032f5760405162461bcd60e51b815260040161032690610999565b60405180910390fd5b5f198103610342575f19935050506103fa565b5f61034c876104bd565b90508086111561039e5760405162461bcd60e51b815260206004820152601e60248201527f526174654c696d6974732f726174652d6c696d69742d657863656564656400006044820152606401610326565b6103a886826109e0565b6002840181905542600385015560405190955087907f2f9bcbd665fb7984aac3b6a05bb4ac8b303137a34ed4cc5fcd47622f52bdf046906103ee90899085908a906109f3565b60405180910390a25050505b5092915050565b5f5f80516020610a348339815191526104198161074e565b5f8481526001602052604090208054806104455760405162461bcd60e51b815260040161032690610999565b5f198103610458575f19935050506103fa565b5f610462876104bd565b90506104776104718783610a09565b83610850565b6002840181905542600385015560405190955087907fb824249bbde4df2bf5473f603ab3aa717ea2e37b908d9fb4440b962fb656d0ac906103ee90899085908a906109f3565b5f818152600160208181526040808420815160808101835281548082528286015494820194909452600282015492810192909252600301546060820152910161050957505f1992915050565b610541816040015182606001514261052191906109e0565b83602001516105309190610a1c565b61053a9190610a09565b8251610850565b9392505050565b5f918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b61057f815f195f5f194261059e565b50565b61058b82610267565b6105948161074e565b61029783836107e7565b5f6105a88161074e565b848311156105f85760405162461bcd60e51b815260206004820152601d60248201527f526174654c696d6974732f696e76616c69642d6c617374416d6f756e740000006044820152606401610326565b428211156106485760405162461bcd60e51b815260206004820152601e60248201527f526174654c696d6974732f696e76616c69642d6c6173745570646174656400006044820152606401610326565b6040805160808082018352878252602080830188815283850188815260608086018981525f8e815260018087529089902097518855935193870193909355905160028601559051600390940193909355835189815290810188905292830186905290820184905287917f356822943b80f809508a684c67d901d5c13b6a22161bf07d510e50a6cb727028910160405180910390a2505050505050565b61070b60405180608001604052805f81526020015f81526020015f81526020015f81525090565b505f908152600160208181526040928390208351608081018552815481529281015491830191909152600281015492820192909252600390910154606082015290565b61057f8133610865565b5f6107638383610548565b6107e0575f838152602081815260408083206001600160a01b03861684529091529020805460ff191660011790556107983390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610261565b505f610261565b5f6107f28383610548565b156107e0575f838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610261565b5f81831061085e5781610541565b5090919050565b61086f8282610548565b61089e5760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610326565b5050565b5f602082840312156108b2575f80fd5b81356001600160e01b031981168114610541575f80fd5b5f602082840312156108d9575f80fd5b5035919050565b5f80604083850312156108f1575f80fd5b8235915060208301356001600160a01b038116811461090e575f80fd5b809150509250929050565b5f805f6060848603121561092b575f80fd5b505081359360208301359350604090920135919050565b5f8060408385031215610953575f80fd5b50508035926020909101359150565b5f805f805f60a08688031215610976575f80fd5b505083359560208501359550604085013594606081013594506080013592509050565b60208082526019908201527814985d19531a5b5a5d1ccbde995c9bcb5b585e105b5bdd5b9d603a1b604082015260600190565b634e487b7160e01b5f52601160045260245ffd5b81810381811115610261576102616109cc565b9283526020830191909152604082015260600190565b80820180821115610261576102616109cc565b8082028115828204841417610261576102616109cc56fe70546d1c92f8c2132ae23a23f5177aa8526356051c7510df99f50e012d221529a26469706673582212209d1fb065e8909003fe8ddd25e25b56e1fcd1b439f5968fcf5aba0f53d51a8d7e64736f6c6343000819003300000000000000000000000072de9ab4dd9541a0ccd9735a01ed2427d4b9af54

Deployed Bytecode

0x608060405234801561000f575f80fd5b50600436106100c3575f3560e01c806301ffc9a7146100c7578063248a9ca3146100ef5780632f2ff15d1461011057806334323fba1461012557806336568abe146101385780633bf076b01461014b5780635c093b741461015e57806369d4ac031461017157806391d1485414610184578063a217fddf14610197578063c88175031461019e578063d547741f146101b1578063ee0fc121146101c4578063f6a82d1a146101d8578063ff7a9fa4146101eb575b5f80fd5b6100da6100d53660046108a2565b610231565b60405190151581526020015b60405180910390f35b6101026100fd3660046108c9565b610267565b6040519081526020016100e6565b61012361011e3660046108e0565b61027b565b005b610123610133366004610919565b61029d565b6101236101463660046108e0565b6102af565b610102610159366004610942565b6102e2565b61010261016c366004610942565b610401565b61010261017f3660046108c9565b6104bd565b6100da6101923660046108e0565b610548565b6101025f81565b6101236101ac3660046108c9565b610570565b6101236101bf3660046108e0565b610582565b6101025f80516020610a3483398151915281565b6101236101e6366004610962565b61059e565b6101fe6101f93660046108c9565b6106e4565b6040516100e691908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b5f6001600160e01b03198216637965db0b60e01b148061026157506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f9081526020819052604090206001015490565b61028482610267565b61028d8161074e565b6102978383610758565b50505050565b6102aa838383854261059e565b505050565b6001600160a01b03811633146102d85760405163334bd91960e11b815260040160405180910390fd5b6102aa82826107e7565b5f5f80516020610a348339815191526102fa8161074e565b5f84815260016020526040902080548061032f5760405162461bcd60e51b815260040161032690610999565b60405180910390fd5b5f198103610342575f19935050506103fa565b5f61034c876104bd565b90508086111561039e5760405162461bcd60e51b815260206004820152601e60248201527f526174654c696d6974732f726174652d6c696d69742d657863656564656400006044820152606401610326565b6103a886826109e0565b6002840181905542600385015560405190955087907f2f9bcbd665fb7984aac3b6a05bb4ac8b303137a34ed4cc5fcd47622f52bdf046906103ee90899085908a906109f3565b60405180910390a25050505b5092915050565b5f5f80516020610a348339815191526104198161074e565b5f8481526001602052604090208054806104455760405162461bcd60e51b815260040161032690610999565b5f198103610458575f19935050506103fa565b5f610462876104bd565b90506104776104718783610a09565b83610850565b6002840181905542600385015560405190955087907fb824249bbde4df2bf5473f603ab3aa717ea2e37b908d9fb4440b962fb656d0ac906103ee90899085908a906109f3565b5f818152600160208181526040808420815160808101835281548082528286015494820194909452600282015492810192909252600301546060820152910161050957505f1992915050565b610541816040015182606001514261052191906109e0565b83602001516105309190610a1c565b61053a9190610a09565b8251610850565b9392505050565b5f918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b61057f815f195f5f194261059e565b50565b61058b82610267565b6105948161074e565b61029783836107e7565b5f6105a88161074e565b848311156105f85760405162461bcd60e51b815260206004820152601d60248201527f526174654c696d6974732f696e76616c69642d6c617374416d6f756e740000006044820152606401610326565b428211156106485760405162461bcd60e51b815260206004820152601e60248201527f526174654c696d6974732f696e76616c69642d6c6173745570646174656400006044820152606401610326565b6040805160808082018352878252602080830188815283850188815260608086018981525f8e815260018087529089902097518855935193870193909355905160028601559051600390940193909355835189815290810188905292830186905290820184905287917f356822943b80f809508a684c67d901d5c13b6a22161bf07d510e50a6cb727028910160405180910390a2505050505050565b61070b60405180608001604052805f81526020015f81526020015f81526020015f81525090565b505f908152600160208181526040928390208351608081018552815481529281015491830191909152600281015492820192909252600390910154606082015290565b61057f8133610865565b5f6107638383610548565b6107e0575f838152602081815260408083206001600160a01b03861684529091529020805460ff191660011790556107983390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610261565b505f610261565b5f6107f28383610548565b156107e0575f838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610261565b5f81831061085e5781610541565b5090919050565b61086f8282610548565b61089e5760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610326565b5050565b5f602082840312156108b2575f80fd5b81356001600160e01b031981168114610541575f80fd5b5f602082840312156108d9575f80fd5b5035919050565b5f80604083850312156108f1575f80fd5b8235915060208301356001600160a01b038116811461090e575f80fd5b809150509250929050565b5f805f6060848603121561092b575f80fd5b505081359360208301359350604090920135919050565b5f8060408385031215610953575f80fd5b50508035926020909101359150565b5f805f805f60a08688031215610976575f80fd5b505083359560208501359550604085013594606081013594506080013592509050565b60208082526019908201527814985d19531a5b5a5d1ccbde995c9bcb5b585e105b5bdd5b9d603a1b604082015260600190565b634e487b7160e01b5f52601160045260245ffd5b81810381811115610261576102616109cc565b9283526020830191909152604082015260600190565b80820180821115610261576102616109cc565b8082028115828204841417610261576102616109cc56fe70546d1c92f8c2132ae23a23f5177aa8526356051c7510df99f50e012d221529a26469706673582212209d1fb065e8909003fe8ddd25e25b56e1fcd1b439f5968fcf5aba0f53d51a8d7e64736f6c63430008190033

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

00000000000000000000000072de9ab4dd9541a0ccd9735a01ed2427d4b9af54

-----Decoded View---------------
Arg [0] : admin_ (address): 0x72dE9Ab4dD9541a0CCD9735A01ed2427D4b9AF54

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000072de9ab4dd9541a0ccd9735a01ed2427d4b9af54


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]

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