ERC-20
DeFi
Overview
Max Total Supply
324,552.768354791169728296 svUSD
Holders
1,674 (0.00%)
Market
Price
$0.97 @ 0.000373 ETH
Onchain Market Cap
$316,126.40
Circulating Supply Market Cap
$0.00
Other Info
Token Contract (WITH 18 Decimals)
Balance
0.5 svUSDValue
$0.49 ( ~0.00018743959251477 ETH) [0.0002%]Loading...
Loading
Loading...
Loading
Loading...
Loading
Contract Name:
SavvySyntheticToken
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.17; import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol"; import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import {IllegalArgument, IllegalState, Unauthorized} from "./base/Errors.sol"; import {IERC3156FlashBorrower} from "./interfaces/IERC3156FlashBorrower.sol"; import {IERC3156FlashLender} from "./interfaces/IERC3156FlashLender.sol"; import "./libraries/Checker.sol"; /// @title SavvyToken /// @author Savvy DeFi /// /// @notice This is the contract for the Savvy's synthetic token (svTokens). contract SavvySyntheticToken is AccessControl, ReentrancyGuard, ERC20, IERC3156FlashLender { /// @notice The identifier of the role which maintains other roles. bytes32 public constant ADMIN_ROLE = keccak256("ADMIN"); /// @notice The identifier of the role which allows accounts to mint tokens. bytes32 public constant SENTINEL_ROLE = keccak256("SENTINEL"); /// @notice The indentifier of the role which allows bytes32 public constant MINTER_ROLE = keccak256("MINTER"); /// @notice The expected return value from a flash mint receiver. bytes32 public constant CALLBACK_SUCCESS = keccak256("ERC3156FlashBorrower.onFlashLoan"); /// @notice The maximum number of basis points needed to represent 100%. uint256 public constant BPS = 10000; /// @notice A set of addresses which are paused from minting new tokens. mapping(address => bool) public paused; /// @notice Fee for flash minting. uint256 public flashMintFee; /// @notice Max flash mint amount. uint256 public maxFlashLoanAmount; /// @notice An event which is emitted when a minter is paused from minting. /// /// @param minter The address of the minter which was paused. /// @param state A flag indicating if the savvy is paused or unpaused. event Paused(address minter, bool state); /// @notice An event which is emitted when the flash mint fee is updated. /// /// @param fee The new flash mint fee. event SetFlashMintFee(uint256 fee); constructor( string memory _name, string memory _symbol, uint256 _flashFee ) ERC20(_name, _symbol) { _grantRole(ADMIN_ROLE, msg.sender); _grantRole(SENTINEL_ROLE, msg.sender); _grantRole(MINTER_ROLE, msg.sender); _setRoleAdmin(SENTINEL_ROLE, ADMIN_ROLE); _setRoleAdmin(ADMIN_ROLE, ADMIN_ROLE); _setRoleAdmin(MINTER_ROLE, ADMIN_ROLE); setFlashFee(_flashFee); } modifier ensureUnpaused() { Checker.checkState(!paused[msg.sender], "sender is paused to mint"); _; } /// @dev A modifier which checks that the caller has the admin role. modifier onlyAdmin() { require(hasRole(ADMIN_ROLE, msg.sender), "Unauthorized admin"); _; } /// @dev A modifier which checks that the caller has the sentinel role. modifier onlySentinel() { require(hasRole(SENTINEL_ROLE, msg.sender), "Unauthorized sentinel"); _; } /// @dev A modifier which checks if the caller is allowed to min. modifier onlyMinter() { require(hasRole(MINTER_ROLE, msg.sender), "Unauthorized minter"); _; } /// @notice Sets the flash minting fee. /// /// @notice This function reverts if `msg.sender` is not an admin. /// /// @param newFee The new flash mint fee. function setFlashFee(uint256 newFee) public onlyAdmin { Checker.checkArgument(newFee <= BPS, "invalid fee"); flashMintFee = newFee; emit SetFlashMintFee(flashMintFee); } /// @notice Mints tokens to the `recipient.` /// /// @notice This function reverts if `msg.sender` is not allowed to mint. /// @notice This function reverts if `msg.sender` is paused from minting. /// @notice This function reverts if `msg.sender` has exceeded the token's mintable ceiling. /// /// @param recipient The address to mint the tokens to. /// @param amount The amount of tokens to mint. function mint( address recipient, uint256 amount ) external onlyMinter ensureUnpaused { Checker.checkArgument(amount > 0, "zero mint amount"); _mint(recipient, amount); } /// @notice Grants `minter` permission to mint. /// /// @notice This function reverts if `msg.sender` is not an admin. /// /// @param minter The address to permit to mint. /// @param state A flag indicating if the minter should be able to mint. function setAllowedMinter(address minter, bool state) external onlyAdmin { Checker.checkArgument(minter != address(0), "zero minter address"); if (state) { _grantRole(MINTER_ROLE, minter); } else { _revokeRole(MINTER_ROLE, minter); } } /// @notice Sets `sentinel` as a sentinel. /// /// @notice This function reverts if `msg.sender` is not an admin. /// /// @param sentinel The address to set as a sentinel. function setSentinel(address sentinel) external onlyAdmin { _grantRole(SENTINEL_ROLE, sentinel); } /// @notice Pauses `minter` from minting tokens. /// /// @notice This function reverts if `msg.sender` is not a sentinel. /// /// @param minter The address to set as paused or unpaused. /// @param state A flag indicating if the minter should be paused or unpaused. function pauseMinter(address minter, bool state) external onlySentinel { paused[minter] = state; emit Paused(minter, state); } /// @notice Burns `amount` tokens from `msg.sender`. /// /// @param amount The amount of tokens to be burned. function burn(uint256 amount) external { _burn(msg.sender, amount); } /// @dev Destroys `amount` tokens from `account`, deducting from the caller's allowance. /// /// @param account The address the burn tokens from. /// @param amount The address of the tokens that are being burned. function burnFrom(address account, uint256 amount) external { Checker.checkState( allowance(account, msg.sender) >= amount, "insufficient allowance" ); uint256 newAllowance = allowance(account, msg.sender) - amount; _approve(account, msg.sender, newAllowance); _burn(account, amount); } /// @notice Adjusts the maximum flashloan amount. /// /// @param _maxFlashLoanAmount The maximum flashloan amount. function setMaxFlashLoan(uint _maxFlashLoanAmount) external onlyAdmin { maxFlashLoanAmount = _maxFlashLoanAmount; } /// @notice Gets the maximum flash loan amount of a token. /// /// @param token The address of the token. /// /// @return The maximum amount of `token` that can be flashed loaned. function maxFlashLoan( address token ) public view override returns (uint256) { if (token != address(this)) { return 0; } return maxFlashLoanAmount; } /// @notice Gets the fee for a flash loan of `amount` of `token`. /// /// @param token The address of the `token`. /// @param amount The amount of `token` to flash mint. /// /// @return The flash loan fee. function flashFee( address token, uint256 amount ) public view override returns (uint256) { require(token == address(this), "Not a valid flash fee token"); return (amount * flashMintFee) / BPS; } /// @notice Performs a flash mint (called flash loan to confirm with ERC3156 standard). /// /// @param receiver The address which will receive the flash minted tokens. /// @param token The address of the token to flash mint. /// @param amount The amount to flash mint. /// @param data ABI encoded data to pass to the receiver. /// /// @return If the flash loan was successful. function flashLoan( IERC3156FlashBorrower receiver, address token, uint256 amount, bytes calldata data ) external override nonReentrant returns (bool) { Checker.checkArgument(token == address(this), "invalid token address"); Checker.checkArgument( amount <= maxFlashLoan(token), "token amount exceeds max flash loan amount" ); uint256 fee = flashFee(token, amount); if (amount > 0) { _mint(address(receiver), amount); } Checker.checkState( receiver.onFlashLoan(msg.sender, token, amount, fee, data) == CALLBACK_SUCCESS, "flash loan failed" ); _burn(address(receiver), amount + fee); // Will throw error if not enough to burn return true; } uint256[100] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../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 => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ 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 override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(account), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @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 override 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 override 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 override 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 `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @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 Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @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. * * _Available since v3.1._ */ 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 `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == _ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the default value returned by this function, unless * it's overridden. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer(address from, address to, uint256 amount) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _balances[to] += amount; } emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _balances[account] += amount; } emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; // Overflow not possible: amount <= accountBalance <= totalSupply. _totalSupply -= amount; } emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 amount) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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 amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` 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 amount) 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 `amount` 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 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` 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 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @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; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./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); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.17; /// @notice An error used to indicate that an argument passed to a function is illegal or /// inappropriate. /// /// @param message The error message. error IllegalArgumentWithReason(string message); /// @notice An error used to indicate that a function has encountered an unrecoverable state. /// /// @param message The error message. error IllegalStateWithReason(string message); /// @notice An error used to indicate that an operation is unsupported. /// /// @param message The error message. error UnsupportedOperationWithReason(string message); /// @notice An error used to indicate that a message sender tried to execute a privileged function. /// /// @param message The error message. error UnauthorizedWithReason(string message);
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.17; /// @notice An error used to indicate that an action could not be completed because either the `msg.sender` or /// `msg.origin` is not authorized. error Unauthorized(); /// @notice An error used to indicate that an action could not be completed because the contract either already existed /// or entered an illegal condition which is not recoverable from. error IllegalState(); /// @notice An error used to indicate that an action could not be completed because of an illegal argument was passed /// to the function. error IllegalArgument();
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.17; /// @title IERC3156FlashBorrower /// /// @dev Interface of the ERC3156 FlashBorrower, as defined by [ERC-3156](https://eips.ethereum.org/EIPS/eip-3156). interface IERC3156FlashBorrower { /// @notice Receive a flash loan. /// /// @param initiator The initiator of the loan. /// @param token The loan currency. /// @param amount The amount of tokens lent. /// @param fee The additional amount of tokens to repay. /// @param data Arbitrary data structure, intended to contain user-defined parameters. /// /// @return magic The keccak256 hash of "ERC3156FlashBorrower.onFlashLoan" function onFlashLoan( address initiator, address token, uint256 amount, uint256 fee, bytes calldata data ) external returns (bytes32 magic); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.17; import "./IERC3156FlashBorrower.sol"; /// @title IERC3156FlashLender /// /// @dev Interface of the ERC3156 FlashLender, as defined by [ERC-3156](https://eips.ethereum.org/EIPS/eip-3156). interface IERC3156FlashLender { /// @notice The amount of currency available to be lent out. /// /// @param token The loan currency. /// /// @return amount The amount of `token` that can be borrowed. function maxFlashLoan(address token) external view returns (uint256 amount); /// @notice The fee to be charged for a given loan. /// /// @param token The loan currency. /// @param amount The amount of tokens lent. /// /// @return fee The amount of token to be charged for the loan, on top of the returned principal. function flashFee( address token, uint256 amount ) external view returns (uint256 fee); /// @notice Initiate a flash loan. /// /// @param receiver The receiver of the tokens in the loan and the receiver of the callback. /// @param token The loan currency. /// @param amount The amount of tokens lent. /// @param data Arbitrary data structure, intended to contain user-defined parameters. /// /// @return success If the flash loan was successful. function flashLoan( IERC3156FlashBorrower receiver, address token, uint256 amount, bytes calldata data ) external returns (bool success); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.17; import "../base/ErrorMessages.sol"; // a library for validating conditions. library Checker { /// @dev Checks an expression and reverts with an {IllegalArgument} error if the expression is {false}. /// /// @param expression The expression to check. /// @param message The error message to display if the check fails. function checkArgument( bool expression, string memory message ) internal pure { require(expression, message); } /// @dev Checks an expression and reverts with an {IllegalState} error if the expression is {false}. /// /// @param expression The expression to check. /// @param message The error message to display if the check fails. function checkState(bool expression, string memory message) internal pure { require(expression, message); } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint256","name":"_flashFee","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"minter","type":"address"},{"indexed":false,"internalType":"bool","name":"state","type":"bool"}],"name":"Paused","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"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"SetFlashMintFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CALLBACK_SUCCESS","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":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SENTINEL_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"flashFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC3156FlashBorrower","name":"receiver","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"flashLoan","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"flashMintFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"maxFlashLoan","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxFlashLoanAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"minter","type":"address"},{"internalType":"bool","name":"state","type":"bool"}],"name":"pauseMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","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":"address","name":"minter","type":"address"},{"internalType":"bool","name":"state","type":"bool"}],"name":"setAllowedMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newFee","type":"uint256"}],"name":"setFlashFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxFlashLoanAmount","type":"uint256"}],"name":"setMaxFlashLoan","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sentinel","type":"address"}],"name":"setSentinel","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":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b50604051620022a5380380620022a5833981016040819052620000349162000407565b600180558282600562000048838262000508565b50600662000057828262000508565b5050506200007b60008051602062002265833981519152336200013460201b60201c565b62000096600080516020620022858339815191523362000134565b620000b1600080516020620022458339815191523362000134565b620000db6000805160206200228583398151915260008051602062002265833981519152620001d5565b620000f66000805160206200226583398151915280620001d5565b620001206000805160206200224583398151915260008051602062002265833981519152620001d5565b6200012b8162000220565b50505062000609565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620001d1576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001903390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b600082815260208190526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b3360009081527f5cbfc8ee58ca47855df7bcf648dd304ddb6b932f9b87878bdf6318d7ec7ee5b7602052604090205460ff16620002995760405162461bcd60e51b81526020600482015260126024820152712ab730baba3437b934bd32b21030b236b4b760711b60448201526064015b60405180910390fd5b620002d86127108211156040518060400160405280600b81526020016a696e76616c69642066656560a81b8152506200031360201b62000e6b1760201c565b60088190556040518181527f2a870645d0d1cf8866b52d71ff02db01b3e1dc4b70f53e2c4e85dbe60969b92e9060200160405180910390a150565b8082620003355760405162461bcd60e51b8152600401620002909190620005d4565b505050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156200036d57818101518382015260200162000353565b50506000910152565b600082601f8301126200038857600080fd5b81516001600160401b0380821115620003a557620003a56200033a565b604051601f8301601f19908116603f01168101908282118183101715620003d057620003d06200033a565b81604052838152866020858801011115620003ea57600080fd5b620003fd84602083016020890162000350565b9695505050505050565b6000806000606084860312156200041d57600080fd5b83516001600160401b03808211156200043557600080fd5b620004438783880162000376565b945060208601519150808211156200045a57600080fd5b50620004698682870162000376565b925050604084015190509250925092565b600181811c908216806200048f57607f821691505b602082108103620004b057634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200033557600081815260208120601f850160051c81016020861015620004df5750805b601f850160051c820191505b818110156200050057828155600101620004eb565b505050505050565b81516001600160401b038111156200052457620005246200033a565b6200053c816200053584546200047a565b84620004b6565b602080601f8311600181146200057457600084156200055b5750858301515b600019600386901b1c1916600185901b17855562000500565b600085815260208120601f198616915b82811015620005a55788860151825594840194600190910190840162000584565b5085821015620005c45787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6020815260008251806020840152620005f581604085016020870162000350565b601f01601f19169190910160400192915050565b611c2c80620006196000396000f3fe608060405234801561001057600080fd5b50600436106102275760003560e01c80636af9c20511610130578063a140edb4116100b8578063d53913931161007c578063d5391393146104d0578063d547741f146104e5578063d9d98ce4146104f8578063dd62ed3e1461050b578063e68b14ff1461051e57600080fd5b8063a140edb414610486578063a217fddf1461048f578063a457c2d714610497578063a6beee4a146104aa578063a9059cbb146104bd57600080fd5b80638237e538116100ff5780638237e53814610428578063907a267b1461044f57806391d1485414610462578063940a1dc01461047557806395d89b411461047e57600080fd5b80636af9c205146103c457806370a08231146103d757806375b238fc1461040057806379cc67901461041557600080fd5b80632e48152c116101b35780633950935111610182578063395093511461036557806340c10f191461037857806342966c681461038b5780635cffe9de1461039e578063613255ab146103b157600080fd5b80632e48152c1461030d5780632f2ff15d14610330578063313ce5671461034357806336568abe1461035257600080fd5b806313430d92116101fa57806313430d921461029157806318160ddd146102c657806323b872dd146102ce578063248a9ca3146102e1578063249d39e91461030457600080fd5b806301ffc9a71461022c57806306fdde0314610254578063095ea7b31461026957806309dac0611461027c575b600080fd5b61023f61023a36600461171b565b610531565b60405190151581526020015b60405180910390f35b61025c610568565b60405161024b9190611769565b61023f6102773660046117b1565b6105fa565b61028f61028a3660046117dd565b610612565b005b6102b87fd3eedd6d69d410e954f4c622838ecc3acae9fdcd83cad412075c85b09277065681565b60405190815260200161024b565b6004546102b8565b61023f6102dc3660046117fa565b61067c565b6102b86102ef36600461183b565b60009081526020819052604090206001015490565b6102b861271081565b61023f61031b3660046117dd565b60076020526000908152604090205460ff1681565b61028f61033e366004611854565b6106a0565b6040516012815260200161024b565b61028f610360366004611854565b6106ca565b61023f6103733660046117b1565b610748565b61028f6103863660046117b1565b61076a565b61028f61039936600461183b565b61085b565b61023f6103ac366004611884565b610865565b6102b86103bf3660046117dd565b6109f5565b61028f6103d2366004611923565b610a17565b6102b86103e53660046117dd565b6001600160a01b031660009081526002602052604090205490565b6102b8600080516020611bad83398151915281565b61028f6104233660046117b1565b610ac1565b6102b87f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd981565b61028f61045d36600461183b565b610b33565b61023f610470366004611854565b610bd4565b6102b860085481565b61025c610bfd565b6102b860095481565b6102b8600081565b61023f6104a53660046117b1565b610c0c565b61028f6104b836600461183b565b610c87565b61023f6104cb3660046117b1565b610cc0565b6102b8600080516020611b8d83398151915281565b61028f6104f3366004611854565b610cce565b6102b86105063660046117b1565b610cf3565b6102b8610519366004611956565b610d6f565b61028f61052c366004611923565b610d9a565b60006001600160e01b03198216637965db0b60e01b148061056257506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606005805461057790611984565b80601f01602080910402602001604051908101604052809291908181526020018280546105a390611984565b80156105f05780601f106105c5576101008083540402835291602001916105f0565b820191906000526020600020905b8154815290600101906020018083116105d357829003601f168201915b5050505050905090565b600033610608818585610e8a565b5060019392505050565b61062a600080516020611bad83398151915233610bd4565b61064f5760405162461bcd60e51b8152600401610646906119be565b60405180910390fd5b6106797fd3eedd6d69d410e954f4c622838ecc3acae9fdcd83cad412075c85b09277065682610fae565b50565b60003361068a858285611032565b6106958585856110ac565b506001949350505050565b6000828152602081905260409020600101546106bb81611257565b6106c58383610fae565b505050565b6001600160a01b038116331461073a5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610646565b6107448282611261565b5050565b60003361060881858561075b8383610d6f565b6107659190611a00565b610e8a565b610782600080516020611b8d83398151915233610bd4565b6107c45760405162461bcd60e51b81526020600482015260136024820152722ab730baba3437b934bd32b21036b4b73a32b960691b6044820152606401610646565b33600090815260076020908152604091829020548251808401909352601883527f73656e6465722069732070617573656420746f206d696e7400000000000000009183019190915261081c9160ff9091161590610e6b565b610851600082116040518060400160405280601081526020016f1e995c9bc81b5a5b9d08185b5bdd5b9d60821b815250610e6b565b61074482826112c6565b6106793382611387565b600061086f6114bb565b6108ba306001600160a01b0316866001600160a01b03161460405180604001604052806015815260200174696e76616c696420746f6b656e206164647265737360581b815250610e6b565b6108e76108c6866109f5565b8511156040518060600160405280602a8152602001611bcd602a9139610e6b565b60006108f38686610cf3565b905084156109055761090587866112c6565b6109d27f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd9886001600160a01b03166323e30c8b338a8a878b8b6040518763ffffffff1660e01b815260040161095f96959493929190611a13565b6020604051808303816000875af115801561097e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a29190611a6f565b1460405180604001604052806011815260200170199b185cda081b1bd85b8819985a5b1959607a1b815250610e6b565b6109e5876109e08388611a00565b611387565b5050600180805595945050505050565b60006001600160a01b0382163014610a0f57506000919050565b505060095490565b610a2f600080516020611bad83398151915233610bd4565b610a4b5760405162461bcd60e51b8152600401610646906119be565b6040805180820190915260138152727a65726f206d696e746572206164647265737360681b6020820152610a8b906001600160a01b038416151590610e6b565b8015610aa957610744600080516020611b8d83398151915283610fae565b610744600080516020611b8d83398151915283611261565b610b0581610acf8433610d6f565b101560405180604001604052806016815260200175696e73756666696369656e7420616c6c6f77616e636560501b815250610e6b565b600081610b128433610d6f565b610b1c9190611a88565b9050610b29833383610e8a565b6106c58383611387565b610b4b600080516020611bad83398151915233610bd4565b610b675760405162461bcd60e51b8152600401610646906119be565b610b996127108211156040518060400160405280600b81526020016a696e76616c69642066656560a81b815250610e6b565b60088190556040518181527f2a870645d0d1cf8866b52d71ff02db01b3e1dc4b70f53e2c4e85dbe60969b92e9060200160405180910390a150565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b60606006805461057790611984565b60003381610c1a8286610d6f565b905083811015610c7a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610646565b6106958286868403610e8a565b610c9f600080516020611bad83398151915233610bd4565b610cbb5760405162461bcd60e51b8152600401610646906119be565b600955565b6000336106088185856110ac565b600082815260208190526040902060010154610ce981611257565b6106c58383611261565b60006001600160a01b0383163014610d4d5760405162461bcd60e51b815260206004820152601b60248201527f4e6f7420612076616c696420666c6173682066656520746f6b656e00000000006044820152606401610646565b61271060085483610d5e9190611a9b565b610d689190611ab2565b9392505050565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b610dc47fd3eedd6d69d410e954f4c622838ecc3acae9fdcd83cad412075c85b09277065633610bd4565b610e085760405162461bcd60e51b8152602060048201526015602482015274155b985d5d1a1bdc9a5e9959081cd95b9d1a5b995b605a1b6044820152606401610646565b6001600160a01b038216600081815260076020908152604091829020805460ff19168515159081179091558251938452908301527fe8699cf681560fd07de85543bd994263f4557bdc5179dd702f256d15fd083e1d910160405180910390a15050565b80826106c55760405162461bcd60e51b81526004016106469190611769565b6001600160a01b038316610eec5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610646565b6001600160a01b038216610f4d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610646565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b610fb88282610bd4565b610744576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610fee3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600061103e8484610d6f565b905060001981146110a657818110156110995760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610646565b6110a68484848403610e8a565b50505050565b6001600160a01b0383166111105760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610646565b6001600160a01b0382166111725760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610646565b6001600160a01b038316600090815260026020526040902054818110156111ea5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610646565b6001600160a01b0380851660008181526002602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061124a9086815260200190565b60405180910390a36110a6565b6106798133611514565b61126b8282610bd4565b15610744576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001600160a01b03821661131c5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610646565b806004600082825461132e9190611a00565b90915550506001600160a01b0382166000818152600260209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6001600160a01b0382166113e75760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610646565b6001600160a01b0382166000908152600260205260409020548181101561145b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610646565b6001600160a01b03831660008181526002602090815260408083208686039055600480548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b60026001540361150d5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610646565b6002600155565b61151e8282610bd4565b6107445761152b8161156d565b61153683602061157f565b604051602001611547929190611ad4565b60408051601f198184030181529082905262461bcd60e51b825261064691600401611769565b60606105626001600160a01b03831660145b6060600061158e836002611a9b565b611599906002611a00565b67ffffffffffffffff8111156115b1576115b1611b49565b6040519080825280601f01601f1916602001820160405280156115db576020820181803683370190505b509050600360fc1b816000815181106115f6576115f6611b5f565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061162557611625611b5f565b60200101906001600160f81b031916908160001a9053506000611649846002611a9b565b611654906001611a00565b90505b60018111156116cc576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061168857611688611b5f565b1a60f81b82828151811061169e5761169e611b5f565b60200101906001600160f81b031916908160001a90535060049490941c936116c581611b75565b9050611657565b508315610d685760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610646565b60006020828403121561172d57600080fd5b81356001600160e01b031981168114610d6857600080fd5b60005b83811015611760578181015183820152602001611748565b50506000910152565b6020815260008251806020840152611788816040850160208701611745565b601f01601f19169190910160400192915050565b6001600160a01b038116811461067957600080fd5b600080604083850312156117c457600080fd5b82356117cf8161179c565b946020939093013593505050565b6000602082840312156117ef57600080fd5b8135610d688161179c565b60008060006060848603121561180f57600080fd5b833561181a8161179c565b9250602084013561182a8161179c565b929592945050506040919091013590565b60006020828403121561184d57600080fd5b5035919050565b6000806040838503121561186757600080fd5b8235915060208301356118798161179c565b809150509250929050565b60008060008060006080868803121561189c57600080fd5b85356118a78161179c565b945060208601356118b78161179c565b935060408601359250606086013567ffffffffffffffff808211156118db57600080fd5b818801915088601f8301126118ef57600080fd5b8135818111156118fe57600080fd5b89602082850101111561191057600080fd5b9699959850939650602001949392505050565b6000806040838503121561193657600080fd5b82356119418161179c565b91506020830135801515811461187957600080fd5b6000806040838503121561196957600080fd5b82356119748161179c565b915060208301356118798161179c565b600181811c9082168061199857607f821691505b6020821081036119b857634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252601290820152712ab730baba3437b934bd32b21030b236b4b760711b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610562576105626119ea565b6001600160a01b03878116825286166020820152604081018590526060810184905260a06080820181905281018290526000828460c0840137600060c0848401015260c0601f19601f8501168301019050979650505050505050565b600060208284031215611a8157600080fd5b5051919050565b81810381811115610562576105626119ea565b8082028115828204841417610562576105626119ea565b600082611acf57634e487b7160e01b600052601260045260246000fd5b500490565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611b0c816017850160208801611745565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611b3d816028840160208801611745565b01602801949350505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600081611b8457611b846119ea565b50600019019056fef0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc9df8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec42746f6b656e20616d6f756e742065786365656473206d617820666c617368206c6f616e20616d6f756e74a2646970667358221220744e5bedaf1520fe78f0cd3219a2cb442a71175205b9711073293263c5ff527364736f6c63430008110033f0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc9df8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec42d3eedd6d69d410e954f4c622838ecc3acae9fdcd83cad412075c85b092770656000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009536176767920555344000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000057376555344000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102275760003560e01c80636af9c20511610130578063a140edb4116100b8578063d53913931161007c578063d5391393146104d0578063d547741f146104e5578063d9d98ce4146104f8578063dd62ed3e1461050b578063e68b14ff1461051e57600080fd5b8063a140edb414610486578063a217fddf1461048f578063a457c2d714610497578063a6beee4a146104aa578063a9059cbb146104bd57600080fd5b80638237e538116100ff5780638237e53814610428578063907a267b1461044f57806391d1485414610462578063940a1dc01461047557806395d89b411461047e57600080fd5b80636af9c205146103c457806370a08231146103d757806375b238fc1461040057806379cc67901461041557600080fd5b80632e48152c116101b35780633950935111610182578063395093511461036557806340c10f191461037857806342966c681461038b5780635cffe9de1461039e578063613255ab146103b157600080fd5b80632e48152c1461030d5780632f2ff15d14610330578063313ce5671461034357806336568abe1461035257600080fd5b806313430d92116101fa57806313430d921461029157806318160ddd146102c657806323b872dd146102ce578063248a9ca3146102e1578063249d39e91461030457600080fd5b806301ffc9a71461022c57806306fdde0314610254578063095ea7b31461026957806309dac0611461027c575b600080fd5b61023f61023a36600461171b565b610531565b60405190151581526020015b60405180910390f35b61025c610568565b60405161024b9190611769565b61023f6102773660046117b1565b6105fa565b61028f61028a3660046117dd565b610612565b005b6102b87fd3eedd6d69d410e954f4c622838ecc3acae9fdcd83cad412075c85b09277065681565b60405190815260200161024b565b6004546102b8565b61023f6102dc3660046117fa565b61067c565b6102b86102ef36600461183b565b60009081526020819052604090206001015490565b6102b861271081565b61023f61031b3660046117dd565b60076020526000908152604090205460ff1681565b61028f61033e366004611854565b6106a0565b6040516012815260200161024b565b61028f610360366004611854565b6106ca565b61023f6103733660046117b1565b610748565b61028f6103863660046117b1565b61076a565b61028f61039936600461183b565b61085b565b61023f6103ac366004611884565b610865565b6102b86103bf3660046117dd565b6109f5565b61028f6103d2366004611923565b610a17565b6102b86103e53660046117dd565b6001600160a01b031660009081526002602052604090205490565b6102b8600080516020611bad83398151915281565b61028f6104233660046117b1565b610ac1565b6102b87f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd981565b61028f61045d36600461183b565b610b33565b61023f610470366004611854565b610bd4565b6102b860085481565b61025c610bfd565b6102b860095481565b6102b8600081565b61023f6104a53660046117b1565b610c0c565b61028f6104b836600461183b565b610c87565b61023f6104cb3660046117b1565b610cc0565b6102b8600080516020611b8d83398151915281565b61028f6104f3366004611854565b610cce565b6102b86105063660046117b1565b610cf3565b6102b8610519366004611956565b610d6f565b61028f61052c366004611923565b610d9a565b60006001600160e01b03198216637965db0b60e01b148061056257506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606005805461057790611984565b80601f01602080910402602001604051908101604052809291908181526020018280546105a390611984565b80156105f05780601f106105c5576101008083540402835291602001916105f0565b820191906000526020600020905b8154815290600101906020018083116105d357829003601f168201915b5050505050905090565b600033610608818585610e8a565b5060019392505050565b61062a600080516020611bad83398151915233610bd4565b61064f5760405162461bcd60e51b8152600401610646906119be565b60405180910390fd5b6106797fd3eedd6d69d410e954f4c622838ecc3acae9fdcd83cad412075c85b09277065682610fae565b50565b60003361068a858285611032565b6106958585856110ac565b506001949350505050565b6000828152602081905260409020600101546106bb81611257565b6106c58383610fae565b505050565b6001600160a01b038116331461073a5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610646565b6107448282611261565b5050565b60003361060881858561075b8383610d6f565b6107659190611a00565b610e8a565b610782600080516020611b8d83398151915233610bd4565b6107c45760405162461bcd60e51b81526020600482015260136024820152722ab730baba3437b934bd32b21036b4b73a32b960691b6044820152606401610646565b33600090815260076020908152604091829020548251808401909352601883527f73656e6465722069732070617573656420746f206d696e7400000000000000009183019190915261081c9160ff9091161590610e6b565b610851600082116040518060400160405280601081526020016f1e995c9bc81b5a5b9d08185b5bdd5b9d60821b815250610e6b565b61074482826112c6565b6106793382611387565b600061086f6114bb565b6108ba306001600160a01b0316866001600160a01b03161460405180604001604052806015815260200174696e76616c696420746f6b656e206164647265737360581b815250610e6b565b6108e76108c6866109f5565b8511156040518060600160405280602a8152602001611bcd602a9139610e6b565b60006108f38686610cf3565b905084156109055761090587866112c6565b6109d27f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd9886001600160a01b03166323e30c8b338a8a878b8b6040518763ffffffff1660e01b815260040161095f96959493929190611a13565b6020604051808303816000875af115801561097e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a29190611a6f565b1460405180604001604052806011815260200170199b185cda081b1bd85b8819985a5b1959607a1b815250610e6b565b6109e5876109e08388611a00565b611387565b5050600180805595945050505050565b60006001600160a01b0382163014610a0f57506000919050565b505060095490565b610a2f600080516020611bad83398151915233610bd4565b610a4b5760405162461bcd60e51b8152600401610646906119be565b6040805180820190915260138152727a65726f206d696e746572206164647265737360681b6020820152610a8b906001600160a01b038416151590610e6b565b8015610aa957610744600080516020611b8d83398151915283610fae565b610744600080516020611b8d83398151915283611261565b610b0581610acf8433610d6f565b101560405180604001604052806016815260200175696e73756666696369656e7420616c6c6f77616e636560501b815250610e6b565b600081610b128433610d6f565b610b1c9190611a88565b9050610b29833383610e8a565b6106c58383611387565b610b4b600080516020611bad83398151915233610bd4565b610b675760405162461bcd60e51b8152600401610646906119be565b610b996127108211156040518060400160405280600b81526020016a696e76616c69642066656560a81b815250610e6b565b60088190556040518181527f2a870645d0d1cf8866b52d71ff02db01b3e1dc4b70f53e2c4e85dbe60969b92e9060200160405180910390a150565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b60606006805461057790611984565b60003381610c1a8286610d6f565b905083811015610c7a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610646565b6106958286868403610e8a565b610c9f600080516020611bad83398151915233610bd4565b610cbb5760405162461bcd60e51b8152600401610646906119be565b600955565b6000336106088185856110ac565b600082815260208190526040902060010154610ce981611257565b6106c58383611261565b60006001600160a01b0383163014610d4d5760405162461bcd60e51b815260206004820152601b60248201527f4e6f7420612076616c696420666c6173682066656520746f6b656e00000000006044820152606401610646565b61271060085483610d5e9190611a9b565b610d689190611ab2565b9392505050565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b610dc47fd3eedd6d69d410e954f4c622838ecc3acae9fdcd83cad412075c85b09277065633610bd4565b610e085760405162461bcd60e51b8152602060048201526015602482015274155b985d5d1a1bdc9a5e9959081cd95b9d1a5b995b605a1b6044820152606401610646565b6001600160a01b038216600081815260076020908152604091829020805460ff19168515159081179091558251938452908301527fe8699cf681560fd07de85543bd994263f4557bdc5179dd702f256d15fd083e1d910160405180910390a15050565b80826106c55760405162461bcd60e51b81526004016106469190611769565b6001600160a01b038316610eec5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610646565b6001600160a01b038216610f4d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610646565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b610fb88282610bd4565b610744576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610fee3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600061103e8484610d6f565b905060001981146110a657818110156110995760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610646565b6110a68484848403610e8a565b50505050565b6001600160a01b0383166111105760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610646565b6001600160a01b0382166111725760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610646565b6001600160a01b038316600090815260026020526040902054818110156111ea5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610646565b6001600160a01b0380851660008181526002602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061124a9086815260200190565b60405180910390a36110a6565b6106798133611514565b61126b8282610bd4565b15610744576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001600160a01b03821661131c5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610646565b806004600082825461132e9190611a00565b90915550506001600160a01b0382166000818152600260209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6001600160a01b0382166113e75760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610646565b6001600160a01b0382166000908152600260205260409020548181101561145b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610646565b6001600160a01b03831660008181526002602090815260408083208686039055600480548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b60026001540361150d5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610646565b6002600155565b61151e8282610bd4565b6107445761152b8161156d565b61153683602061157f565b604051602001611547929190611ad4565b60408051601f198184030181529082905262461bcd60e51b825261064691600401611769565b60606105626001600160a01b03831660145b6060600061158e836002611a9b565b611599906002611a00565b67ffffffffffffffff8111156115b1576115b1611b49565b6040519080825280601f01601f1916602001820160405280156115db576020820181803683370190505b509050600360fc1b816000815181106115f6576115f6611b5f565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061162557611625611b5f565b60200101906001600160f81b031916908160001a9053506000611649846002611a9b565b611654906001611a00565b90505b60018111156116cc576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061168857611688611b5f565b1a60f81b82828151811061169e5761169e611b5f565b60200101906001600160f81b031916908160001a90535060049490941c936116c581611b75565b9050611657565b508315610d685760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610646565b60006020828403121561172d57600080fd5b81356001600160e01b031981168114610d6857600080fd5b60005b83811015611760578181015183820152602001611748565b50506000910152565b6020815260008251806020840152611788816040850160208701611745565b601f01601f19169190910160400192915050565b6001600160a01b038116811461067957600080fd5b600080604083850312156117c457600080fd5b82356117cf8161179c565b946020939093013593505050565b6000602082840312156117ef57600080fd5b8135610d688161179c565b60008060006060848603121561180f57600080fd5b833561181a8161179c565b9250602084013561182a8161179c565b929592945050506040919091013590565b60006020828403121561184d57600080fd5b5035919050565b6000806040838503121561186757600080fd5b8235915060208301356118798161179c565b809150509250929050565b60008060008060006080868803121561189c57600080fd5b85356118a78161179c565b945060208601356118b78161179c565b935060408601359250606086013567ffffffffffffffff808211156118db57600080fd5b818801915088601f8301126118ef57600080fd5b8135818111156118fe57600080fd5b89602082850101111561191057600080fd5b9699959850939650602001949392505050565b6000806040838503121561193657600080fd5b82356119418161179c565b91506020830135801515811461187957600080fd5b6000806040838503121561196957600080fd5b82356119748161179c565b915060208301356118798161179c565b600181811c9082168061199857607f821691505b6020821081036119b857634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252601290820152712ab730baba3437b934bd32b21030b236b4b760711b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610562576105626119ea565b6001600160a01b03878116825286166020820152604081018590526060810184905260a06080820181905281018290526000828460c0840137600060c0848401015260c0601f19601f8501168301019050979650505050505050565b600060208284031215611a8157600080fd5b5051919050565b81810381811115610562576105626119ea565b8082028115828204841417610562576105626119ea565b600082611acf57634e487b7160e01b600052601260045260246000fd5b500490565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611b0c816017850160208801611745565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611b3d816028840160208801611745565b01602801949350505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600081611b8457611b846119ea565b50600019019056fef0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc9df8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec42746f6b656e20616d6f756e742065786365656473206d617820666c617368206c6f616e20616d6f756e74a2646970667358221220744e5bedaf1520fe78f0cd3219a2cb442a71175205b9711073293263c5ff527364736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009536176767920555344000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000057376555344000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _name (string): Savvy USD
Arg [1] : _symbol (string): svUSD
Arg [2] : _flashFee (uint256): 0
-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000009
Arg [4] : 5361767679205553440000000000000000000000000000000000000000000000
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [6] : 7376555344000000000000000000000000000000000000000000000000000000
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.