Token
Unstable escrowed token (esUSM)
ERC-20
Source Code
Overview
Max Total Supply
10,368,000 esUSM
Holders
3,932
Market
Onchain Market Cap
-
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 18 Decimals)
Balance
3,627.657148886428551185 esUSMLoading...
Loading
Loading...
Loading
Loading...
Loading
| # | Exchange | Pair | Price | 24H Volume | % Volume |
|---|
Contract Name:
esUsmToken
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 9999 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.18 <0.8.20;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import 'contracts/unstable/interfaces/IUsmToken.sol';
import 'contracts/unstable/interfaces/IesUsmToken.sol';
/*
* esUSM is Unstable's escrowed governance token obtainable by converting USM or farming it
* It's non-transferable, except from/to whitelisted addresses
* It can be converted back to USM through a vesting process
*/
contract esUsmToken is Ownable, ReentrancyGuard, ERC20("Unstable escrowed token", "esUSM"), IesUsmToken {
using Address for address;
using SafeMath for uint256;
using EnumerableSet for EnumerableSet.AddressSet;
using SafeERC20 for IUsmToken;
struct esUSMBalance {
uint256 redeemingAmount; // Total amount of esUSM currently being redeemed
}
struct RedeemInfo {
uint256 usmAmount; // USM amount to receive when vesting has ended
uint256 esUsmAmount; // esUSM amount to redeem
uint256 endTime;
}
IUsmToken public immutable usmToken; // USM token to convert to/from
EnumerableSet.AddressSet private _transferWhitelist; // addresses allowed to send/receive esUSM
// Redeeming min/max settings
uint256 public minRedeemRatio = 50; // 1:0.5
uint256 public maxRedeemRatio = 100; // 1:1
uint256 public minRedeemDuration = 1 days; // 1296000s
uint256 public maxRedeemDuration = 90 days; // 7776000s
uint256 public constant MAX_FIXED_RATIO = 100; // 100%
mapping(address => esUSMBalance) public esUsmBalances; // User's esUSM balances
mapping(address => RedeemInfo[]) public userRedeems; // User's redeeming instances
constructor(IUsmToken _usmToken) {
usmToken = _usmToken;
_transferWhitelist.add(address(this));
}
/********************************************/
/****************** EVENTS ******************/
/********************************************/
event Convert(address indexed from, address to, uint256 amount);
event UpdateRedeemSettings(uint256 minRedeemRatio, uint256 maxRedeemRatio, uint256 minRedeemDuration, uint256 maxRedeemDuration);
event UpdateRewardsAddress(address previousRewardsAddress, address newRewardsAddress);//TODO: check this
event SetTransferWhitelist(address account, bool add);
event Redeem(address indexed userAddress, uint256 esUsmAmount, uint256 usmAmount, uint256 duration);
event FinalizeRedeem(address indexed userAddress, uint256 esUsmAmount, uint256 usmAmount);
event CancelRedeem(address indexed userAddress, uint256 esUsmAmount);
event UpdateRedeemRewardsAddress(address indexed userAddress, uint256 redeemIndex, address previousRewardsAddress, address newRewardsAddress);
/***********************************************/
/****************** MODIFIERS ******************/
/***********************************************/
/*
* @dev Check if a redeem entry exists
*/
modifier validateRedeem(address userAddress, uint256 redeemIndex) {
require(redeemIndex < userRedeems[userAddress].length, "validateRedeem: redeem entry does not exist");
_;
}
/**************************************************/
/****************** PUBLIC VIEWS ******************/
/**************************************************/
/*
* @dev Returns user's esUSM balances
*/
function getesUsmBalance(address userAddress) external view returns (uint256 redeemingAmount) {
esUSMBalance storage balance = esUsmBalances[userAddress];
return balance.redeemingAmount;
}
/*
* @dev returns redeemable USM for "amount" of esUSM vested for "duration" seconds
*/
function getUsmByVestingDuration(uint256 amount, uint256 duration) public view returns (uint256) {
if(duration < minRedeemDuration) {
return 0;
}
// capped to maxRedeemDuration
if (duration > maxRedeemDuration) {
return amount.mul(maxRedeemRatio).div(100);
}
uint256 ratio = minRedeemRatio.add(
(duration.sub(minRedeemDuration)).mul(maxRedeemRatio.sub(minRedeemRatio))
.div(maxRedeemDuration.sub(minRedeemDuration))
);
return amount.mul(ratio).div(100);
}
/**
* @dev returns quantity of "userAddress" pending redeems
*/
function getUserRedeemsLength(address userAddress) external view returns (uint256) {
return userRedeems[userAddress].length;
}
/**
* @dev returns "userAddress" info for a pending redeem identified by "redeemIndex"
*/
function getUserRedeem(address userAddress, uint256 redeemIndex) external view validateRedeem(userAddress, redeemIndex) returns (uint256 usmAmount, uint256 esUSMAmount, uint256 endTime) {
RedeemInfo storage _redeem = userRedeems[userAddress][redeemIndex];
return (_redeem.usmAmount, _redeem.esUsmAmount, _redeem.endTime);
}
/**
* @dev returns length of transferWhitelist array
*/
function transferWhitelistLength() external view returns (uint256) {
return _transferWhitelist.length();
}
/**
* @dev returns transferWhitelist array item's address for "index"
*/
function transferWhitelist(uint256 index) external view returns (address) {
return _transferWhitelist.at(index);
}
/**
* @dev returns if "account" is allowed to send/receive esUSM
*/
function isTransferWhitelisted(address account) external override view returns (bool) {
return _transferWhitelist.contains(account);
}
/*******************************************************/
/****************** OWNABLE FUNCTIONS ******************/
/*******************************************************/
/**
* @dev Updates all redeem ratios and durations
*
* Must only be called by owner
*/
function updateRedeemSettings(uint256 minRedeemRatio_, uint256 maxRedeemRatio_, uint256 minRedeemDuration_, uint256 maxRedeemDuration_) external onlyOwner {
require(minRedeemRatio_ <= maxRedeemRatio_, "updateRedeemSettings: wrong ratio values");
require(minRedeemDuration_ < maxRedeemDuration_, "updateRedeemSettings: wrong duration values");
// should never exceed 100%
require(maxRedeemRatio_ <= MAX_FIXED_RATIO, "updateRedeemSettings: wrong ratio values");
minRedeemRatio = minRedeemRatio_;
maxRedeemRatio = maxRedeemRatio_;
minRedeemDuration = minRedeemDuration_;
maxRedeemDuration = maxRedeemDuration_;
emit UpdateRedeemSettings(minRedeemRatio_, maxRedeemRatio_, minRedeemDuration_, maxRedeemDuration_);
}
/**
* @dev Adds or removes addresses from the transferWhitelist
*/
function updateTransferWhitelist(address account, bool add) external onlyOwner {
require(account != address(this), "updateTransferWhitelist: Cannot remove esUSM from whitelist");
if(add) _transferWhitelist.add(account);
else _transferWhitelist.remove(account);
emit SetTransferWhitelist(account, add);
}
/*****************************************************************/
/****************** EXTERNAL PUBLIC FUNCTIONS ******************/
/*****************************************************************/
/**
* @dev Convert caller's "amount" of USM to esUSM
*/
function convert(uint256 amount) external nonReentrant {
_convert(amount, msg.sender);
}
/**
* @dev Convert caller's "amount" of USM to esUSM to "to" address
*/
function convertTo(uint256 amount, address to) external override nonReentrant {
require(address(msg.sender).isContract(), "convertTo: not allowed");
_convert(amount, to);
}
/**
* @dev Initiates redeem process (esUSM to USM)
*/
function redeem(uint256 esUSMAmount, uint256 duration) external nonReentrant {
require(esUSMAmount > 0, "redeem: esUSMAmount cannot be null");
require(duration >= minRedeemDuration, "redeem: duration too low");
_transfer(msg.sender, address(this), esUSMAmount);
esUSMBalance storage balance = esUsmBalances[msg.sender];
// get corresponding USM amount
uint256 usmAmount = getUsmByVestingDuration(esUSMAmount, duration);
emit Redeem(msg.sender, esUSMAmount, usmAmount, duration);
// if redeeming is not immediate, go through vesting process
if(duration > 0) {
// add to SBT total
balance.redeemingAmount = balance.redeemingAmount.add(esUSMAmount);
// add redeeming entry
userRedeems[msg.sender].push(RedeemInfo(usmAmount, esUSMAmount, _currentBlockTimestamp().add(duration)));
} else {
// immediately redeem for USM
_finalizeRedeem(msg.sender, esUSMAmount, usmAmount);
}
}
/**
* @dev Finalizes redeem process when vesting duration has been reached
*
* Can only be called by the redeem entry owner
*/
function finalizeRedeem(uint256 redeemIndex) external nonReentrant validateRedeem(msg.sender, redeemIndex) {
esUSMBalance storage balance = esUsmBalances[msg.sender];
RedeemInfo storage _redeem = userRedeems[msg.sender][redeemIndex];
require(_currentBlockTimestamp() >= _redeem.endTime, "finalizeRedeem: vesting duration has not ended yet");
// remove from SBT total
balance.redeemingAmount = balance.redeemingAmount.sub(_redeem.esUsmAmount);
_finalizeRedeem(msg.sender, _redeem.esUsmAmount, _redeem.usmAmount);
// remove redeem entry
_deleteRedeemEntry(redeemIndex);
}
/**
* @dev Cancels an ongoing redeem entry
*
* Can only be called by its owner
*/
function cancelRedeem(uint256 redeemIndex) external nonReentrant validateRedeem(msg.sender, redeemIndex) {
esUSMBalance storage balance = esUsmBalances[msg.sender];
RedeemInfo storage _redeem = userRedeems[msg.sender][redeemIndex];
// make redeeming esUSM available again
balance.redeemingAmount = balance.redeemingAmount.sub(_redeem.esUsmAmount);
_transfer(address(this), msg.sender, _redeem.esUsmAmount);
emit CancelRedeem(msg.sender, _redeem.esUsmAmount);
// remove redeem entry
_deleteRedeemEntry(redeemIndex);
}
/********************************************************/
/****************** INTERNAL FUNCTIONS ******************/
/********************************************************/
/**
* @dev Convert caller's "amount" of USM into esUSM to "to"
*/
function _convert(uint256 amount, address to) internal {
require(amount != 0, "convert: amount cannot be null");
// mint new esUSM
_mint(to, amount);
emit Convert(msg.sender, to, amount);
usmToken.safeTransferFrom(msg.sender, address(this), amount);
}
/**
* @dev Finalizes the redeeming process for "userAddress" by transferring him "usmAmount" and removing "esUSMAmount" from supply
*
* Any vesting check should be ran before calling this
* USM excess is automatically burnt
*/
function _finalizeRedeem(address userAddress, uint256 esUSMAmount, uint256 usmAmount) internal {
uint256 usmExcess = esUSMAmount.sub(usmAmount);
// sends due USM tokens
usmToken.safeTransfer(userAddress, usmAmount);
// burns USM excess if any
usmToken.burn(usmExcess);
_burn(address(this), esUSMAmount);
emit FinalizeRedeem(userAddress, esUSMAmount, usmAmount);
}
function _deleteRedeemEntry(uint256 index) internal {
userRedeems[msg.sender][index] = userRedeems[msg.sender][userRedeems[msg.sender].length - 1];
userRedeems[msg.sender].pop();
}
/**
* @dev Hook override to forbid transfers except from whitelisted addresses and minting
*/
function _beforeTokenTransfer(address from, address to, uint256 /*amount*/) internal view override {
require(from == address(0) || _transferWhitelist.contains(from) || _transferWhitelist.contains(to), "transfer: not allowed");
}
/**
* @dev Utility function to get the current block timestamp
*/
function _currentBlockTimestamp() internal view virtual returns (uint256) {
/* solhint-disable not-rely-on-time */
return block.timestamp;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../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 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.encodeWithSelector(token.transfer.selector, 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.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 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);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @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.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @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, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @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.isContract(address(token));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* The default value of {decimals} is 18. To change this, you should override
* this function so it returns a different value.
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the default value returned by this function, unless
* it's overridden.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
* - the caller must have allowance for ``from``'s tokens of at least
* `amount`.
*/
function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, spender) + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
*/
function _transfer(address from, address to, uint256 amount) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
// Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
// decrementing then incrementing.
_balances[to] += amount;
}
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
unchecked {
// Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
_balances[account] += amount;
}
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
// Overflow not possible: amount <= accountBalance <= totalSupply.
_totalSupply -= amount;
}
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `amount`.
*
* Does not update the allowance amount in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Might emit an {Approval} event.
*/
function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
pragma solidity ^0.8.0;
/**
* @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 of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping(bytes32 => uint256) _indexes;
}
/**
* @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._indexes[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 read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 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 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastValue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastValue;
// Update the index for the moved value
set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[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._indexes[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
pragma solidity >=0.8.18 <0.8.20;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
interface IUsmToken is IERC20 {
function burn(uint256 amount) external;
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.18 <0.8.20;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
interface IesUsmToken is IERC20 {
function convertTo(uint256 amount, address to) external;
function isTransferWhitelisted(address account) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @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.
*/
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].
*/
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 v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @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.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @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, it is bubbled up by this
* function (like regular Solidity function calls).
*
* 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.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @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`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) 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(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}{
"remappings": [
"@chainlink/=node_modules/@chainlink/",
"@ensdomains/=node_modules/@ensdomains/",
"@eth-optimism/=node_modules/@eth-optimism/",
"@ethereum-waffle/=node_modules/@ethereum-waffle/",
"@layerzerolabs/=node_modules/@layerzerolabs/",
"@openzeppelin-3/=node_modules/@openzeppelin-3/",
"@openzeppelin/=node_modules/@openzeppelin/",
"@uniswap/=node_modules/@uniswap/",
"erc721a/=node_modules/erc721a/",
"eth-gas-reporter/=node_modules/eth-gas-reporter/",
"forge-std/=lib/forge-std/src/",
"hardhat-deploy/=node_modules/hardhat-deploy/",
"hardhat/=node_modules/hardhat/"
],
"optimizer": {
"enabled": true,
"runs": 9999
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "paris",
"libraries": {}
}Contract ABI
API[{"inputs":[{"internalType":"contract IUsmToken","name":"_usmToken","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"esUsmAmount","type":"uint256"}],"name":"CancelRedeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Convert","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"esUsmAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"usmAmount","type":"uint256"}],"name":"FinalizeRedeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"esUsmAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"usmAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"duration","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bool","name":"add","type":"bool"}],"name":"SetTransferWhitelist","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"redeemIndex","type":"uint256"},{"indexed":false,"internalType":"address","name":"previousRewardsAddress","type":"address"},{"indexed":false,"internalType":"address","name":"newRewardsAddress","type":"address"}],"name":"UpdateRedeemRewardsAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"minRedeemRatio","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxRedeemRatio","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minRedeemDuration","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxRedeemDuration","type":"uint256"}],"name":"UpdateRedeemSettings","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousRewardsAddress","type":"address"},{"indexed":false,"internalType":"address","name":"newRewardsAddress","type":"address"}],"name":"UpdateRewardsAddress","type":"event"},{"inputs":[],"name":"MAX_FIXED_RATIO","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"redeemIndex","type":"uint256"}],"name":"cancelRedeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"convert","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"convertTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"esUsmBalances","outputs":[{"internalType":"uint256","name":"redeemingAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"redeemIndex","type":"uint256"}],"name":"finalizeRedeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"uint256","name":"redeemIndex","type":"uint256"}],"name":"getUserRedeem","outputs":[{"internalType":"uint256","name":"usmAmount","type":"uint256"},{"internalType":"uint256","name":"esUSMAmount","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"}],"name":"getUserRedeemsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"}],"name":"getUsmByVestingDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"}],"name":"getesUsmBalance","outputs":[{"internalType":"uint256","name":"redeemingAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isTransferWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxRedeemDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxRedeemRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minRedeemDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minRedeemRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"esUSMAmount","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"}],"name":"redeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"transferWhitelist","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"transferWhitelistLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"minRedeemRatio_","type":"uint256"},{"internalType":"uint256","name":"maxRedeemRatio_","type":"uint256"},{"internalType":"uint256","name":"minRedeemDuration_","type":"uint256"},{"internalType":"uint256","name":"maxRedeemDuration_","type":"uint256"}],"name":"updateRedeemSettings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bool","name":"add","type":"bool"}],"name":"updateTransferWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"userRedeems","outputs":[{"internalType":"uint256","name":"usmAmount","type":"uint256"},{"internalType":"uint256","name":"esUsmAmount","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"usmToken","outputs":[{"internalType":"contract IUsmToken","name":"","type":"address"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60a060405260326009556064600a5562015180600b556276a700600c553480156200002957600080fd5b5060405162002bbe38038062002bbe8339810160408190526200004c91620001c6565b6040518060400160405280601781526020017f556e737461626c6520657363726f77656420746f6b656e00000000000000000081525060405180604001604052806005815260200164657355534d60d81b815250620000ba620000b46200010060201b60201c565b62000104565b600180556005620000cc83826200029d565b506006620000db82826200029d565b5050506001600160a01b038116608052620000f860073062000154565b505062000369565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006200016b836001600160a01b03841662000174565b90505b92915050565b6000818152600183016020526040812054620001bd575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556200016e565b5060006200016e565b600060208284031215620001d957600080fd5b81516001600160a01b0381168114620001f157600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200022357607f821691505b6020821081036200024457634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200029857600081815260208120601f850160051c81016020861015620002735750805b601f850160051c820191505b8181101562000294578281556001016200027f565b5050505b505050565b81516001600160401b03811115620002b957620002b9620001f8565b620002d181620002ca84546200020e565b846200024a565b602080601f831160018114620003095760008415620002f05750858301515b600019600386901b1c1916600185901b17855562000294565b600085815260208120601f198616915b828110156200033a5788860151825594840194600190910190840162000319565b5085821015620003595787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6080516128246200039a600039600081816103030152818161199a01528181611ad20152611b2801526128246000f3fe608060405234801561001057600080fd5b506004361061025c5760003560e01c80638908365411610145578063c4b10766116100bd578063da1ce4d01161008c578063e3a2950b11610071578063e3a2950b146105b8578063e9ed87f8146105c1578063f2fde38b146105ca57600080fd5b8063da1ce4d01461055f578063dd62ed3e1461057257600080fd5b8063c4b1076614610510578063ca61329214610519578063cc6c54231461052c578063d9abf55c1461053f57600080fd5b8063a3908e1b11610114578063a9059cbb116100f9578063a9059cbb146104b4578063aff6cbf1146104c7578063b90c2b52146104da57600080fd5b8063a3908e1b1461048e578063a457c2d7146104a157600080fd5b8063890836541461041f5780638da5cb5b146104325780638e193e801461045057806395d89b411461048657600080fd5b806339509351116101d85780635a1d34dc116101a757806370a082311161018c57806370a08231146103ce578063715018a6146104045780637cbc23731461040c57600080fd5b80635a1d34dc146103b3578063619ac95b146103c657600080fd5b8063395093511461034a5780634b359d381461035d5780634f62b7ec14610370578063539ffb771461039e57600080fd5b80631c3526791161022f57806323b872dd1161021457806323b872dd146102dc578063313ce567146102ef57806338fbd533146102fe57600080fd5b80631c352679146102c05780631eee7e60146102c957600080fd5b806306fdde0314610261578063095ea7b31461027f578063161aab43146102a257806318160ddd146102b8575b600080fd5b6102696105dd565b604051610276919061245a565b60405180910390f35b61029261028d3660046124d4565b61066f565b6040519015158152602001610276565b6102aa610689565b604051908152602001610276565b6004546102aa565b6102aa60095481565b6102926102d73660046124fe565b61069a565b6102926102ea366004612519565b6106a7565b60405160128152602001610276565b6103257f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610276565b6102926103583660046124d4565b6106cb565b61032561036b366004612555565b610717565b61038361037e3660046124d4565b610724565b60408051938452602084019290925290820152606001610276565b6103b16103ac366004612555565b610766565b005b6103b16103c136600461256e565b6108b9565b6102aa606481565b6102aa6103dc3660046124fe565b73ffffffffffffffffffffffffffffffffffffffff1660009081526002602052604090205490565b6103b1610926565b6103b161041a36600461259a565b61093a565b6103b161042d3660046125ca565b610b0b565b60005473ffffffffffffffffffffffffffffffffffffffff16610325565b6102aa61045e3660046124fe565b73ffffffffffffffffffffffffffffffffffffffff166000908152600d602052604090205490565b610269610c16565b6103b161049c366004612555565b610c25565b6102926104af3660046124d4565b610c40565b6102926104c23660046124d4565b610cf7565b6103b16104d5366004612555565b610d05565b6102aa6104e83660046124fe565b73ffffffffffffffffffffffffffffffffffffffff166000908152600e602052604090205490565b6102aa600b5481565b6103b1610527366004612601565b610e7e565b61038361053a3660046124d4565b61104a565b6102aa61054d3660046124fe565b600d6020526000908152604090205481565b6102aa61056d36600461259a565b611152565b6102aa610580366004612633565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260036020908152604080832093909416825291909152205490565b6102aa600a5481565b6102aa600c5481565b6103b16105d83660046124fe565b611206565b6060600580546105ec9061265d565b80601f01602080910402602001604051908101604052809291908181526020018280546106189061265d565b80156106655780601f1061063a57610100808354040283529160200191610665565b820191906000526020600020905b81548152906001019060200180831161064857829003601f168201915b5050505050905090565b60003361067d8185856112a0565b60019150505b92915050565b6000610695600761141f565b905090565b6000610683600783611429565b6000336106b585828561145b565b6106c0858585611518565b506001949350505050565b33600081815260036020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919061067d90829086906107129087906126df565b6112a0565b600061068360078361174b565b600e602052816000526040600020818154811061074057600080fd5b600091825260209091206003909102018054600182015460029092015490935090915083565b61076e611757565b336000818152600e6020526040902054829081106107f95760405162461bcd60e51b815260206004820152602b60248201527f76616c696461746552656465656d3a2072656465656d20656e74727920646f6560448201527f73206e6f7420657869737400000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336000908152600d60209081526040808320600e9092528220805491929186908110610827576108276126f2565b90600052602060002090600302019050610852816001015483600001546117b090919063ffffffff16565b825560018101546108669030903390611518565b600181015460405190815233907f56d7520e387607a8daa892e3fed116badc2a636307bdc794b1c1aed97ae203f49060200160405180910390a26108a9856117bc565b505050506108b660018055565b50565b6108c1611757565b333b61090f5760405162461bcd60e51b815260206004820152601660248201527f636f6e76657274546f3a206e6f7420616c6c6f7765640000000000000000000060448201526064016107f0565b61091982826118d5565b61092260018055565b5050565b61092e6119c2565b6109386000611a29565b565b610942611757565b600082116109b85760405162461bcd60e51b815260206004820152602260248201527f72656465656d3a20657355534d416d6f756e742063616e6e6f74206265206e7560448201527f6c6c00000000000000000000000000000000000000000000000000000000000060648201526084016107f0565b600b54811015610a0a5760405162461bcd60e51b815260206004820152601860248201527f72656465656d3a206475726174696f6e20746f6f206c6f77000000000000000060448201526064016107f0565b610a15333084611518565b336000908152600d6020526040812090610a2f8484611152565b604080518681526020810183905290810185905290915033907fbd5034ffbd47e4e72a94baa2cdb74c6fad73cb3bcdc13036b72ec8306f5a76469060600160405180910390a28215610af5578154610a879085611a9e565b8255336000908152600e60209081526040918290208251606081018452848152918201879052918101610aba4287611a9e565b905281546001818101845560009384526020938490208351600390930201918255928201519281019290925560400151600290910155610b00565b610b00338583611aaa565b505061092260018055565b610b136119c2565b3073ffffffffffffffffffffffffffffffffffffffff831603610b9e5760405162461bcd60e51b815260206004820152603b60248201527f7570646174655472616e7366657257686974656c6973743a2043616e6e6f742060448201527f72656d6f766520657355534d2066726f6d2077686974656c697374000000000060648201526084016107f0565b8015610bb557610baf600783611bfa565b50610bc2565b610bc0600783611c1c565b505b6040805173ffffffffffffffffffffffffffffffffffffffff8416815282151560208201527f3a34209cb941a5d23a56dea730a13738454bc7daefd4bb32e8d7df58c1bd920d910160405180910390a15050565b6060600680546105ec9061265d565b610c2d611757565b610c3781336118d5565b6108b660018055565b33600081815260036020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015610cea5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084016107f0565b6106c082868684036112a0565b60003361067d818585611518565b610d0d611757565b336000818152600e602052604090205482908110610d935760405162461bcd60e51b815260206004820152602b60248201527f76616c696461746552656465656d3a2072656465656d20656e74727920646f6560448201527f73206e6f7420657869737400000000000000000000000000000000000000000060648201526084016107f0565b336000908152600d60209081526040808320600e9092528220805491929186908110610dc157610dc16126f2565b906000526020600020906003020190508060020154610ddd4290565b1015610e515760405162461bcd60e51b815260206004820152603260248201527f66696e616c697a6552656465656d3a2076657374696e67206475726174696f6e60448201527f20686173206e6f7420656e64656420796574000000000000000000000000000060648201526084016107f0565b60018101548254610e61916117b0565b825560018101548154610e75913391611aaa565b6108a9856117bc565b610e866119c2565b82841115610efc5760405162461bcd60e51b815260206004820152602860248201527f75706461746552656465656d53657474696e67733a2077726f6e67207261746960448201527f6f2076616c75657300000000000000000000000000000000000000000000000060648201526084016107f0565b808210610f715760405162461bcd60e51b815260206004820152602b60248201527f75706461746552656465656d53657474696e67733a2077726f6e67206475726160448201527f74696f6e2076616c75657300000000000000000000000000000000000000000060648201526084016107f0565b6064831115610fe85760405162461bcd60e51b815260206004820152602860248201527f75706461746552656465656d53657474696e67733a2077726f6e67207261746960448201527f6f2076616c75657300000000000000000000000000000000000000000000000060648201526084016107f0565b6009849055600a839055600b829055600c8190556040805185815260208101859052908101839052606081018290527ff282865353a487a40c4983b3a1a4e8901e81cb5605f653e6352dc57cdb5744889060800160405180910390a150505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600e6020526040812054819081908590859081106110ec5760405162461bcd60e51b815260206004820152602b60248201527f76616c696461746552656465656d3a2072656465656d20656e74727920646f6560448201527f73206e6f7420657869737400000000000000000000000000000000000000000060648201526084016107f0565b73ffffffffffffffffffffffffffffffffffffffff87166000908152600e60205260408120805488908110611123576111236126f2565b906000526020600020906003020190508060000154816001015482600201549550955095505050509250925092565b6000600b5482101561116657506000610683565b600c5482111561119757611190606461118a600a5486611c3e90919063ffffffff16565b90611c4a565b9050610683565b60006111ed6111e46111b6600b54600c546117b090919063ffffffff16565b61118a6111d0600954600a546117b090919063ffffffff16565b600b546111de9089906117b0565b90611c3e565b60095490611a9e565b90506111fe606461118a8684611c3e565b949350505050565b61120e6119c2565b73ffffffffffffffffffffffffffffffffffffffff81166112975760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016107f0565b6108b681611a29565b73ffffffffffffffffffffffffffffffffffffffff83166113285760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016107f0565b73ffffffffffffffffffffffffffffffffffffffff82166113b15760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016107f0565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000610683825490565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260018301602052604081205415155b9392505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600360209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461151257818110156115055760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016107f0565b61151284848484036112a0565b50505050565b73ffffffffffffffffffffffffffffffffffffffff83166115a15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016107f0565b73ffffffffffffffffffffffffffffffffffffffff821661162a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016107f0565b611635838383611c56565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040902054818110156116d15760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e6365000000000000000000000000000000000000000000000000000060648201526084016107f0565b73ffffffffffffffffffffffffffffffffffffffff80851660008181526002602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061173e9086815260200190565b60405180910390a3611512565b60006114548383611ce1565b6002600154036117a95760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016107f0565b6002600155565b60006114548284612721565b336000908152600e6020526040902080546117d990600190612721565b815481106117e9576117e96126f2565b9060005260206000209060030201600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208281548110611847576118476126f2565b600091825260208083208454600390930201918255600180850154908301556002938401549390910192909255338152600e9091526040902080548061188f5761188f612734565b60008281526020812060037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff909301928302018181556001810182905560020155905550565b816000036119255760405162461bcd60e51b815260206004820152601e60248201527f636f6e766572743a20616d6f756e742063616e6e6f74206265206e756c6c000060448201526064016107f0565b61192f8183611d0b565b6040805173ffffffffffffffffffffffffffffffffffffffff831681526020810184905233917fccfaeb3043a96a967dc036ab72e078a9632af809671bc2a1ac30a8043645f89e910160405180910390a261092273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016333085611df2565b60005473ffffffffffffffffffffffffffffffffffffffff1633146109385760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107f0565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600061145482846126df565b6000611ab683836117b0565b9050611af973ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168584611ece565b6040517f42966c68000000000000000000000000000000000000000000000000000000008152600481018290527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906342966c6890602401600060405180830381600087803b158015611b8157600080fd5b505af1158015611b95573d6000803e3d6000fd5b50505050611ba33084611f24565b604080518481526020810184905273ffffffffffffffffffffffffffffffffffffffff8616917f0da072ebd7a5649099f43a3776eb0cda17aca79426ee9f28aae203f5dfa04eda910160405180910390a250505050565b60006114548373ffffffffffffffffffffffffffffffffffffffff84166120c2565b60006114548373ffffffffffffffffffffffffffffffffffffffff8416612111565b60006114548284612763565b6000611454828461277a565b73ffffffffffffffffffffffffffffffffffffffff83161580611c7f5750611c7f600784611429565b80611c905750611c90600783611429565b611cdc5760405162461bcd60e51b815260206004820152601560248201527f7472616e736665723a206e6f7420616c6c6f776564000000000000000000000060448201526064016107f0565b505050565b6000826000018281548110611cf857611cf86126f2565b9060005260206000200154905092915050565b73ffffffffffffffffffffffffffffffffffffffff8216611d6e5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016107f0565b611d7a60008383611c56565b8060046000828254611d8c91906126df565b909155505073ffffffffffffffffffffffffffffffffffffffff82166000818152600260209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526115129085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612204565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052611cdc9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611e4c565b73ffffffffffffffffffffffffffffffffffffffff8216611fad5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016107f0565b611fb982600083611c56565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260026020526040902054818110156120555760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f636500000000000000000000000000000000000000000000000000000000000060648201526084016107f0565b73ffffffffffffffffffffffffffffffffffffffff831660008181526002602090815260408083208686039055600480548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b600081815260018301602052604081205461210957508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610683565b506000610683565b600081815260018301602052604081205480156121fa576000612135600183612721565b855490915060009061214990600190612721565b90508181146121ae576000866000018281548110612169576121696126f2565b906000526020600020015490508087600001848154811061218c5761218c6126f2565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806121bf576121bf612734565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610683565b6000915050610683565b6000612266826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166122f99092919063ffffffff16565b905080516000148061228757508080602001905181019061228791906127b5565b611cdc5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016107f0565b60606111fe8484600085856000808673ffffffffffffffffffffffffffffffffffffffff16858760405161232d91906127d2565b60006040518083038185875af1925050503d806000811461236a576040519150601f19603f3d011682016040523d82523d6000602084013e61236f565b606091505b50915091506123808783838761238b565b979650505050505050565b606083156124075782516000036124005773ffffffffffffffffffffffffffffffffffffffff85163b6124005760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107f0565b50816111fe565b6111fe838381511561241c5781518083602001fd5b8060405162461bcd60e51b81526004016107f0919061245a565b60005b83811015612451578181015183820152602001612439565b50506000910152565b6020815260008251806020840152612479816040850160208701612436565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b803573ffffffffffffffffffffffffffffffffffffffff811681146124cf57600080fd5b919050565b600080604083850312156124e757600080fd5b6124f0836124ab565b946020939093013593505050565b60006020828403121561251057600080fd5b611454826124ab565b60008060006060848603121561252e57600080fd5b612537846124ab565b9250612545602085016124ab565b9150604084013590509250925092565b60006020828403121561256757600080fd5b5035919050565b6000806040838503121561258157600080fd5b82359150612591602084016124ab565b90509250929050565b600080604083850312156125ad57600080fd5b50508035926020909101359150565b80151581146108b657600080fd5b600080604083850312156125dd57600080fd5b6125e6836124ab565b915060208301356125f6816125bc565b809150509250929050565b6000806000806080858703121561261757600080fd5b5050823594602084013594506040840135936060013592509050565b6000806040838503121561264657600080fd5b61264f836124ab565b9150612591602084016124ab565b600181811c9082168061267157607f821691505b6020821081036126aa577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115610683576106836126b0565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b81810381811115610683576106836126b0565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b8082028115828204841417610683576106836126b0565b6000826127b0577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000602082840312156127c757600080fd5b8151611454816125bc565b600082516127e4818460208701612436565b919091019291505056fea26469706673582212206f588e0b6f584d266ba77f6b14d60d43038904c7ec2707d9f09fd5f50e37739364736f6c63430008130033000000000000000000000000c0325d58a15321b0c54c8624a2f4cb695bb7af2a
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061025c5760003560e01c80638908365411610145578063c4b10766116100bd578063da1ce4d01161008c578063e3a2950b11610071578063e3a2950b146105b8578063e9ed87f8146105c1578063f2fde38b146105ca57600080fd5b8063da1ce4d01461055f578063dd62ed3e1461057257600080fd5b8063c4b1076614610510578063ca61329214610519578063cc6c54231461052c578063d9abf55c1461053f57600080fd5b8063a3908e1b11610114578063a9059cbb116100f9578063a9059cbb146104b4578063aff6cbf1146104c7578063b90c2b52146104da57600080fd5b8063a3908e1b1461048e578063a457c2d7146104a157600080fd5b8063890836541461041f5780638da5cb5b146104325780638e193e801461045057806395d89b411461048657600080fd5b806339509351116101d85780635a1d34dc116101a757806370a082311161018c57806370a08231146103ce578063715018a6146104045780637cbc23731461040c57600080fd5b80635a1d34dc146103b3578063619ac95b146103c657600080fd5b8063395093511461034a5780634b359d381461035d5780634f62b7ec14610370578063539ffb771461039e57600080fd5b80631c3526791161022f57806323b872dd1161021457806323b872dd146102dc578063313ce567146102ef57806338fbd533146102fe57600080fd5b80631c352679146102c05780631eee7e60146102c957600080fd5b806306fdde0314610261578063095ea7b31461027f578063161aab43146102a257806318160ddd146102b8575b600080fd5b6102696105dd565b604051610276919061245a565b60405180910390f35b61029261028d3660046124d4565b61066f565b6040519015158152602001610276565b6102aa610689565b604051908152602001610276565b6004546102aa565b6102aa60095481565b6102926102d73660046124fe565b61069a565b6102926102ea366004612519565b6106a7565b60405160128152602001610276565b6103257f000000000000000000000000c0325d58a15321b0c54c8624a2f4cb695bb7af2a81565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610276565b6102926103583660046124d4565b6106cb565b61032561036b366004612555565b610717565b61038361037e3660046124d4565b610724565b60408051938452602084019290925290820152606001610276565b6103b16103ac366004612555565b610766565b005b6103b16103c136600461256e565b6108b9565b6102aa606481565b6102aa6103dc3660046124fe565b73ffffffffffffffffffffffffffffffffffffffff1660009081526002602052604090205490565b6103b1610926565b6103b161041a36600461259a565b61093a565b6103b161042d3660046125ca565b610b0b565b60005473ffffffffffffffffffffffffffffffffffffffff16610325565b6102aa61045e3660046124fe565b73ffffffffffffffffffffffffffffffffffffffff166000908152600d602052604090205490565b610269610c16565b6103b161049c366004612555565b610c25565b6102926104af3660046124d4565b610c40565b6102926104c23660046124d4565b610cf7565b6103b16104d5366004612555565b610d05565b6102aa6104e83660046124fe565b73ffffffffffffffffffffffffffffffffffffffff166000908152600e602052604090205490565b6102aa600b5481565b6103b1610527366004612601565b610e7e565b61038361053a3660046124d4565b61104a565b6102aa61054d3660046124fe565b600d6020526000908152604090205481565b6102aa61056d36600461259a565b611152565b6102aa610580366004612633565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260036020908152604080832093909416825291909152205490565b6102aa600a5481565b6102aa600c5481565b6103b16105d83660046124fe565b611206565b6060600580546105ec9061265d565b80601f01602080910402602001604051908101604052809291908181526020018280546106189061265d565b80156106655780601f1061063a57610100808354040283529160200191610665565b820191906000526020600020905b81548152906001019060200180831161064857829003601f168201915b5050505050905090565b60003361067d8185856112a0565b60019150505b92915050565b6000610695600761141f565b905090565b6000610683600783611429565b6000336106b585828561145b565b6106c0858585611518565b506001949350505050565b33600081815260036020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919061067d90829086906107129087906126df565b6112a0565b600061068360078361174b565b600e602052816000526040600020818154811061074057600080fd5b600091825260209091206003909102018054600182015460029092015490935090915083565b61076e611757565b336000818152600e6020526040902054829081106107f95760405162461bcd60e51b815260206004820152602b60248201527f76616c696461746552656465656d3a2072656465656d20656e74727920646f6560448201527f73206e6f7420657869737400000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336000908152600d60209081526040808320600e9092528220805491929186908110610827576108276126f2565b90600052602060002090600302019050610852816001015483600001546117b090919063ffffffff16565b825560018101546108669030903390611518565b600181015460405190815233907f56d7520e387607a8daa892e3fed116badc2a636307bdc794b1c1aed97ae203f49060200160405180910390a26108a9856117bc565b505050506108b660018055565b50565b6108c1611757565b333b61090f5760405162461bcd60e51b815260206004820152601660248201527f636f6e76657274546f3a206e6f7420616c6c6f7765640000000000000000000060448201526064016107f0565b61091982826118d5565b61092260018055565b5050565b61092e6119c2565b6109386000611a29565b565b610942611757565b600082116109b85760405162461bcd60e51b815260206004820152602260248201527f72656465656d3a20657355534d416d6f756e742063616e6e6f74206265206e7560448201527f6c6c00000000000000000000000000000000000000000000000000000000000060648201526084016107f0565b600b54811015610a0a5760405162461bcd60e51b815260206004820152601860248201527f72656465656d3a206475726174696f6e20746f6f206c6f77000000000000000060448201526064016107f0565b610a15333084611518565b336000908152600d6020526040812090610a2f8484611152565b604080518681526020810183905290810185905290915033907fbd5034ffbd47e4e72a94baa2cdb74c6fad73cb3bcdc13036b72ec8306f5a76469060600160405180910390a28215610af5578154610a879085611a9e565b8255336000908152600e60209081526040918290208251606081018452848152918201879052918101610aba4287611a9e565b905281546001818101845560009384526020938490208351600390930201918255928201519281019290925560400151600290910155610b00565b610b00338583611aaa565b505061092260018055565b610b136119c2565b3073ffffffffffffffffffffffffffffffffffffffff831603610b9e5760405162461bcd60e51b815260206004820152603b60248201527f7570646174655472616e7366657257686974656c6973743a2043616e6e6f742060448201527f72656d6f766520657355534d2066726f6d2077686974656c697374000000000060648201526084016107f0565b8015610bb557610baf600783611bfa565b50610bc2565b610bc0600783611c1c565b505b6040805173ffffffffffffffffffffffffffffffffffffffff8416815282151560208201527f3a34209cb941a5d23a56dea730a13738454bc7daefd4bb32e8d7df58c1bd920d910160405180910390a15050565b6060600680546105ec9061265d565b610c2d611757565b610c3781336118d5565b6108b660018055565b33600081815260036020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015610cea5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084016107f0565b6106c082868684036112a0565b60003361067d818585611518565b610d0d611757565b336000818152600e602052604090205482908110610d935760405162461bcd60e51b815260206004820152602b60248201527f76616c696461746552656465656d3a2072656465656d20656e74727920646f6560448201527f73206e6f7420657869737400000000000000000000000000000000000000000060648201526084016107f0565b336000908152600d60209081526040808320600e9092528220805491929186908110610dc157610dc16126f2565b906000526020600020906003020190508060020154610ddd4290565b1015610e515760405162461bcd60e51b815260206004820152603260248201527f66696e616c697a6552656465656d3a2076657374696e67206475726174696f6e60448201527f20686173206e6f7420656e64656420796574000000000000000000000000000060648201526084016107f0565b60018101548254610e61916117b0565b825560018101548154610e75913391611aaa565b6108a9856117bc565b610e866119c2565b82841115610efc5760405162461bcd60e51b815260206004820152602860248201527f75706461746552656465656d53657474696e67733a2077726f6e67207261746960448201527f6f2076616c75657300000000000000000000000000000000000000000000000060648201526084016107f0565b808210610f715760405162461bcd60e51b815260206004820152602b60248201527f75706461746552656465656d53657474696e67733a2077726f6e67206475726160448201527f74696f6e2076616c75657300000000000000000000000000000000000000000060648201526084016107f0565b6064831115610fe85760405162461bcd60e51b815260206004820152602860248201527f75706461746552656465656d53657474696e67733a2077726f6e67207261746960448201527f6f2076616c75657300000000000000000000000000000000000000000000000060648201526084016107f0565b6009849055600a839055600b829055600c8190556040805185815260208101859052908101839052606081018290527ff282865353a487a40c4983b3a1a4e8901e81cb5605f653e6352dc57cdb5744889060800160405180910390a150505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600e6020526040812054819081908590859081106110ec5760405162461bcd60e51b815260206004820152602b60248201527f76616c696461746552656465656d3a2072656465656d20656e74727920646f6560448201527f73206e6f7420657869737400000000000000000000000000000000000000000060648201526084016107f0565b73ffffffffffffffffffffffffffffffffffffffff87166000908152600e60205260408120805488908110611123576111236126f2565b906000526020600020906003020190508060000154816001015482600201549550955095505050509250925092565b6000600b5482101561116657506000610683565b600c5482111561119757611190606461118a600a5486611c3e90919063ffffffff16565b90611c4a565b9050610683565b60006111ed6111e46111b6600b54600c546117b090919063ffffffff16565b61118a6111d0600954600a546117b090919063ffffffff16565b600b546111de9089906117b0565b90611c3e565b60095490611a9e565b90506111fe606461118a8684611c3e565b949350505050565b61120e6119c2565b73ffffffffffffffffffffffffffffffffffffffff81166112975760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016107f0565b6108b681611a29565b73ffffffffffffffffffffffffffffffffffffffff83166113285760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016107f0565b73ffffffffffffffffffffffffffffffffffffffff82166113b15760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016107f0565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000610683825490565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260018301602052604081205415155b9392505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600360209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461151257818110156115055760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016107f0565b61151284848484036112a0565b50505050565b73ffffffffffffffffffffffffffffffffffffffff83166115a15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016107f0565b73ffffffffffffffffffffffffffffffffffffffff821661162a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016107f0565b611635838383611c56565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040902054818110156116d15760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e6365000000000000000000000000000000000000000000000000000060648201526084016107f0565b73ffffffffffffffffffffffffffffffffffffffff80851660008181526002602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061173e9086815260200190565b60405180910390a3611512565b60006114548383611ce1565b6002600154036117a95760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016107f0565b6002600155565b60006114548284612721565b336000908152600e6020526040902080546117d990600190612721565b815481106117e9576117e96126f2565b9060005260206000209060030201600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208281548110611847576118476126f2565b600091825260208083208454600390930201918255600180850154908301556002938401549390910192909255338152600e9091526040902080548061188f5761188f612734565b60008281526020812060037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff909301928302018181556001810182905560020155905550565b816000036119255760405162461bcd60e51b815260206004820152601e60248201527f636f6e766572743a20616d6f756e742063616e6e6f74206265206e756c6c000060448201526064016107f0565b61192f8183611d0b565b6040805173ffffffffffffffffffffffffffffffffffffffff831681526020810184905233917fccfaeb3043a96a967dc036ab72e078a9632af809671bc2a1ac30a8043645f89e910160405180910390a261092273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c0325d58a15321b0c54c8624a2f4cb695bb7af2a16333085611df2565b60005473ffffffffffffffffffffffffffffffffffffffff1633146109385760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107f0565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600061145482846126df565b6000611ab683836117b0565b9050611af973ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c0325d58a15321b0c54c8624a2f4cb695bb7af2a168584611ece565b6040517f42966c68000000000000000000000000000000000000000000000000000000008152600481018290527f000000000000000000000000c0325d58a15321b0c54c8624a2f4cb695bb7af2a73ffffffffffffffffffffffffffffffffffffffff16906342966c6890602401600060405180830381600087803b158015611b8157600080fd5b505af1158015611b95573d6000803e3d6000fd5b50505050611ba33084611f24565b604080518481526020810184905273ffffffffffffffffffffffffffffffffffffffff8616917f0da072ebd7a5649099f43a3776eb0cda17aca79426ee9f28aae203f5dfa04eda910160405180910390a250505050565b60006114548373ffffffffffffffffffffffffffffffffffffffff84166120c2565b60006114548373ffffffffffffffffffffffffffffffffffffffff8416612111565b60006114548284612763565b6000611454828461277a565b73ffffffffffffffffffffffffffffffffffffffff83161580611c7f5750611c7f600784611429565b80611c905750611c90600783611429565b611cdc5760405162461bcd60e51b815260206004820152601560248201527f7472616e736665723a206e6f7420616c6c6f776564000000000000000000000060448201526064016107f0565b505050565b6000826000018281548110611cf857611cf86126f2565b9060005260206000200154905092915050565b73ffffffffffffffffffffffffffffffffffffffff8216611d6e5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016107f0565b611d7a60008383611c56565b8060046000828254611d8c91906126df565b909155505073ffffffffffffffffffffffffffffffffffffffff82166000818152600260209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526115129085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612204565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052611cdc9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611e4c565b73ffffffffffffffffffffffffffffffffffffffff8216611fad5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016107f0565b611fb982600083611c56565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260026020526040902054818110156120555760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f636500000000000000000000000000000000000000000000000000000000000060648201526084016107f0565b73ffffffffffffffffffffffffffffffffffffffff831660008181526002602090815260408083208686039055600480548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b600081815260018301602052604081205461210957508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610683565b506000610683565b600081815260018301602052604081205480156121fa576000612135600183612721565b855490915060009061214990600190612721565b90508181146121ae576000866000018281548110612169576121696126f2565b906000526020600020015490508087600001848154811061218c5761218c6126f2565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806121bf576121bf612734565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610683565b6000915050610683565b6000612266826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166122f99092919063ffffffff16565b905080516000148061228757508080602001905181019061228791906127b5565b611cdc5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016107f0565b60606111fe8484600085856000808673ffffffffffffffffffffffffffffffffffffffff16858760405161232d91906127d2565b60006040518083038185875af1925050503d806000811461236a576040519150601f19603f3d011682016040523d82523d6000602084013e61236f565b606091505b50915091506123808783838761238b565b979650505050505050565b606083156124075782516000036124005773ffffffffffffffffffffffffffffffffffffffff85163b6124005760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107f0565b50816111fe565b6111fe838381511561241c5781518083602001fd5b8060405162461bcd60e51b81526004016107f0919061245a565b60005b83811015612451578181015183820152602001612439565b50506000910152565b6020815260008251806020840152612479816040850160208701612436565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b803573ffffffffffffffffffffffffffffffffffffffff811681146124cf57600080fd5b919050565b600080604083850312156124e757600080fd5b6124f0836124ab565b946020939093013593505050565b60006020828403121561251057600080fd5b611454826124ab565b60008060006060848603121561252e57600080fd5b612537846124ab565b9250612545602085016124ab565b9150604084013590509250925092565b60006020828403121561256757600080fd5b5035919050565b6000806040838503121561258157600080fd5b82359150612591602084016124ab565b90509250929050565b600080604083850312156125ad57600080fd5b50508035926020909101359150565b80151581146108b657600080fd5b600080604083850312156125dd57600080fd5b6125e6836124ab565b915060208301356125f6816125bc565b809150509250929050565b6000806000806080858703121561261757600080fd5b5050823594602084013594506040840135936060013592509050565b6000806040838503121561264657600080fd5b61264f836124ab565b9150612591602084016124ab565b600181811c9082168061267157607f821691505b6020821081036126aa577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115610683576106836126b0565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b81810381811115610683576106836126b0565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b8082028115828204841417610683576106836126b0565b6000826127b0577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000602082840312156127c757600080fd5b8151611454816125bc565b600082516127e4818460208701612436565b919091019291505056fea26469706673582212206f588e0b6f584d266ba77f6b14d60d43038904c7ec2707d9f09fd5f50e37739364736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000c0325d58a15321b0c54c8624a2f4cb695bb7af2a
-----Decoded View---------------
Arg [0] : _usmToken (address): 0xC0325d58A15321b0C54c8624A2F4cB695Bb7AF2A
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000c0325d58a15321b0c54c8624a2f4cb695bb7af2a
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.