Overview
S Balance
S Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
Contract Name:
Gateway
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT // This gateway is for all destination chains with the newly deployed mintable-burnable Symemeio // on the original chain (BASE), we use a different gateway contract, see ... SourceGateway.sol !!FIXME!! ? pragma solidity ^0.8.20; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol"; import "@openzeppelin/contracts/utils/Pausable.sol"; import "./Symemeio.sol"; /// @title Gateway /// @notice This contract allows users to swap mb tokens to native tokens and vice versa. contract Gateway is ReentrancyGuard, AccessControlEnumerable, Pausable { using SafeERC20 for IERC20; bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE"); bytes32 public constant FEE_ROLE = keccak256("FEE_ROLE"); bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); bytes32 public constant UNPAUSER_ROLE = keccak256("UNPAUSER_ROLE"); address public nativeToken; address public mbToken; uint256 public periodLength; // defines the period length uint256 public periodStart; // indicates the beginning of the period uint256 public periodMaxAmount; // how many tokens are convertible per period uint256 public periodMintedAmount; // counter: counts the numnber of native tokens minted in this period /** * @notice % fee that will be burnt ( less native tokens are received than mbtokens ) * It's used along with burnFeeScale to determine the fee amount that will be burnt */ uint32 public burnFee; /** * @notice scale number to scale burnFee in decimals * burnFee = 2 and burnFeescale = 100 leads to burn 2/100 of swap amount; * burnFee = 1 and burnFeescale = 50 also leads to burn 2/100 of swap amount; */ uint32 public burnFeeScale; /** * @notice % fee that will be tranferred to the treasury ( less native tokens are received than mbtokens ) * It's used along with treasuryFeeScale to determine the fee amount that will be transferred to the treasury */ uint32 public treasuryFee; /** * @notice scale number to scale treasuryFee in decimals * treasuryFee = 2 and treasuryFeeScale = 100 leads to transfer 2/100 of swap amount to the treasury; * treasuryFee = 1 and treasuryFeeScale = 50 also leads to transfer 2/100 of swap amount to the treasury; */ uint32 public treasuryFeeScale; address public feeTreasury; // The address of treasury that fees will be transferred to /// @notice Event to log the successful token swap. /// @param from The address that initiated the swap. /// @param to The address that received the swapped tokens. /// @param fromToken The address of the token that was swapped. /// @param toToken The address of the token that was received. /// @param amount The amount of tokens swapped. event TokenSwapped( address indexed from, address to, address indexed fromToken, address indexed toToken, uint256 amount ); /// @notice Constructs a new Gateway contract. constructor(address _admin, address _nativeToken, address _mbToken) { require( _admin != address(0), "Gateway: ADMIN_ADDRESS_MUST_BE_NON-ZERO" ); _grantRole(DEFAULT_ADMIN_ROLE, _admin); _grantRole(ADMIN_ROLE, _admin); _grantRole(FEE_ROLE, _admin); periodStart = block.timestamp; nativeToken = _nativeToken; mbToken = _mbToken; burnFeeScale = 100; treasuryFeeScale = 100; } /// @notice Swaps a specified amount of mb tokens to native tokens. /// @param amount The amount of mb tokens to swap. function swapToNative(uint256 amount) external nonReentrant whenNotPaused { _swap(amount, msg.sender); } /// @notice Swaps a specified amount of mb tokens to native tokens. /// @param amount The amount of mb tokens to swap. /// @param to The recipient address of the native tokens. function swapToNativeTo( uint256 amount, address to ) external nonReentrant whenNotPaused { _swap(amount, to); } /// @notice Pauses the contract. function pause() external onlyRole(PAUSER_ROLE) { _pause(); } /// @notice Unpauses the contract. function unpause() external onlyRole(UNPAUSER_ROLE) { _unpause(); } /** * * @param _periodLength Length of the period in seconds * @param _maxAmount Max swappable amount in the period */ function setLimits( uint256 _periodLength, uint256 _maxAmount ) external onlyRole(ADMIN_ROLE) { periodLength = _periodLength; periodMaxAmount = _maxAmount; } /** * * @param _fee The numerator of the fee fraction fee/scale * @param _scale The denominator of the fee fraction fee/scale * @notice Fee amount could have each value with the specified fee and scale * e.g. fee 5 and scale 1000 leads to the burn fee 0.5% */ function setBurnFee( uint32 _fee, uint32 _scale ) external onlyRole(FEE_ROLE) { burnFee = _fee; burnFeeScale = _scale; } /** * * @param _fee The numerator of the fee fraction fee/scale * @param _scale The denominator of the fee fraction fee/scale * @notice Fee amount could have each value with the specified fee and scale * e.g. fee 5 and scale 1000 leads to treasury fee 0.5% */ function setTreasuryFee( uint32 _fee, uint32 _scale ) external onlyRole(FEE_ROLE) { require(feeTreasury != address(0), "fee treasury is not set"); treasuryFee = _fee; treasuryFeeScale = _scale; } /** * * @param _treasury the address of treasury that fees will be transferred to */ function setFeeTreasuryAddress( address _treasury ) external onlyRole(FEE_ROLE) { feeTreasury = _treasury; } /** * * @param amount Amount to be withdrawn * @param _to Destination address * @param _tokenAddr Address of tokens to be withdrawn. Use address(0) for ether * @dev adminWithdraw is typically multi-sig roled, it enables admin to withdraw any amount of * either mbToken, native token, or ethers * this function is mainly useful if a bridge tech is hacked or halted, * and a new solution will be deployed with metabridge * (then this gateway is "killed" and replaced with another one; * the native tokens must then be withdrawn) * note that if the gateway is paused, admins can still withdraw */ function adminWithdraw( uint256 amount, address _to, address _tokenAddr ) external onlyRole(ADMIN_ROLE) { require(_to != address(0)); if (_tokenAddr == address(0)) { payable(_to).transfer(amount); } else { IERC20(_tokenAddr).safeTransfer(_to, amount); } } /** * @dev this is the specific implemntation for Symemeio * @return The maximum swapable amount (given per period limits -- taking max supply of native token on the chain ) */ function swappableAmount() public view returns (uint256) { uint256 supply = Symemeio(nativeToken).maxSupply() - Symemeio(nativeToken).totalSupply(); if (periodLength > 0) { uint256 result; // if the period has not ended yet if (block.timestamp - periodStart <= periodLength) { result = periodMaxAmount - periodMintedAmount; } else { result = periodMaxAmount; } if (supply >= result) { return result; } } return supply; } /// @dev Internal function to handle the token swap. /// @param amount_ The amount of tokens to swap. /// @param to_ The recipient address of the swapped tokens. function _swap(uint256 amount_, address to_) internal { require(amount_ > 0, "Gateway: AMOUNT_MUST_BE_GREATER_THAN_0"); require( to_ != address(0), "Gateway: RECIPIENT_ADDRESS_MUST_BE_NON-ZERO" ); uint256 mbBalance = IERC20(mbToken).balanceOf(address(this)); IERC20(mbToken).safeTransferFrom(msg.sender, address(this), amount_); uint256 receivedAmount = IERC20(mbToken).balanceOf(address(this)) - mbBalance; require(amount_ == receivedAmount, "Gateway: INVALID_RECEIVED_AMOUNT"); uint256 maxSwappableAmount = swappableAmount(); // the number of native tokens minted are equal to the number of mbTokens bridged (and received by the gateway) minus the ( burn fee + treasury fee ) uint256 burnFeeAmount = _getBurnFeeAmount(amount_); uint256 treasuryFeeAmount = _getTreasuryFeeAmount(amount_); uint256 netAmount = amount_ - (burnFeeAmount + treasuryFeeAmount); // all mbTokens swapped are burned, while the net (after fee) amount of native tokens are minted to the user wallet // if the net amount is greater than swappable amount, // it will swap as much as swappable amount and calculate the new net amount, // then it will transfer the remaining mbTokens (amount - swappable amount) to the user if (netAmount <= maxSwappableAmount) { ERC20Burnable(mbToken).burn(amount_); } else { /** * @dev override fee amounts and net amount based on the max swappable amount */ burnFeeAmount = _getBurnFeeAmount(maxSwappableAmount); treasuryFeeAmount = _getTreasuryFeeAmount(maxSwappableAmount); netAmount = maxSwappableAmount - (burnFeeAmount + treasuryFeeAmount); ERC20Burnable(mbToken).burn(maxSwappableAmount); // Transfer the remaining amount of mbTokens that cannot be swapped to the user IERC20(mbToken).safeTransfer(to_, amount_ - maxSwappableAmount); } // Mint native tokens (treasury fee) to the treasury address if (treasuryFeeAmount != 0) { Symemeio(nativeToken).mint(feeTreasury, treasuryFeeAmount); } // Mint native tokens to the user address Symemeio(nativeToken).mint(to_, netAmount); _checkLimits(netAmount); emit TokenSwapped(msg.sender, to_, mbToken, nativeToken, amount_); } /** * * @param swapAmount the amount of swap * @dev calculate the fee amount that should be burnt */ function _getBurnFeeAmount( uint256 swapAmount ) internal view returns (uint256) { return (swapAmount * burnFee) / burnFeeScale; } /** * * @param swapAmount the amount of swap * @dev calculate the fee amount that should be transferred */ function _getTreasuryFeeAmount( uint256 swapAmount ) internal view returns (uint256) { return (swapAmount * treasuryFee) / treasuryFeeScale; } /** * * @param amount swap amount * @dev It makes sure that defined limitations are met. The limitations are not applied to the admin */ function _checkLimits(uint256 amount) internal { if (!hasRole(ADMIN_ROLE, msg.sender)) { if (block.timestamp - periodStart <= periodLength) { periodMintedAmount += amount; require( periodMintedAmount <= periodMaxAmount, "Period threshold is exceeded" ); } else { periodStart = block.timestamp; periodMintedAmount = amount; } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol) pragma solidity ^0.8.20; import {IAccessControl} from "./IAccessControl.sol"; import {Context} from "../utils/Context.sol"; import {ERC165} from "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ```solidity * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ```solidity * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address account => bool) hasRole; bytes32 adminRole; } mapping(bytes32 role => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with an {AccessControlUnauthorizedAccount} error including the required role. */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual returns (bool) { return _roles[role].hasRole[account]; } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()` * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier. */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account` * is missing `role`. */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert AccessControlUnauthorizedAccount(account, role); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address callerConfirmation) public virtual { if (callerConfirmation != _msgSender()) { revert AccessControlBadConfirmation(); } _revokeRole(role, callerConfirmation); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual returns (bool) { if (!hasRole(role, account)) { _roles[role].hasRole[account] = true; emit RoleGranted(role, account, _msgSender()); return true; } else { return false; } } /** * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual returns (bool) { if (hasRole(role, account)) { _roles[role].hasRole[account] = false; emit RoleRevoked(role, account, _msgSender()); return true; } else { return false; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol) pragma solidity ^0.8.20; import {IAccessControlEnumerable} from "./IAccessControlEnumerable.sol"; import {AccessControl} from "../AccessControl.sol"; import {EnumerableSet} from "../../utils/structs/EnumerableSet.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl { using EnumerableSet for EnumerableSet.AddressSet; mapping(bytes32 role => EnumerableSet.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {AccessControl-_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override returns (bool) { bool granted = super._grantRole(role, account); if (granted) { _roleMembers[role].add(account); } return granted; } /** * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) { bool revoked = super._revokeRole(role, account); if (revoked) { _roleMembers[role].remove(account); } return revoked; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol) pragma solidity ^0.8.20; import {IAccessControl} from "../IAccessControl.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerable is IAccessControl { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol) pragma solidity ^0.8.20; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev The `account` is missing a role. */ error AccessControlUnauthorizedAccount(address account, bytes32 neededRole); /** * @dev The caller of a function is not the expected one. * * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}. */ error AccessControlBadConfirmation(); /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. */ function renounceRole(bytes32 role, address callerConfirmation) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol) pragma solidity ^0.8.20; /** * @dev Standard ERC20 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens. */ interface IERC20Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC20InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC20InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers. * @param spender Address that may be allowed to operate on tokens without being their owner. * @param allowance Amount of tokens a `spender` is allowed to operate with. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC20InvalidApprover(address approver); /** * @dev Indicates a failure with the `spender` to be approved. Used in approvals. * @param spender Address that may be allowed to operate on tokens without being their owner. */ error ERC20InvalidSpender(address spender); } /** * @dev Standard ERC721 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens. */ interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20. * Used in balance queries. * @param owner Address of the current owner of a token. */ error ERC721InvalidOwner(address owner); /** * @dev Indicates a `tokenId` whose `owner` is the zero address. * @param tokenId Identifier number of a token. */ error ERC721NonexistentToken(uint256 tokenId); /** * @dev Indicates an error related to the ownership over a particular token. Used in transfers. * @param sender Address whose tokens are being transferred. * @param tokenId Identifier number of a token. * @param owner Address of the current owner of a token. */ error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC721InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC721InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param tokenId Identifier number of a token. */ error ERC721InsufficientApproval(address operator, uint256 tokenId); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC721InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC721InvalidOperator(address operator); } /** * @dev Standard ERC1155 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens. */ interface IERC1155Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. * @param tokenId Identifier number of a token. */ error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC1155InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC1155InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param owner Address of the current owner of a token. */ error ERC1155MissingApprovalForAll(address operator, address owner); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC1155InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC1155InvalidOperator(address operator); /** * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. * Used in batch transfers. * @param idsLength Length of the array of token identifiers * @param valuesLength Length of the array of token amounts */ error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "./IERC20.sol"; import {IERC20Metadata} from "./extensions/IERC20Metadata.sol"; import {Context} from "../../utils/Context.sol"; import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of 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. */ abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors { mapping(address account => uint256) private _balances; mapping(address account => mapping(address spender => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * 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 returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the default value returned by this function, unless * it's overridden. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `value`. */ function transfer(address to, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _transfer(owner, to, value); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, value); return true; } /** * @dev See {IERC20-transferFrom}. * * 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 `value`. * - the caller must have allowance for ``from``'s tokens of at least * `value`. */ function transferFrom(address from, address to, uint256 value) public virtual returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, value); _transfer(from, to, value); return true; } /** * @dev Moves a `value` amount of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _transfer(address from, address to, uint256 value) internal { if (from == address(0)) { revert ERC20InvalidSender(address(0)); } if (to == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(from, to, value); } /** * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from` * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding * this function. * * Emits a {Transfer} event. */ function _update(address from, address to, uint256 value) internal virtual { if (from == address(0)) { // Overflow check required: The rest of the code assumes that totalSupply never overflows _totalSupply += value; } else { uint256 fromBalance = _balances[from]; if (fromBalance < value) { revert ERC20InsufficientBalance(from, fromBalance, value); } unchecked { // Overflow not possible: value <= fromBalance <= totalSupply. _balances[from] = fromBalance - value; } } if (to == address(0)) { unchecked { // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply. _totalSupply -= value; } } else { unchecked { // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256. _balances[to] += value; } } emit Transfer(from, to, value); } /** * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0). * Relies on the `_update` mechanism * * Emits a {Transfer} event with `from` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _mint(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(address(0), account, value); } /** * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply. * Relies on the `_update` mechanism. * * Emits a {Transfer} event with `to` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead */ function _burn(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidSender(address(0)); } _update(account, address(0), value); } /** * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. * * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. */ function _approve(address owner, address spender, uint256 value) internal { _approve(owner, spender, value, true); } /** * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event. * * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any * `Approval` event during `transferFrom` operations. * * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to * true using the following override: * ``` * function _approve(address owner, address spender, uint256 value, bool) internal virtual override { * super._approve(owner, spender, value, true); * } * ``` * * Requirements are the same as {_approve}. */ function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual { if (owner == address(0)) { revert ERC20InvalidApprover(address(0)); } if (spender == address(0)) { revert ERC20InvalidSpender(address(0)); } _allowances[owner][spender] = value; if (emitEvent) { emit Approval(owner, spender, value); } } /** * @dev Updates `owner` s allowance for `spender` based on spent `value`. * * Does not update the allowance value in case of infinite allowance. * Revert if not enough allowance is available. * * Does not emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 value) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { if (currentAllowance < value) { revert ERC20InsufficientAllowance(spender, currentAllowance, value); } unchecked { _approve(owner, spender, currentAllowance - value, false); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/ERC20Burnable.sol) pragma solidity ^0.8.20; import {ERC20} from "../ERC20.sol"; import {Context} from "../../../utils/Context.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys a `value` amount of tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 value) public virtual { _burn(_msgSender(), value); } /** * @dev Destroys a `value` amount of tokens from `account`, deducting from * the caller's allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `value`. */ function burnFrom(address account, uint256 value) public virtual { _spendAllowance(account, _msgSender(), value); _burn(account, value); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @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 value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC20Permit} from "../extensions/IERC20Permit.sol"; import {Address} from "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev An operation with an ERC20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value))); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value))); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol) pragma solidity ^0.8.20; import {Context} from "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { bool private _paused; /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); /** * @dev The operation failed because the contract is paused. */ error EnforcedPause(); /** * @dev The operation failed because the contract is not paused. */ error ExpectedPause(); /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { if (paused()) { revert EnforcedPause(); } } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { if (!paused()) { revert ExpectedPause(); } } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; /** * @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; /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); 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 if (_status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // 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 v5.0.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.20; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ```solidity * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position is the index of the value in the `values` array plus 1. // Position 0 is used to mean a value is not in the set. mapping(bytes32 value => uint256) _positions; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._positions[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We cache the value's position to prevent multiple reads from the same storage slot uint256 position = set._positions[value]; if (position != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 valueIndex = position - 1; uint256 lastIndex = set._values.length - 1; if (valueIndex != lastIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the lastValue to the index where the value to delete is set._values[valueIndex] = lastValue; // Update the tracked position of the lastValue (that was just moved) set._positions[lastValue] = position; } // Delete the slot where the moved value was stored set._values.pop(); // Delete the tracked position for the deleted slot delete set._positions[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._positions[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // This token is the newly deployed token on all destination chains —— the original token was deployed on Base and is not mintable-burnable pragma solidity ^0.8.20; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; contract Symemeio is ERC20Burnable, AccessControl { uint256 public maxSupply; bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE"); bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); /** * @dev MaxSupply has been exceeded. */ error MaxSupplyExceeded(uint256 increasedSupply, uint256 maxSupply); constructor( uint256 _maxSupply, string memory _name, string memory _symbol ) ERC20(_name, _symbol) { _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); _grantRole(ADMIN_ROLE, msg.sender); maxSupply = _maxSupply; } function mint(address to, uint256 amount) external onlyRole(MINTER_ROLE) { _mint(to, amount); } function setMaxSupply(uint256 _maxSupply) external onlyRole(ADMIN_ROLE) { maxSupply = _maxSupply; } /** * @dev See {ERC20-_update}. */ function _update( address from, address to, uint256 value ) internal virtual override { super._update(from, to, value); if (from == address(0)) { uint256 supply = totalSupply(); if (supply > maxSupply) { revert MaxSupplyExceeded(supply, maxSupply); } } } }
{ "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "paris", "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":"address","name":"_admin","type":"address"},{"internalType":"address","name":"_nativeToken","type":"address"},{"internalType":"address","name":"_mbToken","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"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":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"address","name":"fromToken","type":"address"},{"indexed":true,"internalType":"address","name":"toToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokenSwapped","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"ADMIN_ROLE","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":"FEE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UNPAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"address","name":"_tokenAddr","type":"address"}],"name":"adminWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"burnFee","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"burnFeeScale","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeTreasury","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":[],"name":"mbToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nativeToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"periodLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"periodMaxAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"periodMintedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"periodStart","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_fee","type":"uint32"},{"internalType":"uint32","name":"_scale","type":"uint32"}],"name":"setBurnFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"}],"name":"setFeeTreasuryAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_periodLength","type":"uint256"},{"internalType":"uint256","name":"_maxAmount","type":"uint256"}],"name":"setLimits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_fee","type":"uint32"},{"internalType":"uint32","name":"_scale","type":"uint32"}],"name":"setTreasuryFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"swapToNative","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"swapToNativeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"swappableAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"treasuryFee","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"treasuryFeeScale","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b5060405162001c2238038062001c228339810160408190526200003491620002c8565b60016000556003805460ff191690556001600160a01b038316620000ae5760405162461bcd60e51b815260206004820152602760248201527f476174657761793a2041444d494e5f414444524553535f4d5553545f42455f4e6044820152664f4e2d5a45524f60c81b606482015260840160405180910390fd5b620000bb6000846200017e565b50620000e87fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775846200017e565b50620001157ff33fe78eb7c840e8bf68670029904b6f0da8e79346941c278a4e7676d473df15846200017e565b504260065560038054610100600160a81b0319166101006001600160a01b0394851602179055600480546001600160a01b0319169190921617905550600980546bffffffff00000000ffffffff60201b19166c6400000000000000640000000017905562000312565b6000806200018d8484620001bb565b90508015620001b2576000848152600260205260409020620001b0908462000251565b505b90505b92915050565b60008281526001602090815260408083206001600160a01b038516845290915281205460ff16620002485760008381526001602081815260408084206001600160a01b0387168086529252808420805460ff19169093179092559051339286917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a4506001620001b5565b506000620001b5565b6000620001b2836001600160a01b03841660008181526001830160205260408120546200024857508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155620001b5565b80516001600160a01b0381168114620002c357600080fd5b919050565b600080600060608486031215620002de57600080fd5b620002e984620002ab565b9250620002f960208501620002ab565b91506200030960408501620002ab565b90509250925092565b61190080620003226000396000f3fe608060405234801561001057600080fd5b50600436106102115760003560e01c80639b5a989a11610125578063dc646c6f116100ad578063eda4e6d61161007c578063eda4e6d614610491578063fb1bb9de1461049a578063fbaa2af4146104c1578063fce589d8146104ca578063fdb6742b146104da57600080fd5b8063dc646c6f14610437578063e1758bd81461043f578063e63ab1e914610457578063e6eed1a21461047e57600080fd5b8063ca15c873116100f4578063ca15c873146103c4578063cc32d176146103d7578063d2ca211514610403578063d547741f1461040c578063daec9a571461041f57600080fd5b80639b5a989a14610383578063a217fddf14610396578063c4590d3f1461039e578063c6f4f173146103b157600080fd5b80635c0d3a08116101a857806375b238fc1161017757806375b238fc1461032d5780638456cb591461034257806384820fb41461034a5780639010d07c1461035d57806391d148541461037057600080fd5b80635c0d3a08146102db5780635c975abb146102e457806360dc2340146102ef57806367c1bb121461031a57600080fd5b80632a0276f8116101e45780632a0276f8146102985780632f2ff15d146102ad57806336568abe146102c05780633f4ba83a146102d357600080fd5b806301ffc9a71461021657806312f5ea401461023e5780631ce9f1ef14610253578063248a9ca314610266575b600080fd5b610229610224366004611642565b6104f1565b60405190151581526020015b60405180910390f35b61025161024c366004611683565b61051c565b005b6102516102613660046116bf565b6105ab565b61028a6102743660046116eb565b6000908152600160208190526040909120015490565b604051908152602001610235565b61028a60008051602061188b83398151915281565b6102516102bb3660046116bf565b6105d3565b6102516102ce3660046116bf565b6105f9565b610251610631565b61028a60085481565b60035460ff16610229565b600a54610302906001600160a01b031681565b6040516001600160a01b039091168152602001610235565b6102516103283660046116eb565b610666565b61028a6000805160206118ab83398151915281565b61025161068a565b610251610358366004611718565b6106bc565b61030261036b366004611742565b610705565b61022961037e3660046116bf565b610724565b610251610391366004611764565b61074f565b61028a600081565b6102516103ac366004611742565b61078a565b600454610302906001600160a01b031681565b61028a6103d23660046116eb565b6107ae565b6009546103ee90600160401b900463ffffffff1681565b60405163ffffffff9091168152602001610235565b61028a60055481565b61025161041a3660046116bf565b6107c5565b6009546103ee90640100000000900463ffffffff1681565b61028a6107eb565b6003546103029061010090046001600160a01b031681565b61028a7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b61025161048c366004611718565b610939565b61028a60065481565b61028a7f427da25fe773164f88948d3e215c94b6554e2ed5e5f203a821c9f2f6131cf75a81565b61028a60075481565b6009546103ee9063ffffffff1681565b6009546103ee90600160601b900463ffffffff1681565b60006001600160e01b03198216635a05180f60e01b14806105165750610516826109f4565b92915050565b6000805160206118ab83398151915261053481610a29565b6001600160a01b03831661054757600080fd5b6001600160a01b038216610591576040516001600160a01b0384169085156108fc029086906000818181858888f1935050505015801561058b573d6000803e3d6000fd5b506105a5565b6105a56001600160a01b0383168486610a33565b50505050565b6105b3610a92565b6105bb610abc565b6105c58282610ae2565b6105cf6001600055565b5050565b600082815260016020819052604090912001546105ef81610a29565b6105a58383610fa7565b6001600160a01b03811633146106225760405163334bd91960e11b815260040160405180910390fd5b61062c8282610fdc565b505050565b7f427da25fe773164f88948d3e215c94b6554e2ed5e5f203a821c9f2f6131cf75a61065b81610a29565b610663611009565b50565b61066e610a92565b610676610abc565b6106808133610ae2565b6106636001600055565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a6106b481610a29565b61066361105b565b60008051602061188b8339815191526106d481610a29565b506009805463ffffffff9283166401000000000267ffffffffffffffff199091169290931691909117919091179055565b600082815260026020526040812061071d9083611098565b9392505050565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60008051602061188b83398151915261076781610a29565b50600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6000805160206118ab8339815191526107a281610a29565b50600591909155600755565b6000818152600260205260408120610516906110a4565b600082815260016020819052604090912001546107e181610a29565b6105a58383610fdc565b600080600360019054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610841573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610865919061177f565b600360019054906101000a90046001600160a01b03166001600160a01b031663d5abeb016040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108dc919061177f565b6108e691906117ae565b600554909150156109345760006005546006544261090491906117ae565b116109205760085460075461091991906117ae565b9050610925565b506007545b8082106109325792915050565b505b919050565b60008051602061188b83398151915261095181610a29565b600a546001600160a01b03166109ae5760405162461bcd60e51b815260206004820152601760248201527f666565207472656173757279206973206e6f742073657400000000000000000060448201526064015b60405180910390fd5b50600980546fffffffffffffffff00000000000000001916600160401b63ffffffff9485160263ffffffff60601b191617600160601b9290931691909102919091179055565b60006001600160e01b03198216637965db0b60e01b148061051657506301ffc9a760e01b6001600160e01b0319831614610516565b61066381336110ae565b6040516001600160a01b0383811660248301526044820183905261062c91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b0383818316178352505050506110e7565b600260005403610ab557604051633ee5aeb560e01b815260040160405180910390fd5b6002600055565b60035460ff1615610ae05760405163d93c066560e01b815260040160405180910390fd5b565b60008211610b415760405162461bcd60e51b815260206004820152602660248201527f476174657761793a20414d4f554e545f4d5553545f42455f475245415445525f60448201526505448414e5f360d41b60648201526084016109a5565b6001600160a01b038116610bab5760405162461bcd60e51b815260206004820152602b60248201527f476174657761793a20524543495049454e545f414444524553535f4d5553545f60448201526a42455f4e4f4e2d5a45524f60a81b60648201526084016109a5565b600480546040516370a0823160e01b815230928101929092526000916001600160a01b03909116906370a0823190602401602060405180830381865afa158015610bf9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1d919061177f565b600454909150610c38906001600160a01b031633308661114a565b600480546040516370a0823160e01b8152309281019290925260009183916001600160a01b0316906370a0823190602401602060405180830381865afa158015610c86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610caa919061177f565b610cb491906117ae565b9050808414610d055760405162461bcd60e51b815260206004820181905260248201527f476174657761793a20494e56414c49445f52454345495645445f414d4f554e5460448201526064016109a5565b6000610d0f6107eb565b90506000610d1c86611183565b90506000610d29876111ae565b90506000610d3782846117c1565b610d4190896117ae565b9050838111610dab5760048054604051630852cd8d60e31b81529182018a90526001600160a01b0316906342966c6890602401600060405180830381600087803b158015610d8e57600080fd5b505af1158015610da2573d6000803e3d6000fd5b50505050610e5e565b610db484611183565b9250610dbf846111ae565b9150610dcb82846117c1565b610dd590856117ae565b60048054604051630852cd8d60e31b81529293506001600160a01b0316916342966c6891610e099188910190815260200190565b600060405180830381600087803b158015610e2357600080fd5b505af1158015610e37573d6000803e3d6000fd5b50505050610e5e87858a610e4b91906117ae565b6004546001600160a01b03169190610a33565b8115610ed257600354600a546040516340c10f1960e01b81526001600160a01b0391821660048201526024810185905261010090920416906340c10f1990604401600060405180830381600087803b158015610eb957600080fd5b505af1158015610ecd573d6000803e3d6000fd5b505050505b6003546040516340c10f1960e01b81526001600160a01b03898116600483015260248201849052610100909204909116906340c10f1990604401600060405180830381600087803b158015610f2657600080fd5b505af1158015610f3a573d6000803e3d6000fd5b50505050610f47816111d6565b600354600454604080516001600160a01b038b81168252602082018d9052825161010090950481169493169233927fcb803386226022c424543f38623c830b1a56b16f37e100fe5f2aa460054746fd928290030190a45050505050505050565b600080610fb4848461127b565b9050801561071d576000848152600260205260409020610fd490846112f4565b509392505050565b600080610fe98484611309565b9050801561071d576000848152600260205260409020610fd49084611376565b61101161138b565b6003805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b611063610abc565b6003805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861103e3390565b600061071d83836113ae565b6000610516825490565b6110b88282610724565b6105cf5760405163e2517d3f60e01b81526001600160a01b0382166004820152602481018390526044016109a5565b60006110fc6001600160a01b038416836113d8565b9050805160001415801561112157508080602001905181019061111f91906117d4565b155b1561062c57604051635274afe760e01b81526001600160a01b03841660048201526024016109a5565b6040516001600160a01b0384811660248301528381166044830152606482018390526105a59186918216906323b872dd90608401610a60565b60095460009063ffffffff64010000000082048116916111a49116846117f6565b610516919061180d565b60095460009063ffffffff600160601b82048116916111a491600160401b90910416846117f6565b6111ee6000805160206118ab83398151915233610724565b6106635760055460065461120290426117ae565b1161127257806008600082825461121991906117c1565b909155505060075460085411156106635760405162461bcd60e51b815260206004820152601c60248201527f506572696f64207468726573686f6c642069732065786365656465640000000060448201526064016109a5565b42600655600855565b60006112878383610724565b6112ec5760008381526001602081815260408084206001600160a01b0387168086529252808420805460ff19169093179092559051339286917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a4506001610516565b506000610516565b600061071d836001600160a01b0384166113e6565b60006113158383610724565b156112ec5760008381526001602090815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610516565b600061071d836001600160a01b03841661142d565b60035460ff16610ae057604051638dfc202b60e01b815260040160405180910390fd5b60008260000182815481106113c5576113c561182f565b9060005260206000200154905092915050565b606061071d83836000611520565b60008181526001830160205260408120546112ec57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610516565b600081815260018301602052604081205480156115165760006114516001836117ae565b8554909150600090611465906001906117ae565b90508082146114ca5760008660000182815481106114855761148561182f565b90600052602060002001549050808760000184815481106114a8576114a861182f565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806114db576114db611845565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610516565b6000915050610516565b6060814710156115455760405163cd78605960e01b81523060048201526024016109a5565b600080856001600160a01b03168486604051611561919061185b565b60006040518083038185875af1925050503d806000811461159e576040519150601f19603f3d011682016040523d82523d6000602084013e6115a3565b606091505b50915091506115b38683836115bd565b9695505050505050565b6060826115d2576115cd82611619565b61071d565b81511580156115e957506001600160a01b0384163b155b1561161257604051639996b31560e01b81526001600160a01b03851660048201526024016109a5565b508061071d565b8051156116295780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b60006020828403121561165457600080fd5b81356001600160e01b03198116811461071d57600080fd5b80356001600160a01b038116811461093457600080fd5b60008060006060848603121561169857600080fd5b833592506116a86020850161166c565b91506116b66040850161166c565b90509250925092565b600080604083850312156116d257600080fd5b823591506116e26020840161166c565b90509250929050565b6000602082840312156116fd57600080fd5b5035919050565b803563ffffffff8116811461093457600080fd5b6000806040838503121561172b57600080fd5b61173483611704565b91506116e260208401611704565b6000806040838503121561175557600080fd5b50508035926020909101359150565b60006020828403121561177657600080fd5b61071d8261166c565b60006020828403121561179157600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561051657610516611798565b8082018082111561051657610516611798565b6000602082840312156117e657600080fd5b8151801515811461071d57600080fd5b808202811582820484141761051657610516611798565b60008261182a57634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b6000825160005b8181101561187c5760208186018101518583015201611862565b50600092019182525091905056fef33fe78eb7c840e8bf68670029904b6f0da8e79346941c278a4e7676d473df15a49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775a2646970667358221220c6e2d808a4f5aa64dc3dae94f5f2d46b78e82097851236af10f99ba97f44a66264736f6c634300081400330000000000000000000000003f85d3f9390b8aee4292d2d543cec166b8b55add00000000000000000000000099e7bd153585368c975fcfcdd2ccf0b5172963ad0000000000000000000000008d4ae54e70614c21162a0faf1e0273492cc0078a
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102115760003560e01c80639b5a989a11610125578063dc646c6f116100ad578063eda4e6d61161007c578063eda4e6d614610491578063fb1bb9de1461049a578063fbaa2af4146104c1578063fce589d8146104ca578063fdb6742b146104da57600080fd5b8063dc646c6f14610437578063e1758bd81461043f578063e63ab1e914610457578063e6eed1a21461047e57600080fd5b8063ca15c873116100f4578063ca15c873146103c4578063cc32d176146103d7578063d2ca211514610403578063d547741f1461040c578063daec9a571461041f57600080fd5b80639b5a989a14610383578063a217fddf14610396578063c4590d3f1461039e578063c6f4f173146103b157600080fd5b80635c0d3a08116101a857806375b238fc1161017757806375b238fc1461032d5780638456cb591461034257806384820fb41461034a5780639010d07c1461035d57806391d148541461037057600080fd5b80635c0d3a08146102db5780635c975abb146102e457806360dc2340146102ef57806367c1bb121461031a57600080fd5b80632a0276f8116101e45780632a0276f8146102985780632f2ff15d146102ad57806336568abe146102c05780633f4ba83a146102d357600080fd5b806301ffc9a71461021657806312f5ea401461023e5780631ce9f1ef14610253578063248a9ca314610266575b600080fd5b610229610224366004611642565b6104f1565b60405190151581526020015b60405180910390f35b61025161024c366004611683565b61051c565b005b6102516102613660046116bf565b6105ab565b61028a6102743660046116eb565b6000908152600160208190526040909120015490565b604051908152602001610235565b61028a60008051602061188b83398151915281565b6102516102bb3660046116bf565b6105d3565b6102516102ce3660046116bf565b6105f9565b610251610631565b61028a60085481565b60035460ff16610229565b600a54610302906001600160a01b031681565b6040516001600160a01b039091168152602001610235565b6102516103283660046116eb565b610666565b61028a6000805160206118ab83398151915281565b61025161068a565b610251610358366004611718565b6106bc565b61030261036b366004611742565b610705565b61022961037e3660046116bf565b610724565b610251610391366004611764565b61074f565b61028a600081565b6102516103ac366004611742565b61078a565b600454610302906001600160a01b031681565b61028a6103d23660046116eb565b6107ae565b6009546103ee90600160401b900463ffffffff1681565b60405163ffffffff9091168152602001610235565b61028a60055481565b61025161041a3660046116bf565b6107c5565b6009546103ee90640100000000900463ffffffff1681565b61028a6107eb565b6003546103029061010090046001600160a01b031681565b61028a7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b61025161048c366004611718565b610939565b61028a60065481565b61028a7f427da25fe773164f88948d3e215c94b6554e2ed5e5f203a821c9f2f6131cf75a81565b61028a60075481565b6009546103ee9063ffffffff1681565b6009546103ee90600160601b900463ffffffff1681565b60006001600160e01b03198216635a05180f60e01b14806105165750610516826109f4565b92915050565b6000805160206118ab83398151915261053481610a29565b6001600160a01b03831661054757600080fd5b6001600160a01b038216610591576040516001600160a01b0384169085156108fc029086906000818181858888f1935050505015801561058b573d6000803e3d6000fd5b506105a5565b6105a56001600160a01b0383168486610a33565b50505050565b6105b3610a92565b6105bb610abc565b6105c58282610ae2565b6105cf6001600055565b5050565b600082815260016020819052604090912001546105ef81610a29565b6105a58383610fa7565b6001600160a01b03811633146106225760405163334bd91960e11b815260040160405180910390fd5b61062c8282610fdc565b505050565b7f427da25fe773164f88948d3e215c94b6554e2ed5e5f203a821c9f2f6131cf75a61065b81610a29565b610663611009565b50565b61066e610a92565b610676610abc565b6106808133610ae2565b6106636001600055565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a6106b481610a29565b61066361105b565b60008051602061188b8339815191526106d481610a29565b506009805463ffffffff9283166401000000000267ffffffffffffffff199091169290931691909117919091179055565b600082815260026020526040812061071d9083611098565b9392505050565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60008051602061188b83398151915261076781610a29565b50600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6000805160206118ab8339815191526107a281610a29565b50600591909155600755565b6000818152600260205260408120610516906110a4565b600082815260016020819052604090912001546107e181610a29565b6105a58383610fdc565b600080600360019054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610841573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610865919061177f565b600360019054906101000a90046001600160a01b03166001600160a01b031663d5abeb016040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108dc919061177f565b6108e691906117ae565b600554909150156109345760006005546006544261090491906117ae565b116109205760085460075461091991906117ae565b9050610925565b506007545b8082106109325792915050565b505b919050565b60008051602061188b83398151915261095181610a29565b600a546001600160a01b03166109ae5760405162461bcd60e51b815260206004820152601760248201527f666565207472656173757279206973206e6f742073657400000000000000000060448201526064015b60405180910390fd5b50600980546fffffffffffffffff00000000000000001916600160401b63ffffffff9485160263ffffffff60601b191617600160601b9290931691909102919091179055565b60006001600160e01b03198216637965db0b60e01b148061051657506301ffc9a760e01b6001600160e01b0319831614610516565b61066381336110ae565b6040516001600160a01b0383811660248301526044820183905261062c91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b0383818316178352505050506110e7565b600260005403610ab557604051633ee5aeb560e01b815260040160405180910390fd5b6002600055565b60035460ff1615610ae05760405163d93c066560e01b815260040160405180910390fd5b565b60008211610b415760405162461bcd60e51b815260206004820152602660248201527f476174657761793a20414d4f554e545f4d5553545f42455f475245415445525f60448201526505448414e5f360d41b60648201526084016109a5565b6001600160a01b038116610bab5760405162461bcd60e51b815260206004820152602b60248201527f476174657761793a20524543495049454e545f414444524553535f4d5553545f60448201526a42455f4e4f4e2d5a45524f60a81b60648201526084016109a5565b600480546040516370a0823160e01b815230928101929092526000916001600160a01b03909116906370a0823190602401602060405180830381865afa158015610bf9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1d919061177f565b600454909150610c38906001600160a01b031633308661114a565b600480546040516370a0823160e01b8152309281019290925260009183916001600160a01b0316906370a0823190602401602060405180830381865afa158015610c86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610caa919061177f565b610cb491906117ae565b9050808414610d055760405162461bcd60e51b815260206004820181905260248201527f476174657761793a20494e56414c49445f52454345495645445f414d4f554e5460448201526064016109a5565b6000610d0f6107eb565b90506000610d1c86611183565b90506000610d29876111ae565b90506000610d3782846117c1565b610d4190896117ae565b9050838111610dab5760048054604051630852cd8d60e31b81529182018a90526001600160a01b0316906342966c6890602401600060405180830381600087803b158015610d8e57600080fd5b505af1158015610da2573d6000803e3d6000fd5b50505050610e5e565b610db484611183565b9250610dbf846111ae565b9150610dcb82846117c1565b610dd590856117ae565b60048054604051630852cd8d60e31b81529293506001600160a01b0316916342966c6891610e099188910190815260200190565b600060405180830381600087803b158015610e2357600080fd5b505af1158015610e37573d6000803e3d6000fd5b50505050610e5e87858a610e4b91906117ae565b6004546001600160a01b03169190610a33565b8115610ed257600354600a546040516340c10f1960e01b81526001600160a01b0391821660048201526024810185905261010090920416906340c10f1990604401600060405180830381600087803b158015610eb957600080fd5b505af1158015610ecd573d6000803e3d6000fd5b505050505b6003546040516340c10f1960e01b81526001600160a01b03898116600483015260248201849052610100909204909116906340c10f1990604401600060405180830381600087803b158015610f2657600080fd5b505af1158015610f3a573d6000803e3d6000fd5b50505050610f47816111d6565b600354600454604080516001600160a01b038b81168252602082018d9052825161010090950481169493169233927fcb803386226022c424543f38623c830b1a56b16f37e100fe5f2aa460054746fd928290030190a45050505050505050565b600080610fb4848461127b565b9050801561071d576000848152600260205260409020610fd490846112f4565b509392505050565b600080610fe98484611309565b9050801561071d576000848152600260205260409020610fd49084611376565b61101161138b565b6003805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b611063610abc565b6003805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861103e3390565b600061071d83836113ae565b6000610516825490565b6110b88282610724565b6105cf5760405163e2517d3f60e01b81526001600160a01b0382166004820152602481018390526044016109a5565b60006110fc6001600160a01b038416836113d8565b9050805160001415801561112157508080602001905181019061111f91906117d4565b155b1561062c57604051635274afe760e01b81526001600160a01b03841660048201526024016109a5565b6040516001600160a01b0384811660248301528381166044830152606482018390526105a59186918216906323b872dd90608401610a60565b60095460009063ffffffff64010000000082048116916111a49116846117f6565b610516919061180d565b60095460009063ffffffff600160601b82048116916111a491600160401b90910416846117f6565b6111ee6000805160206118ab83398151915233610724565b6106635760055460065461120290426117ae565b1161127257806008600082825461121991906117c1565b909155505060075460085411156106635760405162461bcd60e51b815260206004820152601c60248201527f506572696f64207468726573686f6c642069732065786365656465640000000060448201526064016109a5565b42600655600855565b60006112878383610724565b6112ec5760008381526001602081815260408084206001600160a01b0387168086529252808420805460ff19169093179092559051339286917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a4506001610516565b506000610516565b600061071d836001600160a01b0384166113e6565b60006113158383610724565b156112ec5760008381526001602090815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610516565b600061071d836001600160a01b03841661142d565b60035460ff16610ae057604051638dfc202b60e01b815260040160405180910390fd5b60008260000182815481106113c5576113c561182f565b9060005260206000200154905092915050565b606061071d83836000611520565b60008181526001830160205260408120546112ec57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610516565b600081815260018301602052604081205480156115165760006114516001836117ae565b8554909150600090611465906001906117ae565b90508082146114ca5760008660000182815481106114855761148561182f565b90600052602060002001549050808760000184815481106114a8576114a861182f565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806114db576114db611845565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610516565b6000915050610516565b6060814710156115455760405163cd78605960e01b81523060048201526024016109a5565b600080856001600160a01b03168486604051611561919061185b565b60006040518083038185875af1925050503d806000811461159e576040519150601f19603f3d011682016040523d82523d6000602084013e6115a3565b606091505b50915091506115b38683836115bd565b9695505050505050565b6060826115d2576115cd82611619565b61071d565b81511580156115e957506001600160a01b0384163b155b1561161257604051639996b31560e01b81526001600160a01b03851660048201526024016109a5565b508061071d565b8051156116295780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b60006020828403121561165457600080fd5b81356001600160e01b03198116811461071d57600080fd5b80356001600160a01b038116811461093457600080fd5b60008060006060848603121561169857600080fd5b833592506116a86020850161166c565b91506116b66040850161166c565b90509250925092565b600080604083850312156116d257600080fd5b823591506116e26020840161166c565b90509250929050565b6000602082840312156116fd57600080fd5b5035919050565b803563ffffffff8116811461093457600080fd5b6000806040838503121561172b57600080fd5b61173483611704565b91506116e260208401611704565b6000806040838503121561175557600080fd5b50508035926020909101359150565b60006020828403121561177657600080fd5b61071d8261166c565b60006020828403121561179157600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561051657610516611798565b8082018082111561051657610516611798565b6000602082840312156117e657600080fd5b8151801515811461071d57600080fd5b808202811582820484141761051657610516611798565b60008261182a57634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b6000825160005b8181101561187c5760208186018101518583015201611862565b50600092019182525091905056fef33fe78eb7c840e8bf68670029904b6f0da8e79346941c278a4e7676d473df15a49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775a2646970667358221220c6e2d808a4f5aa64dc3dae94f5f2d46b78e82097851236af10f99ba97f44a66264736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000003f85d3f9390b8aee4292d2d543cec166b8b55add00000000000000000000000099e7bd153585368c975fcfcdd2ccf0b5172963ad0000000000000000000000008d4ae54e70614c21162a0faf1e0273492cc0078a
-----Decoded View---------------
Arg [0] : _admin (address): 0x3F85D3F9390b8Aee4292D2D543Cec166B8B55aDD
Arg [1] : _nativeToken (address): 0x99E7bD153585368c975FcFcdD2cCF0B5172963Ad
Arg [2] : _mbToken (address): 0x8D4aE54e70614c21162A0faF1e0273492CC0078a
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000003f85d3f9390b8aee4292d2d543cec166b8b55add
Arg [1] : 00000000000000000000000099e7bd153585368c975fcfcdd2ccf0b5172963ad
Arg [2] : 0000000000000000000000008d4ae54e70614c21162a0faf1e0273492cc0078a
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.