Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
RateLimits
Compiler Version
v0.8.25+commit.b61c2a91
Optimization Enabled:
Yes with 200 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// 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);
}{
"remappings": [
"@openzeppelin/contracts-upgradeable/=lib/sdai/lib/openzeppelin-contracts-upgradeable/contracts/",
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"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/",
"bloom-address-registry/=lib/bloom-address-registry/src/",
"ds-test/=lib/metamorpho/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/",
"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": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "cancun",
"viaIR": false,
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
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"}]Contract Creation Code
608060405234801561000f575f80fd5b50604051610c17380380610c1783398101604081905261002e916100e8565b6100385f8261003f565b5050610115565b5f828152602081815260408083206001600160a01b038516845290915281205460ff166100df575f838152602081815260408083206001600160a01b03861684529091529020805460ff191660011790556100973390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45060016100e2565b505f5b92915050565b5f602082840312156100f8575f80fd5b81516001600160a01b038116811461010e575f80fd5b9392505050565b610af5806101225f395ff3fe608060405234801561000f575f80fd5b50600436106100f0575f3560e01c806369d4ac0311610093578063d547741f11610063578063d547741f146101ed578063ee0fc12114610200578063f6a82d1a14610227578063ff7a9fa41461023a575f80fd5b806369d4ac03146101ad57806391d14854146101c0578063a217fddf146101d3578063c8817503146101da575f80fd5b806334323fba116100ce57806334323fba1461016157806336568abe146101745780633bf076b0146101875780635c093b741461019a575f80fd5b806301ffc9a7146100f4578063248a9ca31461011c5780632f2ff15d1461014c575b5f80fd5b610107610102366004610977565b610280565b60405190151581526020015b60405180910390f35b61013e61012a36600461099e565b5f9081526020819052604090206001015490565b604051908152602001610113565b61015f61015a3660046109b5565b6102b6565b005b61015f61016f3660046109ee565b6102e0565b61015f6101823660046109b5565b6102f2565b61013e610195366004610a17565b610325565b61013e6101a8366004610a17565b610485565b61013e6101bb36600461099e565b61058a565b6101076101ce3660046109b5565b610615565b61013e5f81565b61015f6101e836600461099e565b61063d565b61015f6101fb3660046109b5565b61064f565b61013e7f70546d1c92f8c2132ae23a23f5177aa8526356051c7510df99f50e012d22152981565b61015f610235366004610a37565b610673565b61024d61024836600461099e565b6107b9565b60405161011391908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b5f6001600160e01b03198216637965db0b60e01b14806102b057506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f828152602081905260409020600101546102d081610823565b6102da838361082d565b50505050565b6102ed8383838542610673565b505050565b6001600160a01b038116331461031b5760405163334bd91960e11b815260040160405180910390fd5b6102ed82826108bc565b5f7f70546d1c92f8c2132ae23a23f5177aa8526356051c7510df99f50e012d22152961035081610823565b5f8481526001602052604090208054806103ad5760405162461bcd60e51b815260206004820152601960248201527814985d19531a5b5a5d1ccbde995c9bcb5b585e105b5bdd5b9d603a1b60448201526064015b60405180910390fd5b5f1981036103c0575f199350505061047e565b5f6103ca8761058a565b90508086111561041c5760405162461bcd60e51b815260206004820152601e60248201527f526174654c696d6974732f726174652d6c696d69742d6578636565646564000060448201526064016103a4565b6104268682610a82565b60028401819055426003850155604080518881526020810184905290810182905290955087907f2f9bcbd665fb7984aac3b6a05bb4ac8b303137a34ed4cc5fcd47622f52bdf046906060015b60405180910390a25050505b5092915050565b5f7f70546d1c92f8c2132ae23a23f5177aa8526356051c7510df99f50e012d2215296104b081610823565b5f8481526001602052604090208054806105085760405162461bcd60e51b815260206004820152601960248201527814985d19531a5b5a5d1ccbde995c9bcb5b585e105b5bdd5b9d603a1b60448201526064016103a4565b5f19810361051b575f199350505061047e565b5f6105258761058a565b905061053a6105348783610a95565b83610925565b60028401819055426003850155604080518881526020810184905290810182905290955087907fb824249bbde4df2bf5473f603ab3aa717ea2e37b908d9fb4440b962fb656d0ac90606001610472565b5f81815260016020818152604080842081516080810183528154808252828601549482019490945260028201549281019290925260030154606082015291016105d657505f1992915050565b61060e81604001518260600151426105ee9190610a82565b83602001516105fd9190610aa8565b6106079190610a95565b8251610925565b9392505050565b5f918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b61064c815f195f5f1942610673565b50565b5f8281526020819052604090206001015461066981610823565b6102da83836108bc565b5f61067d81610823565b848311156106cd5760405162461bcd60e51b815260206004820152601d60248201527f526174654c696d6974732f696e76616c69642d6c617374416d6f756e7400000060448201526064016103a4565b4282111561071d5760405162461bcd60e51b815260206004820152601e60248201527f526174654c696d6974732f696e76616c69642d6c61737455706461746564000060448201526064016103a4565b6040805160808082018352878252602080830188815283850188815260608086018981525f8e815260018087529089902097518855935193870193909355905160028601559051600390940193909355835189815290810188905292830186905290820184905287917f356822943b80f809508a684c67d901d5c13b6a22161bf07d510e50a6cb727028910160405180910390a2505050505050565b6107e060405180608001604052805f81526020015f81526020015f81526020015f81525090565b505f908152600160208181526040928390208351608081018552815481529281015491830191909152600281015492820192909252600390910154606082015290565b61064c813361093a565b5f6108388383610615565b6108b5575f838152602081815260408083206001600160a01b03861684529091529020805460ff1916600117905561086d3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45060016102b0565b505f6102b0565b5f6108c78383610615565b156108b5575f838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45060016102b0565b5f818310610933578161060e565b5090919050565b6109448282610615565b6109735760405163e2517d3f60e01b81526001600160a01b0382166004820152602481018390526044016103a4565b5050565b5f60208284031215610987575f80fd5b81356001600160e01b03198116811461060e575f80fd5b5f602082840312156109ae575f80fd5b5035919050565b5f80604083850312156109c6575f80fd5b8235915060208301356001600160a01b03811681146109e3575f80fd5b809150509250929050565b5f805f60608486031215610a00575f80fd5b505081359360208301359350604090920135919050565b5f8060408385031215610a28575f80fd5b50508035926020909101359150565b5f805f805f60a08688031215610a4b575f80fd5b505083359560208501359550604085013594606081013594506080013592509050565b634e487b7160e01b5f52601160045260245ffd5b818103818111156102b0576102b0610a6e565b808201808211156102b0576102b0610a6e565b80820281158282048414176102b0576102b0610a6e56fea26469706673582212200a006cfa1130a1bb10a3df49bc683cc90ed38d58974ddffefe34fb2eb8464f5e64736f6c634300081900330000000000000000000000001369f7b2b38c76b6478c0f0e66d94923421891ba
Deployed Bytecode
0x608060405234801561000f575f80fd5b50600436106100f0575f3560e01c806369d4ac0311610093578063d547741f11610063578063d547741f146101ed578063ee0fc12114610200578063f6a82d1a14610227578063ff7a9fa41461023a575f80fd5b806369d4ac03146101ad57806391d14854146101c0578063a217fddf146101d3578063c8817503146101da575f80fd5b806334323fba116100ce57806334323fba1461016157806336568abe146101745780633bf076b0146101875780635c093b741461019a575f80fd5b806301ffc9a7146100f4578063248a9ca31461011c5780632f2ff15d1461014c575b5f80fd5b610107610102366004610977565b610280565b60405190151581526020015b60405180910390f35b61013e61012a36600461099e565b5f9081526020819052604090206001015490565b604051908152602001610113565b61015f61015a3660046109b5565b6102b6565b005b61015f61016f3660046109ee565b6102e0565b61015f6101823660046109b5565b6102f2565b61013e610195366004610a17565b610325565b61013e6101a8366004610a17565b610485565b61013e6101bb36600461099e565b61058a565b6101076101ce3660046109b5565b610615565b61013e5f81565b61015f6101e836600461099e565b61063d565b61015f6101fb3660046109b5565b61064f565b61013e7f70546d1c92f8c2132ae23a23f5177aa8526356051c7510df99f50e012d22152981565b61015f610235366004610a37565b610673565b61024d61024836600461099e565b6107b9565b60405161011391908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b5f6001600160e01b03198216637965db0b60e01b14806102b057506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f828152602081905260409020600101546102d081610823565b6102da838361082d565b50505050565b6102ed8383838542610673565b505050565b6001600160a01b038116331461031b5760405163334bd91960e11b815260040160405180910390fd5b6102ed82826108bc565b5f7f70546d1c92f8c2132ae23a23f5177aa8526356051c7510df99f50e012d22152961035081610823565b5f8481526001602052604090208054806103ad5760405162461bcd60e51b815260206004820152601960248201527814985d19531a5b5a5d1ccbde995c9bcb5b585e105b5bdd5b9d603a1b60448201526064015b60405180910390fd5b5f1981036103c0575f199350505061047e565b5f6103ca8761058a565b90508086111561041c5760405162461bcd60e51b815260206004820152601e60248201527f526174654c696d6974732f726174652d6c696d69742d6578636565646564000060448201526064016103a4565b6104268682610a82565b60028401819055426003850155604080518881526020810184905290810182905290955087907f2f9bcbd665fb7984aac3b6a05bb4ac8b303137a34ed4cc5fcd47622f52bdf046906060015b60405180910390a25050505b5092915050565b5f7f70546d1c92f8c2132ae23a23f5177aa8526356051c7510df99f50e012d2215296104b081610823565b5f8481526001602052604090208054806105085760405162461bcd60e51b815260206004820152601960248201527814985d19531a5b5a5d1ccbde995c9bcb5b585e105b5bdd5b9d603a1b60448201526064016103a4565b5f19810361051b575f199350505061047e565b5f6105258761058a565b905061053a6105348783610a95565b83610925565b60028401819055426003850155604080518881526020810184905290810182905290955087907fb824249bbde4df2bf5473f603ab3aa717ea2e37b908d9fb4440b962fb656d0ac90606001610472565b5f81815260016020818152604080842081516080810183528154808252828601549482019490945260028201549281019290925260030154606082015291016105d657505f1992915050565b61060e81604001518260600151426105ee9190610a82565b83602001516105fd9190610aa8565b6106079190610a95565b8251610925565b9392505050565b5f918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b61064c815f195f5f1942610673565b50565b5f8281526020819052604090206001015461066981610823565b6102da83836108bc565b5f61067d81610823565b848311156106cd5760405162461bcd60e51b815260206004820152601d60248201527f526174654c696d6974732f696e76616c69642d6c617374416d6f756e7400000060448201526064016103a4565b4282111561071d5760405162461bcd60e51b815260206004820152601e60248201527f526174654c696d6974732f696e76616c69642d6c61737455706461746564000060448201526064016103a4565b6040805160808082018352878252602080830188815283850188815260608086018981525f8e815260018087529089902097518855935193870193909355905160028601559051600390940193909355835189815290810188905292830186905290820184905287917f356822943b80f809508a684c67d901d5c13b6a22161bf07d510e50a6cb727028910160405180910390a2505050505050565b6107e060405180608001604052805f81526020015f81526020015f81526020015f81525090565b505f908152600160208181526040928390208351608081018552815481529281015491830191909152600281015492820192909252600390910154606082015290565b61064c813361093a565b5f6108388383610615565b6108b5575f838152602081815260408083206001600160a01b03861684529091529020805460ff1916600117905561086d3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45060016102b0565b505f6102b0565b5f6108c78383610615565b156108b5575f838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45060016102b0565b5f818310610933578161060e565b5090919050565b6109448282610615565b6109735760405163e2517d3f60e01b81526001600160a01b0382166004820152602481018390526044016103a4565b5050565b5f60208284031215610987575f80fd5b81356001600160e01b03198116811461060e575f80fd5b5f602082840312156109ae575f80fd5b5035919050565b5f80604083850312156109c6575f80fd5b8235915060208301356001600160a01b03811681146109e3575f80fd5b809150509250929050565b5f805f60608486031215610a00575f80fd5b505081359360208301359350604090920135919050565b5f8060408385031215610a28575f80fd5b50508035926020909101359150565b5f805f805f60a08688031215610a4b575f80fd5b505083359560208501359550604085013594606081013594506080013592509050565b634e487b7160e01b5f52601160045260245ffd5b818103818111156102b0576102b0610a6e565b808201808211156102b0576102b0610a6e565b80820281158282048414176102b0576102b0610a6e56fea26469706673582212200a006cfa1130a1bb10a3df49bc683cc90ed38d58974ddffefe34fb2eb8464f5e64736f6c63430008190033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000001369f7b2b38c76b6478c0f0e66d94923421891ba
-----Decoded View---------------
Arg [0] : admin_ (address): 0x1369f7b2b38c76B6478c0f0E66D94923421891Ba
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000001369f7b2b38c76b6478c0f0e66d94923421891ba
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.