Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00Latest 5 from a total of 5 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Safe Transfer Fr... | 404291314 | 59 days ago | IN | 0 ETH | 0.00000025 | ||||
| Safe Transfer Fr... | 404285010 | 60 days ago | IN | 0 ETH | 0.00000025 | ||||
| Safe Transfer Fr... | 404284090 | 60 days ago | IN | 0 ETH | 0.00000025 | ||||
| Safe Transfer Fr... | 404283894 | 60 days ago | IN | 0 ETH | 0.00000025 | ||||
| Safe Transfer Fr... | 404283878 | 60 days ago | IN | 0 ETH | 0.00000025 |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
Fiat24Account
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
Yes with 1 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
import "./F24.sol";
import "./Fiat24PriceList.sol";
import "./interfaces/IF24Sales.sol";
import "./libraries/DigitsOfUint.sol";
contract Fiat24Account is ERC721EnumerableUpgradeable, ERC721PausableUpgradeable, AccessControlUpgradeable {
using DigitsOfUint for uint256;
using SafeERC20Upgradeable for IERC20Upgradeable;
bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE");
bytes32 public constant LIMITUPDATER_ROLE = keccak256("LIMITUPDATER_ROLE");
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant CLIENTSTATUSCHANGE_ROLE = keccak256("CLIENTSTATUSCHANGE_ROLE");
uint256 public constant DEFAULT_MERCHANT_RATE = 55;
enum Status { Na, SoftBlocked, Tourist, Blocked, Closed, Live }
struct WalletProvider {
string walletProvider;
bool isAvailable;
}
uint8 public constant MERCHANTDIGIT = 8;
uint8 public constant INTERNALDIGIT = 9;
struct Limit {
uint256 usedLimit;
uint256 clientLimit;
uint256 startLimitDate;
}
uint256 public constant LIMITLIVEDEFAULT = 100000;
uint256 public limitTourist;
uint256 public constant THIRTYDAYS = 2592000;
mapping (address => uint256) public historicOwnership;
mapping (uint256 => string) public nickNames;
mapping (uint256 => bool) public isMerchant;
mapping (uint256 => uint256) public merchantRate;
mapping (uint256 => Status) public status;
mapping (uint256 => Limit) public limit;
uint8 public minDigitForSale; //maxDigitForMint
uint8 public maxDigitForSale;
F24 f24;
Fiat24PriceList fiat24PriceList;
bool f24IsActive;
mapping (uint256 => uint256) public walletProvider;
mapping (uint256 => WalletProvider) public walletProviderMap;
mapping (uint256 => string) public nftAvatar;
mapping (uint256 => uint256) public oldTokenId;
address public F24SalesAddress;
event activatedWithReferral(uint256 indexed tokenId, uint256 indexed referrer);
function initialize() public initializer {
__Context_init_unchained();
__ERC721_init_unchained("Fiat24 Account", "Fiat24");
__AccessControl_init_unchained();
minDigitForSale = 5;
maxDigitForSale = 5;
f24IsActive = false;
limitTourist = 100000;
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(OPERATOR_ROLE, _msgSender());
}
function mint(address _to, uint256 _tokenId) public {
require(hasRole(OPERATOR_ROLE, msg.sender) || hasRole(MINTER_ROLE, msg.sender), "Not an operator/minter");
require(_mintAllowed(_to, _tokenId), "mint not allowed");
_mint(_to, _tokenId);
status[_tokenId] = Status.Tourist;
initilizeTouristLimit(_tokenId);
nickNames[_tokenId] = string(abi.encodePacked("Account ", StringsUpgradeable.toString(_tokenId)));
}
function mintByClient(uint256 _tokenId) external {
_mintByClient(_tokenId);
uint256 accountPrice = fiat24PriceList.getPrice(_tokenId);
f24.burnFrom(_msgSender(), accountPrice);
}
function mintByClientWithETH(uint256 _tokenId) external payable {
_mintByClient(_tokenId);
uint256 accountPrice = fiat24PriceList.getPrice(_tokenId);
uint256 priceETH;
uint256 quotePerETH = IF24Sales(F24SalesAddress).quotePerEther();
if(quotePerETH < accountPrice) {
priceETH = (accountPrice / quotePerETH) * 10**18;
} else {
priceETH = 10**18 / (quotePerETH / accountPrice);
}
require(msg.value >= priceETH, "Not sufficient msg.value for F24 purchase");
uint256 f24Amount = IF24Sales(F24SalesAddress).buy{value: msg.value}();
f24.burn(accountPrice);
uint256 f24Diff = f24Amount - accountPrice;
if(f24Diff > 0) {
f24.transfer(_msgSender(), f24Diff);
}
}
function _mintByClient(uint256 _tokenId) internal {
require(f24IsActive, "F24 is inactive");
require(!_tokenId.hasFirstDigit(INTERNALDIGIT), "9xx cannot be mint by client");
require(_tokenId.numDigits() <= maxDigitForSale, "Number of digits of accountId > max. digits");
require(_mintAllowed(_msgSender(), _tokenId), "Not allowed. The address has/had another NFT.");
_mint(_msgSender(), _tokenId);
status[_tokenId] = Status.Tourist;
initilizeTouristLimit(_tokenId);
nickNames[_tokenId] = string(abi.encodePacked("Account ", StringsUpgradeable.toString(_tokenId)));
}
function mintByWallet(address to, uint256 _tokenId) external {
require(this.balanceOf(_msgSender()) > 0, "Minting address has no account");
uint256 minterTokenId = this.tokenOfOwnerByIndex(_msgSender(), 0);
require(minterTokenId.hasFirstDigit(MERCHANTDIGIT) && (minterTokenId >= 8 && minterTokenId <= 8999), "Incorrect account id for wallet");
require(walletProviderMap[minterTokenId].isAvailable, "Account not wallet provider");
require(_tokenId.numDigits() >= 5, "mintByWallet only for 5+ digits tokens");
require(_tokenId.numDigits() <= maxDigitForSale, "Number of digits of accountId > max. digits");
require(!_tokenId.hasFirstDigit(INTERNALDIGIT), "9xx cannot be mint by client");
require(!_tokenId.hasFirstDigit(MERCHANTDIGIT),"Merchant account cannot be minted by wallet");
require(_mintAllowed(to, _tokenId),
"Not allowed. The target address has an account or once had another account.");
walletProvider[_tokenId] = minterTokenId;
status[_tokenId] = Status.Tourist;
_mint(to, _tokenId);
f24.burnFrom(_msgSender(), 100);
}
function upgradeWithF24(uint256 _tokenId) external {
uint256 _oldTokenId = this.tokenOfOwnerByIndex(_msgSender(), 0);
require(status[_oldTokenId] == Status.Live, "Not Live client");
require(f24IsActive, "This function is inactive");
require(_tokenId.numDigits() < 5 , "Only premium number for upgrade");
require(!_tokenId.hasFirstDigit(INTERNALDIGIT), "Internal accountId cannot be mint by client");
if(_tokenId.hasFirstDigit(MERCHANTDIGIT)) {
require(_oldTokenId.hasFirstDigit(MERCHANTDIGIT), "Old token must be a merchant");
}
if(_oldTokenId.hasFirstDigit(MERCHANTDIGIT)) {
require(_tokenId.hasFirstDigit(MERCHANTDIGIT), "New token must be a merchant");
}
uint256 accountPrice = fiat24PriceList.getPrice(_tokenId);
require(accountPrice != 0, "AccountId not available for sale");
status[_oldTokenId] = Status.Closed;
_transfer(ownerOf(_oldTokenId), ownerOf(9106), _oldTokenId);
_mint(_msgSender(), _tokenId);
status[_tokenId] = Status.Live;
historicOwnership[_msgSender()] = _tokenId;
walletProvider[_tokenId] = walletProvider[_oldTokenId];
Limit storage limitOld = limit[_oldTokenId];
Limit storage limitNew = limit[_tokenId];
limitNew.clientLimit = limitOld.clientLimit;
limitNew.usedLimit = limitOld.usedLimit;
limitNew.startLimitDate = limitOld.startLimitDate;
oldTokenId[_tokenId] = _oldTokenId;
f24.burnFrom(_msgSender(), accountPrice);
}
function burn(uint256 tokenId) public {
require(hasRole(OPERATOR_ROLE, msg.sender), "Not an operator");
delete limit[tokenId];
_burn(tokenId);
}
function transferFrom(address from, address to, uint256 tokenId) public virtual override (ERC721Upgradeable, IERC721Upgradeable) {
super.transferFrom(from, to, tokenId);
if(status[tokenId] != Status.Tourist) {
historicOwnership[to] = tokenId;
}
}
function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override (ERC721Upgradeable, IERC721Upgradeable) {
super.safeTransferFrom(from, to, tokenId);
if(status[tokenId] != Status.Tourist) {
historicOwnership[to] = tokenId;
}
}
function exists(uint256 tokenId) public view returns(bool) {
return _exists(tokenId);
}
function removeHistoricOwnership(address owner) external {
require(hasRole(OPERATOR_ROLE, msg.sender), "Not an operator");
delete historicOwnership[owner];
}
function changeClientStatus(uint256 tokenId, Status _status) external {
require(hasRole(OPERATOR_ROLE, msg.sender) || hasRole(CLIENTSTATUSCHANGE_ROLE, msg.sender), "Not an operator/clientstatuschange");
if(_status == Status.Live && status[tokenId] == Status.Tourist) {
historicOwnership[this.ownerOf(tokenId)] = tokenId;
initializeLiveLimit(tokenId);
}
status[tokenId] = _status;
}
function close(uint256 tokenId) external {
require(_msgSender() == this.ownerOf(tokenId), "Not account owner");
require(status[tokenId] == Status.Live, "Not live client");
status[tokenId] = Status.Closed;
}
function activateWithReferral(uint256 tokenId, uint256 referrer) external {
require(hasRole(OPERATOR_ROLE, msg.sender) || hasRole(CLIENTSTATUSCHANGE_ROLE, msg.sender), "Not an operator/clientstatuschange");
require(status[tokenId] == Status.Tourist, "Not Tourist");
historicOwnership[this.ownerOf(tokenId)] = tokenId;
initializeLiveLimit(tokenId);
status[tokenId] = Status.Live;
address treasury = this.ownerOf(9100);
// ARB Mainnet
address arbAddress = 0x912CE59144191C1204E64559FE8253a0e49E6548;
//F24 Sepolia
//address arbAddress = 0x9f4950dedBBE79E2BAD0a5807D25A5A1482d101B;
// //ARB Mainnet
uint256 decimals = 10**18;
//F24 Sepolia
//uint256 decimals = 10**2;
// Only send ARB when treasury has sufficient ARB and Referrer is in Live status
if (IERC20Upgradeable(arbAddress).balanceOf(treasury) >= 20 * decimals && this.status(referrer) == Status.Live) {
IERC20Upgradeable(arbAddress).safeTransferFrom(treasury, this.ownerOf(referrer), 15 * decimals);
IERC20Upgradeable(arbAddress).safeTransferFrom(treasury, this.ownerOf(tokenId), 5 * decimals);
}
emit activatedWithReferral(tokenId, referrer);
}
function setMinDigitForSale(uint8 minDigit) external {
require(hasRole(OPERATOR_ROLE, msg.sender), "Not an operator");
minDigitForSale = minDigit;
}
function setMaxDigitForSale(uint8 maxDigit) external {
require(hasRole(OPERATOR_ROLE, msg.sender), "Not an operator");
maxDigitForSale = maxDigit;
}
function setMerchantRate(uint256 tokenId, uint256 _merchantRate) external {
require(hasRole(OPERATOR_ROLE, msg.sender), "Not an operator");
merchantRate[tokenId] = _merchantRate;
}
function initilizeTouristLimit(uint256 tokenId) private {
Limit storage limit_ = limit[tokenId];
limit_.usedLimit = 0;
limit_.startLimitDate = block.timestamp;
}
function initializeLiveLimit(uint256 tokenId) private {
Limit storage limit_ = limit[tokenId];
limit_.usedLimit = 0;
limit_.clientLimit = LIMITLIVEDEFAULT;
limit_.startLimitDate = block.timestamp;
}
function setClientLimit(uint256 tokenId, uint256 clientLimit) external {
require(hasRole(CLIENTSTATUSCHANGE_ROLE, msg.sender) || hasRole(OPERATOR_ROLE, msg.sender), "Not an operator");
require(_exists(tokenId), "Token does not exist");
require(status[tokenId] != Status.Tourist && status[tokenId] != Status.Na, "Not in correct status for limit control");
Limit storage limit_ = limit[tokenId];
limit_.clientLimit = clientLimit;
}
function resetUsedLimit(uint256 tokenId) external {
require(hasRole(OPERATOR_ROLE, msg.sender), "Not an operator");
require(_exists(tokenId), "Token does not exist");
Limit storage limit_ = limit[tokenId];
limit_.usedLimit = 0;
}
function setTouristLimit(uint256 newLimitTourist) external {
require(hasRole(OPERATOR_ROLE, msg.sender), "Not an operator");
limitTourist = newLimitTourist;
}
function checkLimit(uint256 tokenId, uint256 amount) external view returns(bool) {
if(_exists(tokenId)) {
if(tokenId >= 9100 && tokenId <= 9299) {
return true;
}
Limit storage limit_ = limit[tokenId];
uint256 lastLimitPeriodEnd = limit_.startLimitDate + THIRTYDAYS;
if(status[tokenId] == Status.Tourist) {
return (lastLimitPeriodEnd < block.timestamp && amount <= limitTourist)
|| (lastLimitPeriodEnd >= block.timestamp && (limit_.usedLimit + amount) <= limitTourist);
} else {
return (lastLimitPeriodEnd < block.timestamp && amount <= limit_.clientLimit)
|| (lastLimitPeriodEnd >= block.timestamp && (limit_.usedLimit + amount) <= limit_.clientLimit);
}
} else {
return false;
}
}
function updateLimit(uint256 tokenId, uint256 amount) external {
require(hasRole(LIMITUPDATER_ROLE, msg.sender), "Not a limit-updater");
if(tokenId >= 9100 && tokenId <= 9299) {
return;
}
if(status[tokenId] == Status.Live || status[tokenId] == Status.Tourist) {
Limit storage limit_ = limit[tokenId];
uint256 lastLimitPeriodEnd = limit_.startLimitDate + THIRTYDAYS;
if(lastLimitPeriodEnd < block.timestamp) {
limit_.startLimitDate = block.timestamp;
limit_.usedLimit = amount;
} else {
limit_.usedLimit += amount;
}
}
}
function setNickname(uint256 tokenId, string memory nickname) public {
require(_msgSender() == this.ownerOf(tokenId), "Not account owner");
nickNames[tokenId] = nickname;
}
function activateF24(address f24Address, address fiat24PriceListAddress) external {
require(hasRole(OPERATOR_ROLE, msg.sender), "Not an operator");
f24 = F24(f24Address);
fiat24PriceList = Fiat24PriceList(fiat24PriceListAddress);
f24IsActive = true;
}
function setF24SalesAddress(address _f24SalesAddress) external {
require(hasRole(OPERATOR_ROLE, msg.sender), "Not an operator");
F24SalesAddress = _f24SalesAddress;
}
function addWalletProvider(uint256 number, string memory name) external {
require(hasRole(OPERATOR_ROLE, msg.sender), "Not an operator");
walletProviderMap[number].walletProvider = name;
walletProviderMap[number].isAvailable = true;
}
function removeWalletProvider(uint256 number) external {
require(hasRole(OPERATOR_ROLE, msg.sender), "Not an operator");
delete walletProviderMap[number];
}
function setNftAvatar(string memory url) external {
require(this.balanceOf(_msgSender()) > 0, "Address has no account");
uint256 tokenId = this.tokenOfOwnerByIndex(_msgSender(), 0);
nftAvatar[tokenId] = url;
}
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
string memory uriStatusParam = _uriStatusParam();
string memory uriWalletParam = _uriWalletParam();
return bytes(baseURI).length > 0
? string(abi.encodePacked(baseURI, StringsUpgradeable.toString(tokenId), uriStatusParam, StringsUpgradeable.toString(uint256(status[tokenId])), uriWalletParam, StringsUpgradeable.toString(walletProvider[tokenId])))
: "";
}
function _baseURI() internal view virtual override returns (string memory) {
return 'https://api.defi.saphirstein.com/metadata?tokenid=';
}
function _uriStatusParam() internal pure returns (string memory) {
return '&status=';
}
function _uriWalletParam() internal pure returns (string memory) {
return '&wallet=';
}
function supportsInterface(bytes4 interfaceId) public view virtual override(AccessControlUpgradeable, ERC721Upgradeable, ERC721EnumerableUpgradeable) returns (bool) {
return
interfaceId == type(IERC721Upgradeable).interfaceId ||
interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||
super.supportsInterface(interfaceId);
}
function pause() public {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Not an admin");
_pause();
}
function unpause() public {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Not an admin");
_unpause();
}
function _mintAllowed(address to, uint256 tokenId) internal view returns(bool){
return (this.balanceOf(to) < 1 && (historicOwnership[to] == 0 || historicOwnership[to] == tokenId));
}
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override(ERC721EnumerableUpgradeable, ERC721PausableUpgradeable) {
require(!paused(), "Account transfers suspended");
if(AddressUpgradeable.isContract(to) && (from != address(0))) {
require(this.status(tokenId) == Status.Tourist, "Not allowed to transfer account");
} else {
if((from != address(0) && to != address(0))) {
if(_exists(9106)){
require((balanceOf(to) < 1 && (historicOwnership[to] == 0 || historicOwnership[to] == tokenId)) || (tokenOfOwnerByIndex(to, 0) == 9106 && this.status(tokenId) == Status.Closed),
"Not allowed. The target address has an account or once had another account.");
require((this.status(tokenId) == Status.Live || this.status(tokenId) == Status.Tourist) || (balanceOf(to) > 0 && tokenOfOwnerByIndex(to, 0) == 9106 && this.status(tokenId) == Status.Closed),
"Transfer not allowed in this status");
} else {
require(balanceOf(to) < 1 && (historicOwnership[to] == 0 || historicOwnership[to] == tokenId),
"Not allowed. The target address has an account or once had another account.");
require(this.status(tokenId) == Status.Live || this.status(tokenId) == Status.Tourist,
"Transfer not allowed in this status");
}
}
}
super._beforeTokenTransfer(from, to, tokenId);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Library for managing an enumerable variant of Solidity's
* https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
* type.
*
* Maps have the following properties:
*
* - Entries are added, removed, and checked for existence in constant time
* (O(1)).
* - Entries are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableMap for EnumerableMap.UintToAddressMap;
*
* // Declare a set state variable
* EnumerableMap.UintToAddressMap private myMap;
* }
* ```
*
* As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are
* supported.
*/
library EnumerableUintToUintMapUpgradeable {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Map type with
// bytes32 keys and values.
// The Map implementation uses private functions, and user-facing
// implementations (such as Uint256ToAddressMap) are just wrappers around
// the underlying Map.
// This means that we can only create new EnumerableMaps for types that fit
// in bytes32.
struct MapEntry {
bytes32 _key;
bytes32 _value;
}
struct Map {
// Storage of map keys and values
MapEntry[] _entries;
// Position of the entry defined by a key in the `entries` array, plus 1
// because index 0 means a key is not in the map.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Adds a key-value pair to a map, or updates the value for an existing
* key. O(1).
*
* Returns true if the key was added to the map, that is if it was not
* already present.
*/
function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) {
// We read and store the key's index to prevent multiple reads from the same storage slot
uint256 keyIndex = map._indexes[key];
if (keyIndex == 0) { // Equivalent to !contains(map, key)
map._entries.push(MapEntry({ _key: key, _value: value }));
// The entry is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
map._indexes[key] = map._entries.length;
return true;
} else {
map._entries[keyIndex - 1]._value = value;
return false;
}
}
/**
* @dev Removes a key-value pair from a map. O(1).
*
* Returns true if the key was removed from the map, that is if it was present.
*/
function _remove(Map storage map, bytes32 key) private returns (bool) {
// We read and store the key's index to prevent multiple reads from the same storage slot
uint256 keyIndex = map._indexes[key];
if (keyIndex != 0) { // Equivalent to contains(map, key)
// To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one
// in the array, and then remove the last entry (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = keyIndex - 1;
uint256 lastIndex = map._entries.length - 1;
// When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
MapEntry storage lastEntry = map._entries[lastIndex];
// Move the last entry to the index where the entry to delete is
map._entries[toDeleteIndex] = lastEntry;
// Update the index for the moved entry
map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved entry was stored
map._entries.pop();
// Delete the index for the deleted slot
delete map._indexes[key];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the key is in the map. O(1).
*/
function _contains(Map storage map, bytes32 key) private view returns (bool) {
return map._indexes[key] != 0;
}
/**
* @dev Returns the number of key-value pairs in the map. O(1).
*/
function _length(Map storage map) private view returns (uint256) {
return map._entries.length;
}
/**
* @dev Returns the key-value pair stored at position `index` in the map. O(1).
*
* Note that there are no guarantees on the ordering of entries inside the
* array, and it may change when more entries are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) {
require(map._entries.length > index, "EnumerableMap: index out of bounds");
MapEntry storage entry = map._entries[index];
return (entry._key, entry._value);
}
/**
* @dev Tries to returns the value associated with `key`. O(1).
* Does not revert if `key` is not in the map.
*/
function _tryGet(Map storage map, bytes32 key) private view returns (bool, bytes32) {
uint256 keyIndex = map._indexes[key];
if (keyIndex == 0) return (false, 0); // Equivalent to contains(map, key)
return (true, map._entries[keyIndex - 1]._value); // All indexes are 1-based
}
/**
* @dev Returns the value associated with `key`. O(1).
*
* Requirements:
*
* - `key` must be in the map.
*/
function _get(Map storage map, bytes32 key) private view returns (bytes32) {
uint256 keyIndex = map._indexes[key];
require(keyIndex != 0, "EnumerableMap: nonexistent key"); // Equivalent to contains(map, key)
return map._entries[keyIndex - 1]._value; // All indexes are 1-based
}
/**
* @dev Same as {_get}, with a custom error message when `key` is not in the map.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {_tryGet}.
*/
function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) {
uint256 keyIndex = map._indexes[key];
require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key)
return map._entries[keyIndex - 1]._value; // All indexes are 1-based
}
// UintToUintMap
struct UintToUintMap {
Map _inner;
}
/**
* @dev Adds a key-value pair to a map, or updates the value for an existing
* key. O(1).
*
* Returns true if the key was added to the map, that is if it was not
* already present.
*/
function set(UintToUintMap storage map, uint256 key, uint256 value) internal returns (bool) {
return _set(map._inner, bytes32(key), bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the key was removed from the map, that is if it was present.
*/
function remove(UintToUintMap storage map, uint256 key) internal returns (bool) {
return _remove(map._inner, bytes32(key));
}
/**
* @dev Returns true if the key is in the map. O(1).
*/
function contains(UintToUintMap storage map, uint256 key) internal view returns (bool) {
return _contains(map._inner, bytes32(key));
}
/**
* @dev Returns the number of elements in the map. O(1).
*/
function length(UintToUintMap storage map) internal view returns (uint256) {
return _length(map._inner);
}
/**
* @dev Returns the element 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(UintToUintMap storage map, uint256 index) internal view returns (uint256, uint256) {
(bytes32 key, bytes32 value) = _at(map._inner, index);
return (uint256(key), uint256(value));
}
/**
* @dev Tries to returns the value associated with `key`. O(1).
* Does not revert if `key` is not in the map.
*
* _Available since v3.4._
*/
function tryGet(UintToUintMap storage map, uint256 key) internal view returns (bool, uint256) {
(bool success, bytes32 value) = _tryGet(map._inner, bytes32(key));
return (success, uint256(value));
}
/**
* @dev Returns the value associated with `key`. O(1).
*
* Requirements:
*
* - `key` must be in the map.
*/
function get(UintToUintMap storage map, uint256 key) internal view returns (uint256) {
return uint256(_get(map._inner, bytes32(key)));
}
/**
* @dev Same as {get}, with a custom error message when `key` is not in the map.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryGet}.
*/
function get(UintToUintMap storage map, uint256 key, string memory errorMessage) internal view returns (uint256) {
return uint256(_get(map._inner, bytes32(key), errorMessage));
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
library DigitsOfUint {
using SafeMathUpgradeable for uint256;
function numDigits(uint256 _number) internal pure returns (uint256) {
uint256 number = _number;
uint256 digits = 0;
while (number != 0) {
number = number.div(10);
digits = digits.add(1);
}
return digits;
}
function hasFirstDigit(uint256 _accountId, uint _firstDigit) internal pure returns (bool) {
uint256 number = _accountId;
while (number >= 10) {
number = number.div(10);
}
return number == _firstDigit;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IF24Sales {
enum Status { Na, SoftBlocked, Tourist, Blocked, Closed, Live }
function quotePerEther() external view returns(uint256);
function buy() external payable returns(uint256);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "./libraries/EnumerableUintToUintMapUpgradeable.sol";
import "./libraries/DigitsOfUint.sol";
contract Fiat24PriceList is Initializable, AccessControlUpgradeable {
using DigitsOfUint for uint256;
uint8 public constant MERCHANTDIGIT = 8;
uint8 public constant MAXDIGITFORSALE = 5;
function initialize() public initializer {
__AccessControl_init_unchained();
}
function getPrice(uint256 accountNumber) external pure returns(uint256) {
bool merchantAccountId = accountNumber.hasFirstDigit(MERCHANTDIGIT);
// 1-8 => F24 1'500'000.00
if(accountNumber >= 1 && accountNumber <= 8) {
return 150000000;
// 10-89 => F24 150'000.00
} else if(accountNumber >= 10 && accountNumber <= 89) {
return 15000000;
// 100-899 => F24 15'000.00
} else if (accountNumber >= 100 && accountNumber <= 899) {
return 1500000;
// 1000-8999 => F24 1'500.00
} else if (accountNumber >= 1000 && accountNumber <= 8999) {
return 150000;
// account number of digits > 5 and merchant account => F24 500.00
} else if(merchantAccountId) {
return 50000;
// base cost for account number of digits >= 5 and non-merchant
} else {
return 100;
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "./Fiat24Account.sol";
contract F24 is ERC20, ERC20Permit, ERC20Votes, ERC20Pausable, ERC20Burnable, AccessControl {
using SafeMath for uint256;
bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE");
uint256 public maxSupply;
uint256 public airdropEndTime; // Timestamp
uint256 public airdropClaim;
mapping(uint256 => uint256) public claim;
Fiat24Account fiat24account;
constructor(address fiat24accountProxyAddress,
uint256 maxSupply_,
uint256 airdropTotal_,
uint256 airdropEndTime_,
uint256 airdropClaim_) ERC20("Fiat24", "F24") ERC20Permit("Fiat24") {
require(airdropTotal_ <= maxSupply_, "F24: Airdrop higher than max supply - free supply");
maxSupply = maxSupply_;
_mint(msg.sender, maxSupply_ - airdropTotal_);
_mint(address(this), airdropTotal_);
airdropEndTime = airdropEndTime_;
airdropClaim = airdropClaim_;
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
_setupRole(OPERATOR_ROLE, msg.sender);
fiat24account = Fiat24Account(fiat24accountProxyAddress);
}
function claimToken(uint256 tokenId) external {
require(block.timestamp <= airdropEndTime, "F24: Airdrop expired");
require(fiat24account.ownerOf(tokenId) == msg.sender ||
fiat24account.historicOwnership(msg.sender) == tokenId, "F24: Not owner of token");
require(fiat24account.status(tokenId) == Fiat24Account.Status.Live ||
fiat24account.status(tokenId) == Fiat24Account.Status.Tourist,"F24: Not Live or Tourist");
uint256 amount = eligibleClaimAmount(tokenId);
if(amount > 0) {
claim[tokenId] += amount;
_transfer(address(this), msg.sender, amount);
}
}
function eligibleClaimAmount(uint256 tokenId) public view returns(uint256) {
require(block.timestamp <= airdropEndTime, "F24: Airdrop expired");
uint256 amount = 0;
bool success = true;
if(fiat24account.exists(tokenId)) {
if(fiat24account.status(tokenId) == Fiat24Account.Status.Live ||
fiat24account.status(tokenId) == Fiat24Account.Status.Tourist ) {
(success, amount) = airdropClaim.trySub(claim[tokenId]);
}
} else {
success = false;
}
return success ? amount : 0;
}
function sweep(address dest) external {
require(hasRole(OPERATOR_ROLE, msg.sender), "F24: Not an operator");
require(block.timestamp > airdropEndTime, "F24: Claim period not yet ended");
_transfer(address(this), dest, balanceOf(address(this)));
}
function decimals() public view virtual override returns (uint8) {
return 2;
}
function _mint(address account, uint256 amount) internal virtual override(ERC20, ERC20Votes) {
super._mint(account, amount);
}
function _burn(address account, uint256 amount) internal virtual override(ERC20, ERC20Votes) {
super._burn(account, amount);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual override(ERC20, ERC20Pausable) {
super._beforeTokenTransfer(from, to, amount);
}
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual override(ERC20, ERC20Votes) {
super._afterTokenTransfer(from, to, amount);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 substraction 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 v4.4.1 (utils/math/SafeCast.sol)
pragma solidity ^0.8.0;
/**
* @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
* checks.
*
* Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
* easily result in undesired exploitation or bugs, since developers usually
* assume that overflows raise errors. `SafeCast` restores this intuition by
* reverting the transaction when such an operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*
* Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
* all math on `uint256` and `int256` and then downcasting.
*/
library SafeCast {
/**
* @dev Returns the downcasted uint224 from uint256, reverting on
* overflow (when the input is greater than largest uint224).
*
* Counterpart to Solidity's `uint224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*/
function toUint224(uint256 value) internal pure returns (uint224) {
require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits");
return uint224(value);
}
/**
* @dev Returns the downcasted uint128 from uint256, reverting on
* overflow (when the input is greater than largest uint128).
*
* Counterpart to Solidity's `uint128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*/
function toUint128(uint256 value) internal pure returns (uint128) {
require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits");
return uint128(value);
}
/**
* @dev Returns the downcasted uint96 from uint256, reverting on
* overflow (when the input is greater than largest uint96).
*
* Counterpart to Solidity's `uint96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*/
function toUint96(uint256 value) internal pure returns (uint96) {
require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits");
return uint96(value);
}
/**
* @dev Returns the downcasted uint64 from uint256, reverting on
* overflow (when the input is greater than largest uint64).
*
* Counterpart to Solidity's `uint64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*/
function toUint64(uint256 value) internal pure returns (uint64) {
require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits");
return uint64(value);
}
/**
* @dev Returns the downcasted uint32 from uint256, reverting on
* overflow (when the input is greater than largest uint32).
*
* Counterpart to Solidity's `uint32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*/
function toUint32(uint256 value) internal pure returns (uint32) {
require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits");
return uint32(value);
}
/**
* @dev Returns the downcasted uint16 from uint256, reverting on
* overflow (when the input is greater than largest uint16).
*
* Counterpart to Solidity's `uint16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*/
function toUint16(uint256 value) internal pure returns (uint16) {
require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits");
return uint16(value);
}
/**
* @dev Returns the downcasted uint8 from uint256, reverting on
* overflow (when the input is greater than largest uint8).
*
* Counterpart to Solidity's `uint8` operator.
*
* Requirements:
*
* - input must fit into 8 bits.
*/
function toUint8(uint256 value) internal pure returns (uint8) {
require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits");
return uint8(value);
}
/**
* @dev Converts a signed int256 into an unsigned uint256.
*
* Requirements:
*
* - input must be greater than or equal to 0.
*/
function toUint256(int256 value) internal pure returns (uint256) {
require(value >= 0, "SafeCast: value must be positive");
return uint256(value);
}
/**
* @dev Returns the downcasted int128 from int256, reverting on
* overflow (when the input is less than smallest int128 or
* greater than largest int128).
*
* Counterpart to Solidity's `int128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*
* _Available since v3.1._
*/
function toInt128(int256 value) internal pure returns (int128) {
require(value >= type(int128).min && value <= type(int128).max, "SafeCast: value doesn't fit in 128 bits");
return int128(value);
}
/**
* @dev Returns the downcasted int64 from int256, reverting on
* overflow (when the input is less than smallest int64 or
* greater than largest int64).
*
* Counterpart to Solidity's `int64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*
* _Available since v3.1._
*/
function toInt64(int256 value) internal pure returns (int64) {
require(value >= type(int64).min && value <= type(int64).max, "SafeCast: value doesn't fit in 64 bits");
return int64(value);
}
/**
* @dev Returns the downcasted int32 from int256, reverting on
* overflow (when the input is less than smallest int32 or
* greater than largest int32).
*
* Counterpart to Solidity's `int32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*
* _Available since v3.1._
*/
function toInt32(int256 value) internal pure returns (int32) {
require(value >= type(int32).min && value <= type(int32).max, "SafeCast: value doesn't fit in 32 bits");
return int32(value);
}
/**
* @dev Returns the downcasted int16 from int256, reverting on
* overflow (when the input is less than smallest int16 or
* greater than largest int16).
*
* Counterpart to Solidity's `int16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*
* _Available since v3.1._
*/
function toInt16(int256 value) internal pure returns (int16) {
require(value >= type(int16).min && value <= type(int16).max, "SafeCast: value doesn't fit in 16 bits");
return int16(value);
}
/**
* @dev Returns the downcasted int8 from int256, reverting on
* overflow (when the input is less than smallest int8 or
* greater than largest int8).
*
* Counterpart to Solidity's `int8` operator.
*
* Requirements:
*
* - input must fit into 8 bits.
*
* _Available since v3.1._
*/
function toInt8(int256 value) internal pure returns (int8) {
require(value >= type(int8).min && value <= type(int8).max, "SafeCast: value doesn't fit in 8 bits");
return int8(value);
}
/**
* @dev Converts an unsigned uint256 into a signed int256.
*
* Requirements:
*
* - input must be less than or equal to maxInt256.
*/
function toInt256(uint256 value) internal pure returns (int256) {
// Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
return int256(value);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a / b + (a % b == 0 ? 0 : 1);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)
pragma solidity ^0.8.0;
import "./ECDSA.sol";
/**
* @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
*
* The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
* thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
* they need in their contracts using a combination of `abi.encode` and `keccak256`.
*
* This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
* scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
* ({_hashTypedDataV4}).
*
* The implementation of the domain separator was designed to be as efficient as possible while still properly updating
* the chain id to protect against replay attacks on an eventual fork of the chain.
*
* NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
* https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
*
* _Available since v3.4._
*/
abstract contract EIP712 {
/* solhint-disable var-name-mixedcase */
// Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
// invalidate the cached domain separator if the chain id changes.
bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
uint256 private immutable _CACHED_CHAIN_ID;
address private immutable _CACHED_THIS;
bytes32 private immutable _HASHED_NAME;
bytes32 private immutable _HASHED_VERSION;
bytes32 private immutable _TYPE_HASH;
/* solhint-enable var-name-mixedcase */
/**
* @dev Initializes the domain separator and parameter caches.
*
* The meaning of `name` and `version` is specified in
* https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
*
* - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
* - `version`: the current major version of the signing domain.
*
* NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
* contract upgrade].
*/
constructor(string memory name, string memory version) {
bytes32 hashedName = keccak256(bytes(name));
bytes32 hashedVersion = keccak256(bytes(version));
bytes32 typeHash = keccak256(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
);
_HASHED_NAME = hashedName;
_HASHED_VERSION = hashedVersion;
_CACHED_CHAIN_ID = block.chainid;
_CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);
_CACHED_THIS = address(this);
_TYPE_HASH = typeHash;
}
/**
* @dev Returns the domain separator for the current chain.
*/
function _domainSeparatorV4() internal view returns (bytes32) {
if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {
return _CACHED_DOMAIN_SEPARATOR;
} else {
return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
}
}
function _buildDomainSeparator(
bytes32 typeHash,
bytes32 nameHash,
bytes32 versionHash
) private view returns (bytes32) {
return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));
}
/**
* @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
* function returns the hash of the fully encoded EIP712 message for this domain.
*
* This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
*
* ```solidity
* bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
* keccak256("Mail(address to,string contents)"),
* mailTo,
* keccak256(bytes(mailContents))
* )));
* address signer = ECDSA.recover(digest, signature);
* ```
*/
function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../Strings.sol";
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
} else if (error == RecoverError.InvalidSignatureV) {
revert("ECDSA: invalid signature 'v' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
// Check the signature length
// - case 65: r,s,v signature (standard)
// - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else if (signature.length == 64) {
bytes32 r;
bytes32 vs;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
vs := mload(add(signature, 0x40))
}
return tryRecover(hash, r, vs);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s;
uint8 v;
assembly {
s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
v := add(shr(255, vs), 27)
}
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
if (v != 27 && v != 28) {
return (address(0), RecoverError.InvalidSignatureV);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
/**
* @dev Returns an Ethereum Signed Message, created from `s`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
* of elements in a mapping, issuing ERC721 ids, or counting request ids.
*
* Include with `using Counters for Counters.Counter;`
*/
library Counters {
struct Counter {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
// this feature: see https://github.com/ethereum/solidity/issues/4637
uint256 _value; // default: 0
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) internal {
unchecked {
counter._value += 1;
}
}
function decrement(Counter storage counter) internal {
uint256 value = counter._value;
require(value > 0, "Counter: decrement overflow");
unchecked {
counter._value = value - 1;
}
}
function reset(Counter storage counter) internal {
counter._value = 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-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 v4.4.1 (token/ERC20/extensions/draft-ERC20Permit.sol)
pragma solidity ^0.8.0;
import "./draft-IERC20Permit.sol";
import "../ERC20.sol";
import "../../../utils/cryptography/draft-EIP712.sol";
import "../../../utils/cryptography/ECDSA.sol";
import "../../../utils/Counters.sol";
/**
* @dev Implementation 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.
*
* _Available since v3.4._
*/
abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {
using Counters for Counters.Counter;
mapping(address => Counters.Counter) private _nonces;
// solhint-disable-next-line var-name-mixedcase
bytes32 private immutable _PERMIT_TYPEHASH =
keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
/**
* @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`.
*
* It's a good idea to use the same `name` that is defined as the ERC20 token name.
*/
constructor(string memory name) EIP712(name, "1") {}
/**
* @dev See {IERC20Permit-permit}.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public virtual override {
require(block.timestamp <= deadline, "ERC20Permit: expired deadline");
bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));
bytes32 hash = _hashTypedDataV4(structHash);
address signer = ECDSA.recover(hash, v, r, s);
require(signer == owner, "ERC20Permit: invalid signature");
_approve(owner, spender, value);
}
/**
* @dev See {IERC20Permit-nonces}.
*/
function nonces(address owner) public view virtual override returns (uint256) {
return _nonces[owner].current();
}
/**
* @dev See {IERC20Permit-DOMAIN_SEPARATOR}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view override returns (bytes32) {
return _domainSeparatorV4();
}
/**
* @dev "Consume a nonce": return the current value and increment.
*
* _Available since v4.1._
*/
function _useNonce(address owner) internal virtual returns (uint256 current) {
Counters.Counter storage nonce = _nonces[owner];
current = nonce.current();
nonce.increment();
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Votes.sol)
pragma solidity ^0.8.0;
import "./draft-ERC20Permit.sol";
import "../../../utils/math/Math.sol";
import "../../../utils/math/SafeCast.sol";
import "../../../utils/cryptography/ECDSA.sol";
/**
* @dev Extension of ERC20 to support Compound-like voting and delegation. This version is more generic than Compound's,
* and supports token supply up to 2^224^ - 1, while COMP is limited to 2^96^ - 1.
*
* NOTE: If exact COMP compatibility is required, use the {ERC20VotesComp} variant of this module.
*
* This extension keeps a history (checkpoints) of each account's vote power. Vote power can be delegated either
* by calling the {delegate} function directly, or by providing a signature to be used with {delegateBySig}. Voting
* power can be queried through the public accessors {getVotes} and {getPastVotes}.
*
* By default, token balance does not account for voting power. This makes transfers cheaper. The downside is that it
* requires users to delegate to themselves in order to activate checkpoints and have their voting power tracked.
* Enabling self-delegation can easily be done by overriding the {delegates} function. Keep in mind however that this
* will significantly increase the base gas cost of transfers.
*
* _Available since v4.2._
*/
abstract contract ERC20Votes is ERC20Permit {
struct Checkpoint {
uint32 fromBlock;
uint224 votes;
}
bytes32 private constant _DELEGATION_TYPEHASH =
keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
mapping(address => address) private _delegates;
mapping(address => Checkpoint[]) private _checkpoints;
Checkpoint[] private _totalSupplyCheckpoints;
/**
* @dev Emitted when an account changes their delegate.
*/
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/**
* @dev Emitted when a token transfer or delegate change results in changes to an account's voting power.
*/
event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);
/**
* @dev Get the `pos`-th checkpoint for `account`.
*/
function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) {
return _checkpoints[account][pos];
}
/**
* @dev Get number of checkpoints for `account`.
*/
function numCheckpoints(address account) public view virtual returns (uint32) {
return SafeCast.toUint32(_checkpoints[account].length);
}
/**
* @dev Get the address `account` is currently delegating to.
*/
function delegates(address account) public view virtual returns (address) {
return _delegates[account];
}
/**
* @dev Gets the current votes balance for `account`
*/
function getVotes(address account) public view returns (uint256) {
uint256 pos = _checkpoints[account].length;
return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes;
}
/**
* @dev Retrieve the number of votes for `account` at the end of `blockNumber`.
*
* Requirements:
*
* - `blockNumber` must have been already mined
*/
function getPastVotes(address account, uint256 blockNumber) public view returns (uint256) {
require(blockNumber < block.number, "ERC20Votes: block not yet mined");
return _checkpointsLookup(_checkpoints[account], blockNumber);
}
/**
* @dev Retrieve the `totalSupply` at the end of `blockNumber`. Note, this value is the sum of all balances.
* It is but NOT the sum of all the delegated votes!
*
* Requirements:
*
* - `blockNumber` must have been already mined
*/
function getPastTotalSupply(uint256 blockNumber) public view returns (uint256) {
require(blockNumber < block.number, "ERC20Votes: block not yet mined");
return _checkpointsLookup(_totalSupplyCheckpoints, blockNumber);
}
/**
* @dev Lookup a value in a list of (sorted) checkpoints.
*/
function _checkpointsLookup(Checkpoint[] storage ckpts, uint256 blockNumber) private view returns (uint256) {
// We run a binary search to look for the earliest checkpoint taken after `blockNumber`.
//
// During the loop, the index of the wanted checkpoint remains in the range [low-1, high).
// With each iteration, either `low` or `high` is moved towards the middle of the range to maintain the invariant.
// - If the middle checkpoint is after `blockNumber`, we look in [low, mid)
// - If the middle checkpoint is before or equal to `blockNumber`, we look in [mid+1, high)
// Once we reach a single value (when low == high), we've found the right checkpoint at the index high-1, if not
// out of bounds (in which case we're looking too far in the past and the result is 0).
// Note that if the latest checkpoint available is exactly for `blockNumber`, we end up with an index that is
// past the end of the array, so we technically don't find a checkpoint after `blockNumber`, but it works out
// the same.
uint256 high = ckpts.length;
uint256 low = 0;
while (low < high) {
uint256 mid = Math.average(low, high);
if (ckpts[mid].fromBlock > blockNumber) {
high = mid;
} else {
low = mid + 1;
}
}
return high == 0 ? 0 : ckpts[high - 1].votes;
}
/**
* @dev Delegate votes from the sender to `delegatee`.
*/
function delegate(address delegatee) public virtual {
_delegate(_msgSender(), delegatee);
}
/**
* @dev Delegates votes from signer to `delegatee`
*/
function delegateBySig(
address delegatee,
uint256 nonce,
uint256 expiry,
uint8 v,
bytes32 r,
bytes32 s
) public virtual {
require(block.timestamp <= expiry, "ERC20Votes: signature expired");
address signer = ECDSA.recover(
_hashTypedDataV4(keccak256(abi.encode(_DELEGATION_TYPEHASH, delegatee, nonce, expiry))),
v,
r,
s
);
require(nonce == _useNonce(signer), "ERC20Votes: invalid nonce");
_delegate(signer, delegatee);
}
/**
* @dev Maximum token supply. Defaults to `type(uint224).max` (2^224^ - 1).
*/
function _maxSupply() internal view virtual returns (uint224) {
return type(uint224).max;
}
/**
* @dev Snapshots the totalSupply after it has been increased.
*/
function _mint(address account, uint256 amount) internal virtual override {
super._mint(account, amount);
require(totalSupply() <= _maxSupply(), "ERC20Votes: total supply risks overflowing votes");
_writeCheckpoint(_totalSupplyCheckpoints, _add, amount);
}
/**
* @dev Snapshots the totalSupply after it has been decreased.
*/
function _burn(address account, uint256 amount) internal virtual override {
super._burn(account, amount);
_writeCheckpoint(_totalSupplyCheckpoints, _subtract, amount);
}
/**
* @dev Move voting power when tokens are transferred.
*
* Emits a {DelegateVotesChanged} event.
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual override {
super._afterTokenTransfer(from, to, amount);
_moveVotingPower(delegates(from), delegates(to), amount);
}
/**
* @dev Change delegation for `delegator` to `delegatee`.
*
* Emits events {DelegateChanged} and {DelegateVotesChanged}.
*/
function _delegate(address delegator, address delegatee) internal virtual {
address currentDelegate = delegates(delegator);
uint256 delegatorBalance = balanceOf(delegator);
_delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveVotingPower(currentDelegate, delegatee, delegatorBalance);
}
function _moveVotingPower(
address src,
address dst,
uint256 amount
) private {
if (src != dst && amount > 0) {
if (src != address(0)) {
(uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[src], _subtract, amount);
emit DelegateVotesChanged(src, oldWeight, newWeight);
}
if (dst != address(0)) {
(uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[dst], _add, amount);
emit DelegateVotesChanged(dst, oldWeight, newWeight);
}
}
}
function _writeCheckpoint(
Checkpoint[] storage ckpts,
function(uint256, uint256) view returns (uint256) op,
uint256 delta
) private returns (uint256 oldWeight, uint256 newWeight) {
uint256 pos = ckpts.length;
oldWeight = pos == 0 ? 0 : ckpts[pos - 1].votes;
newWeight = op(oldWeight, delta);
if (pos > 0 && ckpts[pos - 1].fromBlock == block.number) {
ckpts[pos - 1].votes = SafeCast.toUint224(newWeight);
} else {
ckpts.push(Checkpoint({fromBlock: SafeCast.toUint32(block.number), votes: SafeCast.toUint224(newWeight)}));
}
}
function _add(uint256 a, uint256 b) private pure returns (uint256) {
return a + b;
}
function _subtract(uint256 a, uint256 b) private pure returns (uint256) {
return a - b;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Pausable.sol)
pragma solidity ^0.8.0;
import "../ERC20.sol";
import "../../../security/Pausable.sol";
/**
* @dev ERC20 token with pausable token transfers, minting and burning.
*
* Useful for scenarios such as preventing trades until the end of an evaluation
* period, or having an emergency switch for freezing all token transfers in the
* event of a large bug.
*/
abstract contract ERC20Pausable is ERC20, Pausable {
/**
* @dev See {ERC20-_beforeTokenTransfer}.
*
* Requirements:
*
* - the contract must not be paused.
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual override {
super._beforeTokenTransfer(from, to, amount);
require(!paused(), "ERC20Pausable: token transfer while paused");
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Burnable.sol)
pragma solidity ^0.8.0;
import "../ERC20.sol";
import "../../../utils/Context.sol";
/**
* @dev Extension of {ERC20} that allows token holders to destroy both their own
* tokens and those that they have an allowance for, in a way that can be
* recognized off-chain (via event analysis).
*/
abstract contract ERC20Burnable is Context, ERC20 {
/**
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
*/
function burn(uint256 amount) public virtual {
_burn(_msgSender(), amount);
}
/**
* @dev Destroys `amount` tokens from `account`, deducting from the caller's
* allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `amount`.
*/
function burnFrom(address account, uint256 amount) public virtual {
uint256 currentAllowance = allowance(account, _msgSender());
require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
unchecked {
_approve(account, _msgSender(), currentAllowance - amount);
}
_burn(account, amount);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @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 `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, 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 `sender` to `recipient` 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 sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @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);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* 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}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* 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 value {ERC20} uses, unless this function is
* 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:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, 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}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), 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}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - 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) {
_approve(_msgSender(), spender, _allowances[_msgSender()][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) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `sender` to `recipient`.
*
* 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:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, 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;
_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;
}
_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 Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
require(!paused(), "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
require(paused(), "Pausable: not paused");
_;
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it.
*/
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role, _msgSender());
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function _checkRole(bytes32 role, address account) internal view {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
Strings.toHexString(uint160(account), 20),
" is missing role ",
Strings.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view override returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*
* NOTE: This function is deprecated in favor of {_grantRole}.
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Grants `role` to `account`.
*
* Internal function without access restriction.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 SafeMathUpgradeable {
/**
* @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 substraction 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 v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165Upgradeable {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
function __ERC165_init() internal onlyInitializing {
__ERC165_init_unchained();
}
function __ERC165_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165Upgradeable).interfaceId;
}
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library StringsUpgradeable {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";
/**
* @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 ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
__Context_init_unchained();
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @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
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, "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");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(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) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason 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 {
// 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
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/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC721Upgradeable.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721MetadataUpgradeable is IERC721Upgradeable {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Enumerable.sol)
pragma solidity ^0.8.0;
import "../IERC721Upgradeable.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721EnumerableUpgradeable is IERC721Upgradeable {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Pausable.sol)
pragma solidity ^0.8.0;
import "../ERC721Upgradeable.sol";
import "../../../security/PausableUpgradeable.sol";
import "../../../proxy/utils/Initializable.sol";
/**
* @dev ERC721 token with pausable token transfers, minting and burning.
*
* Useful for scenarios such as preventing trades until the end of an evaluation
* period, or having an emergency switch for freezing all token transfers in the
* event of a large bug.
*/
abstract contract ERC721PausableUpgradeable is Initializable, ERC721Upgradeable, PausableUpgradeable {
function __ERC721Pausable_init() internal onlyInitializing {
__Context_init_unchained();
__ERC165_init_unchained();
__Pausable_init_unchained();
__ERC721Pausable_init_unchained();
}
function __ERC721Pausable_init_unchained() internal onlyInitializing {
}
/**
* @dev See {ERC721-_beforeTokenTransfer}.
*
* Requirements:
*
* - the contract must not be paused.
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override {
super._beforeTokenTransfer(from, to, tokenId);
require(!paused(), "ERC721Pausable: token transfer while paused");
}
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol)
pragma solidity ^0.8.0;
import "../ERC721Upgradeable.sol";
import "./IERC721EnumerableUpgradeable.sol";
import "../../../proxy/utils/Initializable.sol";
/**
* @dev This implements an optional extension of {ERC721} defined in the EIP that adds
* enumerability of all the token ids in the contract as well as all token ids owned by each
* account.
*/
abstract contract ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable {
function __ERC721Enumerable_init() internal onlyInitializing {
__Context_init_unchained();
__ERC165_init_unchained();
__ERC721Enumerable_init_unchained();
}
function __ERC721Enumerable_init_unchained() internal onlyInitializing {
}
// Mapping from owner to list of owned token IDs
mapping(address => mapping(uint256 => uint256)) private _ownedTokens;
// Mapping from token ID to index of the owner tokens list
mapping(uint256 => uint256) private _ownedTokensIndex;
// Array with all token ids, used for enumeration
uint256[] private _allTokens;
// Mapping from token id to position in the allTokens array
mapping(uint256 => uint256) private _allTokensIndex;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC721Upgradeable) returns (bool) {
return interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
require(index < ERC721Upgradeable.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _allTokens.length;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index < ERC721EnumerableUpgradeable.totalSupply(), "ERC721Enumerable: global index out of bounds");
return _allTokens[index];
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override {
super._beforeTokenTransfer(from, to, tokenId);
if (from == address(0)) {
_addTokenToAllTokensEnumeration(tokenId);
} else if (from != to) {
_removeTokenFromOwnerEnumeration(from, tokenId);
}
if (to == address(0)) {
_removeTokenFromAllTokensEnumeration(tokenId);
} else if (to != from) {
_addTokenToOwnerEnumeration(to, tokenId);
}
}
/**
* @dev Private function to add a token to this extension's ownership-tracking data structures.
* @param to address representing the new owner of the given token ID
* @param tokenId uint256 ID of the token to be added to the tokens list of the given address
*/
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
uint256 length = ERC721Upgradeable.balanceOf(to);
_ownedTokens[to][length] = tokenId;
_ownedTokensIndex[tokenId] = length;
}
/**
* @dev Private function to add a token to this extension's token tracking data structures.
* @param tokenId uint256 ID of the token to be added to the tokens list
*/
function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
_allTokensIndex[tokenId] = _allTokens.length;
_allTokens.push(tokenId);
}
/**
* @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
* while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
* gas optimizations e.g. when performing a transfer operation (avoiding double writes).
* This has O(1) time complexity, but alters the order of the _ownedTokens array.
* @param from address representing the previous owner of the given token ID
* @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
*/
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
// To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = ERC721Upgradeable.balanceOf(from) - 1;
uint256 tokenIndex = _ownedTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary
if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
}
// This also deletes the contents at the last position of the array
delete _ownedTokensIndex[tokenId];
delete _ownedTokens[from][lastTokenIndex];
}
/**
* @dev Private function to remove a token from this extension's token tracking data structures.
* This has O(1) time complexity, but alters the order of the _allTokens array.
* @param tokenId uint256 ID of the token to be removed from the tokens list
*/
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
// rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
// an 'if' statement (like in _removeTokenFromOwnerEnumeration)
uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
// This also deletes the contents at the last position of the array
delete _allTokensIndex[tokenId];
_allTokens.pop();
}
uint256[46] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165Upgradeable.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721Upgradeable is IERC165Upgradeable {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721ReceiverUpgradeable {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol)
pragma solidity ^0.8.0;
import "./IERC721Upgradeable.sol";
import "./IERC721ReceiverUpgradeable.sol";
import "./extensions/IERC721MetadataUpgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../utils/StringsUpgradeable.sol";
import "../../utils/introspection/ERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {
using AddressUpgradeable for address;
using StringsUpgradeable for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {
__Context_init_unchained();
__ERC165_init_unchained();
__ERC721_init_unchained(name_, symbol_);
}
function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {
return
interfaceId == type(IERC721Upgradeable).interfaceId ||
interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721Upgradeable.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721Upgradeable.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721Upgradeable.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits a {ApprovalForAll} event.
*/
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` 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 tokenId
) internal virtual {}
uint256[44] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20Upgradeable.sol";
import "../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {
using AddressUpgradeable for address;
function safeTransfer(
IERC20Upgradeable token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20Upgradeable 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(
IERC20Upgradeable 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));
}
function safeIncreaseAllowance(
IERC20Upgradeable token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20Upgradeable token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
/**
* @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(IERC20Upgradeable 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");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20Upgradeable {
/**
* @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 `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, 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 `sender` to `recipient` 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 sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @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);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
function __Pausable_init() internal onlyInitializing {
__Context_init_unchained();
__Pausable_init_unchained();
}
function __Pausable_init_unchained() internal onlyInitializing {
_paused = false;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
require(!paused(), "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
require(paused(), "Pausable: not paused");
_;
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol)
pragma solidity ^0.8.0;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the
* initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() initializer {}
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
*/
bool private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Modifier to protect an initializer function from being invoked twice.
*/
modifier initializer() {
// If the contract is initializing we ignore whether _initialized is set in order to support multiple
// inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
// contract may have been reentered.
require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");
bool isTopLevelCall = !_initializing;
if (isTopLevelCall) {
_initializing = true;
_initialized = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
}
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} modifier, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
function _isConstructor() private view returns (bool) {
return !AddressUpgradeable.isContract(address(this));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControlUpgradeable {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it.
*/
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
function __AccessControl_init() internal onlyInitializing {
__Context_init_unchained();
__ERC165_init_unchained();
__AccessControl_init_unchained();
}
function __AccessControl_init_unchained() internal onlyInitializing {
}
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role, _msgSender());
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function _checkRole(bytes32 role, address account) internal view {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
StringsUpgradeable.toHexString(uint160(account), 20),
" is missing role ",
StringsUpgradeable.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view override returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*
* NOTE: This function is deprecated in favor of {_grantRole}.
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Grants `role` to `account`.
*
* Internal function without access restriction.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
uint256[49] private __gap;
}{
"remappings": [],
"optimizer": {
"enabled": true,
"runs": 1
},
"evmVersion": "paris",
"libraries": {},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"referrer","type":"uint256"}],"name":"activatedWithReferral","type":"event"},{"inputs":[],"name":"CLIENTSTATUSCHANGE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_MERCHANT_RATE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"F24SalesAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"INTERNALDIGIT","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIMITLIVEDEFAULT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIMITUPDATER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MERCHANTDIGIT","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"THIRTYDAYS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"f24Address","type":"address"},{"internalType":"address","name":"fiat24PriceListAddress","type":"address"}],"name":"activateF24","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"referrer","type":"uint256"}],"name":"activateWithReferral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"number","type":"uint256"},{"internalType":"string","name":"name","type":"string"}],"name":"addWalletProvider","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"enum Fiat24Account.Status","name":"_status","type":"uint8"}],"name":"changeClientStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"checkLimit","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"close","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"historicOwnership","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"isMerchant","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"limit","outputs":[{"internalType":"uint256","name":"usedLimit","type":"uint256"},{"internalType":"uint256","name":"clientLimit","type":"uint256"},{"internalType":"uint256","name":"startLimitDate","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"limitTourist","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxDigitForSale","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"merchantRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minDigitForSale","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"mintByClient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"mintByClientWithETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"mintByWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"nftAvatar","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"nickNames","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"oldTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"removeHistoricOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"number","type":"uint256"}],"name":"removeWalletProvider","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"resetUsedLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"clientLimit","type":"uint256"}],"name":"setClientLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_f24SalesAddress","type":"address"}],"name":"setF24SalesAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"maxDigit","type":"uint8"}],"name":"setMaxDigitForSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"_merchantRate","type":"uint256"}],"name":"setMerchantRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"minDigit","type":"uint8"}],"name":"setMinDigitForSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"url","type":"string"}],"name":"setNftAvatar","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"nickname","type":"string"}],"name":"setNickname","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newLimitTourist","type":"uint256"}],"name":"setTouristLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"status","outputs":[{"internalType":"enum Fiat24Account.Status","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","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":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"updateLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"upgradeWithF24","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"walletProvider","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"walletProviderMap","outputs":[{"internalType":"string","name":"walletProvider","type":"string"},{"internalType":"bool","name":"isAvailable","type":"bool"}],"stateMutability":"view","type":"function"}]Contract Creation Code
608060405234801561001057600080fd5b50615d3380620000216000396000f3fe6080604052600436106103415760003560e01c8063013e53d11461034657806301ffc9a71461037b578063023b62a2146103ab5780630264e7e9146103cd57806306fdde03146103fb578063081812fc1461041d578063095ea7b31461044a578063099d2ec81461046a5780630aebeb4e146104815780630e8477f8146104a157806310480e13146104c15780631278e2d2146104e157806318160ddd1461050857806321d39e5a1461051d57806323b872dd1461053d578063243bcfcb1461055d578063248a9ca3146105b557806324a933eb146105d55780632856784b146105ea5780632ac354851461060a5780632af047901461062a5780632f2ff15d146106585780632f745c591461067857806336568abe146106985780633ea3ab8e146106b85780633f4ba83a146106d857806340c10f19146106ed57806342842e0e1461070d57806342966c681461072d57806342d21ef71461074d5780634bedccf41461078b5780634f558e79146107ab5780634f6ccce7146107cb57806356ecb92b146107eb578063592b2051146108025780635c975abb146108225780636352211e1461083a57806368800cd31461085a5780636917574a146108885780636a183f451461089f5780636a46a1b7146108bf5780636abd75c3146108df578063701eec93146108f257806370a082311461092357806370def791146109435780637115fb42146109635780637220b199146109835780637d9b67ee1461099e57806380f669df146109be5780638129fc1c146109de57806383561e84146109f35780638456cb5914610a1357806391d1485414610a285780639397031114610a4857806395d89b4114610a695780639630571914610a7e5780639ffa6e9714610aac578063a217fddf14610ada578063a22cb46514610aef578063b51243ec14610b0f578063b88d4fde14610b2f578063b9464c9314610b4f578063c1cccc7014610b64578063c36eeea814610b84578063c7b4b68914610ba4578063c81472b414610bc4578063c87b56dd14610be4578063d539139314610c04578063d547741f14610c26578063d92af1b714610c46578063df9e739a14610c66578063e985e9c514610c86578063e9d2b1b314610ca6578063f5b541a614610cc8575b600080fd5b34801561035257600080fd5b50610368600080516020615c4c83398151915281565b6040519081526020015b60405180910390f35b34801561038757600080fd5b5061039b610396366004615072565b610cea565b6040519015158152602001610372565b3480156103b757600080fd5b506103cb6103c636600461513a565b610d30565b005b3480156103d957600080fd5b506103ed6103e836600461516e565b610e6c565b6040516103729291906151d7565b34801561040757600080fd5b50610410610f14565b60405161037291906151fb565b34801561042957600080fd5b5061043d61043836600461516e565b610fa6565b604051610372919061520e565b34801561045657600080fd5b506103cb610465366004615237565b61102e565b34801561047657600080fd5b50610368620186a081565b34801561048d57600080fd5b506103cb61049c36600461516e565b611139565b3480156104ad57600080fd5b506103cb6104bc366004615263565b61124a565b3480156104cd57600080fd5b506103cb6104dc366004615237565b611299565b3480156104ed57600080fd5b506104f6600981565b60405160ff9091168152602001610372565b34801561051457600080fd5b50609954610368565b34801561052957600080fd5b506103cb610538366004615280565b61167f565b34801561054957600080fd5b506103cb6105583660046152c6565b6116ef565b34801561056957600080fd5b5061059a61057836600461516e565b6101656020526000908152604090208054600182015460029092015490919083565b60408051938452602084019290925290820152606001610372565b3480156105c157600080fd5b506103686105d036600461516e565b611744565b3480156105e157600080fd5b50610368603781565b3480156105f657600080fd5b506103cb610605366004615307565b61175a565b34801561061657600080fd5b506103cb610625366004615307565b6117a5565b34801561063657600080fd5b50610368610645366004615263565b6101606020526000908152604090205481565b34801561066457600080fd5b506103cb61067336600461532a565b6117f6565b34801561068457600080fd5b50610368610693366004615237565b611813565b3480156106a457600080fd5b506103cb6106b336600461532a565b6118a9565b3480156106c457600080fd5b50610166546104f690610100900460ff1681565b3480156106e457600080fd5b506103cb611927565b3480156106f957600080fd5b506103cb610708366004615237565b611958565b34801561071957600080fd5b506103cb6107283660046152c6565b611a89565b34801561073957600080fd5b506103cb61074836600461516e565b611a94565b34801561075957600080fd5b5061077e61076836600461516e565b6101646020526000908152604090205460ff1681565b6040516103729190615370565b34801561079757600080fd5b506103cb6107a6366004615398565b611af1565b3480156107b757600080fd5b5061039b6107c636600461516e565b611c1f565b3480156107d757600080fd5b506103686107e636600461516e565b611c2a565b3480156107f757600080fd5b5061036862278d0081565b34801561080e57600080fd5b506103cb61081d36600461516e565b611cbd565b34801561082e57600080fd5b5060c95460ff1661039b565b34801561084657600080fd5b5061043d61085536600461516e565b611da5565b34801561086657600080fd5b5061036861087536600461516e565b6101686020526000908152604090205481565b34801561089457600080fd5b5061036861015f5481565b3480156108ab57600080fd5b506103cb6108ba36600461516e565b611e1c565b3480156108cb57600080fd5b506103cb6108da36600461516e565b6122b9565b6103cb6108ed36600461516e565b612316565b3480156108fe57600080fd5b5061039b61090d36600461516e565b6101626020526000908152604090205460ff1681565b34801561092f57600080fd5b5061036861093e366004615263565b61262c565b34801561094f57600080fd5b506103cb61095e3660046153c7565b6126b3565b34801561096f57600080fd5b506103cb61097e366004615398565b61280f565b34801561098f57600080fd5b50610166546104f69060ff1681565b3480156109aa57600080fd5b506103cb6109b93660046153ec565b612856565b3480156109ca57600080fd5b506104106109d936600461516e565b6128ce565b3480156109ea57600080fd5b506103cb612969565b3480156109ff57600080fd5b506103cb610a0e36600461516e565b612ac8565b348015610a1f57600080fd5b506103cb612b33565b348015610a3457600080fd5b5061039b610a4336600461532a565b612b62565b348015610a5457600080fd5b5061016c5461043d906001600160a01b031681565b348015610a7557600080fd5b50610410612b8e565b348015610a8a57600080fd5b50610368610a9936600461516e565b61016b6020526000908152604090205481565b348015610ab857600080fd5b50610368610ac736600461516e565b6101636020526000908152604090205481565b348015610ae657600080fd5b50610368600081565b348015610afb57600080fd5b506103cb610b0a366004615428565b612b9d565b348015610b1b57600080fd5b506103cb610b2a366004615263565b612ba8565b348015610b3b57600080fd5b506103cb610b4a366004615456565b612bff565b348015610b5b57600080fd5b506104f6600881565b348015610b7057600080fd5b50610410610b7f36600461516e565b612c31565b348015610b9057600080fd5b5061039b610b9f366004615398565b612c4b565b348015610bb057600080fd5b506103cb610bbf36600461516e565b612d4c565b348015610bd057600080fd5b506103cb610bdf366004615398565b612d86565b348015610bf057600080fd5b50610410610bff36600461516e565b612ec5565b348015610c1057600080fd5b50610368600080516020615cbe83398151915281565b348015610c3257600080fd5b506103cb610c4136600461532a565b613032565b348015610c5257600080fd5b506103cb610c61366004615280565b61304f565b348015610c7257600080fd5b506103cb610c81366004615398565b6130f8565b348015610c9257600080fd5b5061039b610ca13660046153ec565b6134f4565b348015610cb257600080fd5b50610368600080516020615c2c83398151915281565b348015610cd457600080fd5b50610368600080516020615c9e83398151915281565b60006001600160e01b031982166380ac58cd60e01b1480610d1b57506001600160e01b03198216635b5e139f60e01b145b80610d2a5750610d2a82613522565b92915050565b6040516370a0823160e01b815260009030906370a0823190610d5690339060040161520e565b602060405180830381865afa158015610d73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9791906154d5565b11610de25760405162461bcd60e51b81526020600482015260166024820152751059191c995cdcc81a185cc81b9bc81858d8dbdd5b9d60521b60448201526064015b60405180910390fd5b604051632f745c5960e01b81526000903090632f745c5990610e0a90339085906004016154ee565b602060405180830381865afa158015610e27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4b91906154d5565b600081815261016a60205260409020909150610e678382615587565b505050565b61016960205260009081526040902080548190610e8890615507565b80601f0160208091040260200160405190810160405280929190818152602001828054610eb490615507565b8015610f015780601f10610ed657610100808354040283529160200191610f01565b820191906000526020600020905b815481529060010190602001808311610ee457829003601f168201915b5050506001909301549192505060ff1682565b606060658054610f2390615507565b80601f0160208091040260200160405190810160405280929190818152602001828054610f4f90615507565b8015610f9c5780601f10610f7157610100808354040283529160200191610f9c565b820191906000526020600020905b815481529060010190602001808311610f7f57829003601f168201915b5050505050905090565b6000610fb182613547565b6110125760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610dd9565b506000908152606960205260409020546001600160a01b031690565b600061103982611da5565b9050806001600160a01b0316836001600160a01b0316036110a65760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610dd9565b336001600160a01b03821614806110c257506110c281336134f4565b61112f5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776044820152771b995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b60421b6064820152608401610dd9565b610e678383613564565b6040516331a9108f60e11b8152600481018290523090636352211e90602401602060405180830381865afa158015611175573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111999190615646565b6001600160a01b0316336001600160a01b0316146111c95760405162461bcd60e51b8152600401610dd990615663565b60056000828152610164602052604090205460ff1660058111156111ef576111ef61535a565b1461122e5760405162461bcd60e51b815260206004820152600f60248201526e139bdd081b1a5d994818db1a595b9d608a1b6044820152606401610dd9565b600090815261016460205260409020805460ff19166004179055565b611262600080516020615c9e83398151915233612b62565b61127e5760405162461bcd60e51b8152600401610dd99061568e565b6001600160a01b031660009081526101606020526040812055565b6040516370a0823160e01b815260009030906370a08231906112bf90339060040161520e565b602060405180830381865afa1580156112dc573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130091906154d5565b1161134d5760405162461bcd60e51b815260206004820152601e60248201527f4d696e74696e67206164647265737320686173206e6f206163636f756e7400006044820152606401610dd9565b604051632f745c5960e01b81526000903090632f745c599061137590339085906004016154ee565b602060405180830381865afa158015611392573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b691906154d5565b90506113c38160086135d2565b80156113dd5750600881101580156113dd57506123278111155b6114295760405162461bcd60e51b815260206004820152601f60248201527f496e636f7272656374206163636f756e7420696420666f722077616c6c6574006044820152606401610dd9565b6000818152610169602052604090206001015460ff166114895760405162461bcd60e51b815260206004820152601b60248201527a20b1b1b7bab73a103737ba103bb0b63632ba10383937bb34b232b960291b6044820152606401610dd9565b6005611494836135f9565b10156114f15760405162461bcd60e51b815260206004820152602660248201527f6d696e74427957616c6c6574206f6e6c7920666f7220352b2064696769747320604482015265746f6b656e7360d01b6064820152608401610dd9565b61016654610100900460ff16611506836135f9565b11156115245760405162461bcd60e51b8152600401610dd9906156b7565b61152f8260096135d2565b1561154c5760405162461bcd60e51b8152600401610dd990615702565b6115578260086135d2565b156115b85760405162461bcd60e51b815260206004820152602b60248201527f4d65726368616e74206163636f756e742063616e6e6f74206265206d696e746560448201526a1908189e481dd85b1b195d60aa1b6064820152608401610dd9565b6115c2838361362a565b6115de5760405162461bcd60e51b8152600401610dd990615738565b6000828152610168602090815260408083208490556101649091529020805460ff1916600217905561161083836136de565b610166546201000090046001600160a01b03166379cc67903360646040518363ffffffff1660e01b81526004016116489291906154ee565b600060405180830381600087803b15801561166257600080fd5b505af1158015611676573d6000803e3d6000fd5b50505050505050565b611697600080516020615c9e83398151915233612b62565b6116b35760405162461bcd60e51b8152600401610dd99061568e565b6000828152610169602052604090206116cc8282615587565b50506000908152610169602052604090206001908101805460ff19169091179055565b6116fa83838361380a565b60026000828152610164602052604090205460ff1660058111156117205761172061535a565b14610e67576001600160a01b03919091166000908152610160602052604090205550565b600090815261012d602052604090206001015490565b611772600080516020615c9e83398151915233612b62565b61178e5760405162461bcd60e51b8152600401610dd99061568e565b610166805460ff191660ff92909216919091179055565b6117bd600080516020615c9e83398151915233612b62565b6117d95760405162461bcd60e51b8152600401610dd99061568e565b610166805460ff9092166101000261ff0019909216919091179055565b6117ff82611744565b611809813361383b565b610e67838361389f565b600061181e8361262c565b82106118805760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610dd9565b506001600160a01b03919091166000908152609760209081526040808320938352929052205490565b6001600160a01b03811633146119195760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610dd9565b6119238282613926565b5050565b611932600033612b62565b61194e5760405162461bcd60e51b8152600401610dd9906157a9565b61195661398e565b565b611970600080516020615c9e83398151915233612b62565b8061198e575061198e600080516020615cbe83398151915233612b62565b6119d35760405162461bcd60e51b81526020600482015260166024820152752737ba1030b71037b832b930ba37b917b6b4b73a32b960511b6044820152606401610dd9565b6119dd828261362a565b611a1c5760405162461bcd60e51b815260206004820152601060248201526f1b5a5b9d081b9bdd08185b1b1bddd95960821b6044820152606401610dd9565b611a2682826136de565b600081815261016460205260409020805460ff19166002179055611a4981613a1b565b611a5281613a36565b604051602001611a6291906157cf565b60408051601f1981840301815291815260008381526101616020522090610e679082615587565b6116fa838383613b3e565b611aac600080516020615c9e83398151915233612b62565b611ac85760405162461bcd60e51b8152600401610dd99061568e565b6000818152610165602052604081208181556001810182905560020155611aee81613b59565b50565b611b09600080516020615c4c83398151915233612b62565b611b4b5760405162461bcd60e51b81526020600482015260136024820152722737ba1030903634b6b4ba16bab83230ba32b960691b6044820152606401610dd9565b61238c8210158015611b5f57506124538211155b15611b68575050565b60056000838152610164602052604090205460ff166005811115611b8e57611b8e61535a565b1480611bbd575060026000838152610164602052604090205460ff166005811115611bbb57611bbb61535a565b145b15611923576000828152610165602052604081206002810154909190611be79062278d0090615815565b905042811015611bff57426002830155828255611c19565b82826000016000828254611c139190615815565b90915550505b50505050565b6000610d2a82613547565b6000611c3560995490565b8210611c985760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610dd9565b60998281548110611cab57611cab615828565b90600052602060002001549050919050565b611cc681613bee565b61016754604051630e75722360e41b8152600481018390526000916001600160a01b03169063e757223090602401602060405180830381865afa158015611d11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d3591906154d5565b6101665460405163079cc67960e41b81529192506201000090046001600160a01b0316906379cc679090611d6f90339085906004016154ee565b600060405180830381600087803b158015611d8957600080fd5b505af1158015611d9d573d6000803e3d6000fd5b505050505050565b6000818152606760205260408120546001600160a01b031680610d2a5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610dd9565b604051632f745c5960e01b81526000903090632f745c5990611e4490339085906004016154ee565b602060405180830381865afa158015611e61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e8591906154d5565b905060056000828152610164602052604090205460ff166005811115611ead57611ead61535a565b14611eec5760405162461bcd60e51b815260206004820152600f60248201526e139bdd08131a5d994818db1a595b9d608a1b6044820152606401610dd9565b61016754600160a01b900460ff16611f425760405162461bcd60e51b8152602060048201526019602482015278546869732066756e6374696f6e20697320696e61637469766560381b6044820152606401610dd9565b6005611f4d836135f9565b10611f9a5760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c79207072656d69756d206e756d62657220666f722075706772616465006044820152606401610dd9565b611fa58260096135d2565b156120065760405162461bcd60e51b815260206004820152602b60248201527f496e7465726e616c206163636f756e7449642063616e6e6f74206265206d696e60448201526a1d08189e4818db1a595b9d60aa1b6064820152608401610dd9565b6120118260086135d2565b1561206c576120218160086135d2565b61206c5760405162461bcd60e51b815260206004820152601c60248201527b13db19081d1bdad95b881b5d5cdd0818994818481b595c98da185b9d60221b6044820152606401610dd9565b6120778160086135d2565b156120d2576120878260086135d2565b6120d25760405162461bcd60e51b815260206004820152601c60248201527b13995dc81d1bdad95b881b5d5cdd0818994818481b595c98da185b9d60221b6044820152606401610dd9565b61016754604051630e75722360e41b8152600481018490526000916001600160a01b03169063e757223090602401602060405180830381865afa15801561211d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061214191906154d5565b9050806000036121935760405162461bcd60e51b815260206004820181905260248201527f4163636f756e744964206e6f7420617661696c61626c6520666f722073616c656044820152606401610dd9565b600082815261016460205260409020805460ff191660041790556121ca6121b983611da5565b6121c4612392611da5565b84613d6e565b6121d433846136de565b6000838152610164602090815260408083208054600560ff1990911617905533808452610160835281842087905585845261016883528184205487855282852055858452610165835281842087855282852060018281015490820155815481556002808301549082015561016b9094529382902086905561016654915163079cc67960e41b8152620100009092046001600160a01b0316916379cc6790916122809187906004016154ee565b600060405180830381600087803b15801561229a57600080fd5b505af11580156122ae573d6000803e3d6000fd5b505050505050505050565b6122d1600080516020615c9e83398151915233612b62565b6122ed5760405162461bcd60e51b8152600401610dd99061568e565b60008181526101696020526040812090612307828261500e565b50600101805460ff1916905550565b61231f81613bee565b61016754604051630e75722360e41b8152600481018390526000916001600160a01b03169063e757223090602401602060405180830381865afa15801561236a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061238e91906154d5565b905060008061016c60009054906101000a90046001600160a01b03166001600160a01b031663bead08d66040518163ffffffff1660e01b8152600401602060405180830381865afa1580156123e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061240b91906154d5565b9050828110156124385761241f8184615854565b61243190670de0b6b3a7640000615868565b9150612457565b6124428382615854565b61245490670de0b6b3a7640000615854565b91505b813410156124b95760405162461bcd60e51b815260206004820152602960248201527f4e6f742073756666696369656e74206d73672e76616c756520666f722046323460448201526820707572636861736560b81b6064820152608401610dd9565b600061016c60009054906101000a90046001600160a01b03166001600160a01b031663a6f2ae3a346040518263ffffffff1660e01b815260040160206040518083038185885af1158015612511573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061253691906154d5565b61016654604051630852cd8d60e31b8152600481018790529192506201000090046001600160a01b0316906342966c6890602401600060405180830381600087803b15801561258457600080fd5b505af1158015612598573d6000803e3d6000fd5b50505050600084826125aa919061587f565b90508015611d9d57610166546201000090046001600160a01b031663a9059cbb33836040518363ffffffff1660e01b81526004016125e99291906154ee565b6020604051808303816000875af1158015612608573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116769190615892565b60006001600160a01b0382166126975760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610dd9565b506001600160a01b031660009081526068602052604090205490565b6126cb600080516020615c9e83398151915233612b62565b806126e957506126e9600080516020615c2c83398151915233612b62565b6127055760405162461bcd60e51b8152600401610dd9906158af565b60058160058111156127195761271961535a565b148015612749575060026000838152610164602052604090205460ff1660058111156127475761274761535a565b145b156127da576040516331a9108f60e11b8152600481018390528290610160906000903090636352211e90602401602060405180830381865afa158015612793573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127b79190615646565b6001600160a01b031681526020810191909152604001600020556127da82613f07565b600082815261016460205260409020805482919060ff191660018360058111156128065761280661535a565b02179055505050565b612827600080516020615c9e83398151915233612b62565b6128435760405162461bcd60e51b8152600401610dd99061568e565b6000918252610163602052604090912055565b61286e600080516020615c9e83398151915233612b62565b61288a5760405162461bcd60e51b8152600401610dd99061568e565b61016680546001600160a01b03938416620100000262010000600160b01b031990911617905561016780546001600160a81b0319169190921617600160a01b179055565b61016a60205260009081526040902080546128e890615507565b80601f016020809104026020016040519081016040528092919081815260200182805461291490615507565b80156129615780601f1061293657610100808354040283529160200191612961565b820191906000526020600020905b81548152906001019060200180831161294457829003601f168201915b505050505081565b600054610100900460ff166129845760005460ff1615612988565b303b155b6129eb5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610dd9565b600054610100900460ff16158015612a0d576000805461ffff19166101011790555b612a15613f2b565b612a636040518060400160405280600e81526020016d119a585d0c8d081058d8dbdd5b9d60921b81525060405180604001604052806006815260200165119a585d0c8d60d21b815250613f52565b612a6b613f2b565b610166805461ffff1916610505179055610167805460ff60a01b19169055620186a061015f55612a9c600033613f92565b612ab4600080516020615c9e83398151915233613f92565b8015611aee576000805461ff001916905550565b612ae0600080516020615c9e83398151915233612b62565b612afc5760405162461bcd60e51b8152600401610dd99061568e565b612b0581613547565b612b215760405162461bcd60e51b8152600401610dd9906158f1565b60009081526101656020526040812055565b612b3e600033612b62565b612b5a5760405162461bcd60e51b8152600401610dd9906157a9565b611956613f9c565b600091825261012d602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060668054610f2390615507565b611923338383614017565b612bc0600080516020615c9e83398151915233612b62565b612bdc5760405162461bcd60e51b8152600401610dd99061568e565b61016c80546001600160a01b0319166001600160a01b0392909216919091179055565b612c0933836140e1565b612c255760405162461bcd60e51b8152600401610dd99061591f565b611c19848484846141a3565b61016160205260009081526040902080546128e890615507565b6000612c5683613547565b15612d445761238c8310158015612c6f57506124538311155b15612c7c57506001610d2a565b6000838152610165602052604081206002810154909190612ca19062278d0090615815565b905060026000868152610164602052604090205460ff166005811115612cc957612cc961535a565b03612d0e574281108015612ce0575061015f548411155b80612d055750428110158015612d05575061015f548254612d02908690615815565b11155b92505050610d2a565b4281108015612d21575081600101548411155b80612d055750428110158015612d05575060018201548254612d02908690615815565b506000610d2a565b612d64600080516020615c9e83398151915233612b62565b612d805760405162461bcd60e51b8152600401610dd99061568e565b61015f55565b612d9e600080516020615c2c83398151915233612b62565b80612dbc5750612dbc600080516020615c9e83398151915233612b62565b612dd85760405162461bcd60e51b8152600401610dd99061568e565b612de182613547565b612dfd5760405162461bcd60e51b8152600401610dd9906158f1565b60026000838152610164602052604090205460ff166005811115612e2357612e2361535a565b14158015612e5357506000828152610164602052604081205460ff166005811115612e5057612e5061535a565b14155b612eaf5760405162461bcd60e51b815260206004820152602760248201527f4e6f7420696e20636f72726563742073746174757320666f72206c696d69742060448201526618dbdb9d1c9bdb60ca1b6064820152608401610dd9565b6000918252610165602052604090912060010155565b6060612ed082613547565b612f345760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610dd9565b6000612f3e6141d6565b90506000612f67604080518082019091526008815267267374617475733d60c01b602082015290565b90506000612f906040805180820190915260088152672677616c6c65743d60c01b602082015290565b90506000835111612fb05760405180602001604052806000815250613029565b82612fba86613a36565b600087815261016460205260409020548490612fe99060ff166005811115612fe457612fe461535a565b613a36565b60008981526101686020526040902054859061300490613a36565b60405160200161301996959493929190615970565b6040516020818303038152906040525b95945050505050565b61303b82611744565b613045813361383b565b610e678383613926565b6040516331a9108f60e11b8152600481018390523090636352211e90602401602060405180830381865afa15801561308b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130af9190615646565b6001600160a01b0316336001600160a01b0316146130df5760405162461bcd60e51b8152600401610dd990615663565b600082815261016160205260409020610e678282615587565b613110600080516020615c9e83398151915233612b62565b8061312e575061312e600080516020615c2c83398151915233612b62565b61314a5760405162461bcd60e51b8152600401610dd9906158af565b60026000838152610164602052604090205460ff1660058111156131705761317061535a565b146131ab5760405162461bcd60e51b815260206004820152600b60248201526a139bdd08151bdd5c9a5cdd60aa1b6044820152606401610dd9565b6040516331a9108f60e11b8152600481018390528290610160906000903090636352211e90602401602060405180830381865afa1580156131f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132149190615646565b6001600160a01b0316815260208101919091526040016000205561323782613f07565b60008281526101646020526040808220805460ff19166005179055516331a9108f60e11b815261238c60048201523090636352211e90602401602060405180830381865afa15801561328d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132b19190615646565b905073912ce59144191c1204e64559fe8253a0e49e6548670de0b6b3a76400006132dc816014615868565b6040516370a0823160e01b81526001600160a01b038416906370a082319061330890879060040161520e565b602060405180830381865afa158015613325573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061334991906154d5565b101580156133c7575060056040516342d21ef760e01b81526004810186905230906342d21ef790602401602060405180830381865afa158015613390573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133b491906159ef565b60058111156133c5576133c561535a565b145b156134c0576040516331a9108f60e11b81526004810185905261344f9084903090636352211e90602401602060405180830381865afa15801561340e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134329190615646565b61343d84600f615868565b6001600160a01b0386169291906141f6565b6040516331a9108f60e11b8152600481018690526134c09084903090636352211e90602401602060405180830381865afa158015613491573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134b59190615646565b61343d846005615868565b604051849086907fb23db0b1d644ad12d20d90a80bb43bf5ac1f29e365c6fc96137fbf19ce08b91490600090a35050505050565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b60006001600160e01b03198216637965db0b60e01b1480610d2a5750610d2a82614250565b6000908152606760205260409020546001600160a01b0316151590565b600081815260696020526040902080546001600160a01b0319166001600160a01b038416908117909155819061359982611da5565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000825b600a81106135f0576135e981600a614275565b90506135d6565b90911492915050565b600081815b81156136235761360f82600a614275565b915061361c816001614281565b90506135fe565b9392505050565b6040516370a0823160e01b815260009060019030906370a082319061365390879060040161520e565b602060405180830381865afa158015613670573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061369491906154d5565b10801561362357506001600160a01b0383166000908152610160602052604090205415806136235750506001600160a01b0391909116600090815261016060205260409020541490565b6001600160a01b0382166137345760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610dd9565b61373d81613547565b156137895760405162461bcd60e51b815260206004820152601c60248201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b6044820152606401610dd9565b6137956000838361428d565b6001600160a01b03821660009081526068602052604081208054600192906137be908490615815565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b0386169081179091559051839290600080516020615cde833981519152908290a45050565b61381433826140e1565b6138305760405162461bcd60e51b8152600401610dd99061591f565b610e67838383613d6e565b6138458282612b62565b6119235761385d816001600160a01b03166014614826565b613868836020614826565b604051602001613879929190615a0c565b60408051601f198184030181529082905262461bcd60e51b8252610dd9916004016151fb565b6138a98282612b62565b61192357600082815261012d602090815260408083206001600160a01b03851684529091529020805460ff191660011790556138e23390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6139308282612b62565b1561192357600082815261012d602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60c95460ff166139d75760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610dd9565b60c9805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b604051613a11919061520e565b60405180910390a1565b60009081526101656020526040812090815542600290910155565b606081600003613a5d5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115613a875780613a7181615a7b565b9150613a809050600a83615854565b9150613a61565b6000816001600160401b03811115613aa157613aa161508f565b6040519080825280601f01601f191660200182016040528015613acb576020820181803683370190505b5090505b8415613b3657613ae060018361587f565b9150613aed600a86615a94565b613af8906030615815565b60f81b818381518110613b0d57613b0d615828565b60200101906001600160f81b031916908160001a905350613b2f600a86615854565b9450613acf565b949350505050565b610e6783838360405180602001604052806000815250612bff565b6000613b6482611da5565b9050613b728160008461428d565b613b7d600083613564565b6001600160a01b0381166000908152606860205260408120805460019290613ba690849061587f565b909155505060008281526067602052604080822080546001600160a01b0319169055518391906001600160a01b03841690600080516020615cde833981519152908390a45050565b61016754600160a01b900460ff16613c3a5760405162461bcd60e51b815260206004820152600f60248201526e46323420697320696e61637469766560881b6044820152606401610dd9565b613c458160096135d2565b15613c625760405162461bcd60e51b8152600401610dd990615702565b61016654610100900460ff16613c77826135f9565b1115613c955760405162461bcd60e51b8152600401610dd9906156b7565b613c9f338261362a565b613d015760405162461bcd60e51b815260206004820152602d60248201527f4e6f7420616c6c6f7765642e205468652061646472657373206861732f68616460448201526c1030b737ba3432b91027232a1760991b6064820152608401610dd9565b613d0b33826136de565b600081815261016460205260409020805460ff19166002179055613d2e81613a1b565b613d3781613a36565b604051602001613d4791906157cf565b60408051601f19818403018152918152600083815261016160205220906119239082615587565b826001600160a01b0316613d8182611da5565b6001600160a01b031614613de95760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610dd9565b6001600160a01b038216613e4b5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610dd9565b613e5683838361428d565b613e61600082613564565b6001600160a01b0383166000908152606860205260408120805460019290613e8a90849061587f565b90915550506001600160a01b0382166000908152606860205260408120805460019290613eb8908490615815565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b038681169182179092559151849391871691600080516020615cde83398151915291a4505050565b600090815261016560205260408120908155620186a0600182015542600290910155565b600054610100900460ff166119565760405162461bcd60e51b8152600401610dd990615aa8565b600054610100900460ff16613f795760405162461bcd60e51b8152600401610dd990615aa8565b6065613f858382615587565b506066610e678282615587565b611923828261389f565b60c95460ff1615613fe25760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610dd9565b60c9805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258613a043390565b816001600160a01b0316836001600160a01b0316036140745760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b6044820152606401610dd9565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b60006140ec82613547565b61414d5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610dd9565b600061415883611da5565b9050806001600160a01b0316846001600160a01b031614806141935750836001600160a01b031661418884610fa6565b6001600160a01b0316145b80613b365750613b3681856134f4565b6141ae848484613d6e565b6141ba848484846149c1565b611c195760405162461bcd60e51b8152600401610dd990615af3565b6060604051806060016040528060328152602001615c6c60329139905090565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611c19908590614ac2565b60006001600160e01b0319821663780e9d6360e01b1480610d2a5750610d2a82614b94565b60006136238284615854565b60006136238284615815565b60c95460ff16156142de5760405162461bcd60e51b815260206004820152601b60248201527a1058d8dbdd5b9d081d1c985b9cd9995c9cc81cdd5cdc195b991959602a1b6044820152606401610dd9565b813b151580156142f657506001600160a01b03831615155b156143c05760026040516342d21ef760e01b81526004810183905230906342d21ef790602401602060405180830381865afa158015614339573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061435d91906159ef565b600581111561436e5761436e61535a565b146143bb5760405162461bcd60e51b815260206004820152601f60248201527f4e6f7420616c6c6f77656420746f207472616e73666572206163636f756e74006044820152606401610dd9565b61481b565b6001600160a01b038316158015906143e057506001600160a01b03821615155b1561481b576143f0612392613547565b156146a35760016144008361262c565b10801561444657506001600160a01b03821660009081526101606020526040902054158061444657506001600160a01b0382166000908152610160602052604090205481145b806144d75750614457826000611813565b6123921480156144d7575060046040516342d21ef760e01b81526004810183905230906342d21ef790602401602060405180830381865afa1580156144a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144c491906159ef565b60058111156144d5576144d561535a565b145b6144f35760405162461bcd60e51b8152600401610dd990615738565b60056040516342d21ef760e01b81526004810183905230906342d21ef790602401602060405180830381865afa158015614531573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061455591906159ef565b60058111156145665761456661535a565b14806145e2575060026040516342d21ef760e01b81526004810183905230906342d21ef790602401602060405180830381865afa1580156145ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145cf91906159ef565b60058111156145e0576145e061535a565b145b80614687575060006145f38361262c565b11801561460b5750614606826000611813565b612392145b8015614687575060046040516342d21ef760e01b81526004810183905230906342d21ef790602401602060405180830381865afa158015614650573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061467491906159ef565b60058111156146855761468561535a565b145b6143bb5760405162461bcd60e51b8152600401610dd990615b45565b60016146ae8361262c565b1080156146f457506001600160a01b0382166000908152610160602052604090205415806146f457506001600160a01b0382166000908152610160602052604090205481145b6147105760405162461bcd60e51b8152600401610dd990615738565b60056040516342d21ef760e01b81526004810183905230906342d21ef790602401602060405180830381865afa15801561474e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061477291906159ef565b60058111156147835761478361535a565b14806147ff575060026040516342d21ef760e01b81526004810183905230906342d21ef790602401602060405180830381865afa1580156147c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906147ec91906159ef565b60058111156147fd576147fd61535a565b145b61481b5760405162461bcd60e51b8152600401610dd990615b45565b610e67838383614be4565b60606000614835836002615868565b614840906002615815565b6001600160401b038111156148575761485761508f565b6040519080825280601f01601f191660200182016040528015614881576020820181803683370190505b509050600360fc1b8160008151811061489c5761489c615828565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106148cb576148cb615828565b60200101906001600160f81b031916908160001a90535060006148ef846002615868565b6148fa906001615815565b90505b6001811115614972576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061492e5761492e615828565b1a60f81b82828151811061494457614944615828565b60200101906001600160f81b031916908160001a90535060049490941c9361496b81615b88565b90506148fd565b5083156136235760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610dd9565b60006001600160a01b0384163b15614ab757604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290614a05903390899088908890600401615b9f565b6020604051808303816000875af1925050508015614a40575060408051601f3d908101601f19168201909252614a3d91810190615bdc565b60015b614a9d573d808015614a6e576040519150601f19603f3d011682016040523d82523d6000602084013e614a73565b606091505b508051600003614a955760405162461bcd60e51b8152600401610dd990615af3565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050613b36565b506001949350505050565b6000614b17826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614c569092919063ffffffff16565b805190915015610e675780806020019051810190614b359190615892565b610e675760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610dd9565b60006001600160e01b031982166380ac58cd60e01b1480614bc557506001600160e01b03198216635b5e139f60e01b145b80610d2a57506301ffc9a760e01b6001600160e01b0319831614610d2a565b614bef838383614c65565b60c95460ff1615610e675760405162461bcd60e51b815260206004820152602b60248201527f4552433732315061757361626c653a20746f6b656e207472616e73666572207760448201526a1a1a5b19481c185d5cd95960aa1b6064820152608401610dd9565b6060613b368484600085614d1d565b6001600160a01b038316614cc057614cbb81609980546000838152609a60205260408120829055600182018355919091527f72a152ddfb8e864297c917af52ea6c1c68aead0fee1a62673fcc7e0c94979d000155565b614ce3565b816001600160a01b0316836001600160a01b031614614ce357614ce38382614e45565b6001600160a01b038216614cfa57610e6781614ee2565b826001600160a01b0316826001600160a01b031614610e6757610e678282614f91565b606082471015614d7e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610dd9565b843b614dcc5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610dd9565b600080866001600160a01b03168587604051614de89190615bf9565b60006040518083038185875af1925050503d8060008114614e25576040519150601f19603f3d011682016040523d82523d6000602084013e614e2a565b606091505b5091509150614e3a828286614fd5565b979650505050505050565b60006001614e528461262c565b614e5c919061587f565b600083815260986020526040902054909150808214614eaf576001600160a01b03841660009081526097602090815260408083208584528252808320548484528184208190558352609890915290208190555b5060009182526098602090815260408084208490556001600160a01b039094168352609781528383209183525290812055565b609954600090614ef49060019061587f565b6000838152609a602052604081205460998054939450909284908110614f1c57614f1c615828565b906000526020600020015490508060998381548110614f3d57614f3d615828565b6000918252602080832090910192909255828152609a90915260408082208490558582528120556099805480614f7557614f75615c15565b6001900381819060005260206000200160009055905550505050565b6000614f9c8361262c565b6001600160a01b039093166000908152609760209081526040808320868452825280832085905593825260989052919091209190915550565b60608315614fe4575081613623565b825115614ff45782518084602001fd5b8160405162461bcd60e51b8152600401610dd991906151fb565b50805461501a90615507565b6000825580601f1061502a575050565b601f016020900490600052602060002090810190611aee91905b808211156150585760008155600101615044565b5090565b6001600160e01b031981168114611aee57600080fd5b60006020828403121561508457600080fd5b81356136238161505c565b634e487b7160e01b600052604160045260246000fd5b60006001600160401b03808411156150bf576150bf61508f565b604051601f8501601f19908116603f011681019082821181831017156150e7576150e761508f565b8160405280935085815286868601111561510057600080fd5b858560208301376000602087830101525050509392505050565b600082601f83011261512b57600080fd5b613623838335602085016150a5565b60006020828403121561514c57600080fd5b81356001600160401b0381111561516257600080fd5b613b368482850161511a565b60006020828403121561518057600080fd5b5035919050565b60005b838110156151a257818101518382015260200161518a565b50506000910152565b600081518084526151c3816020860160208601615187565b601f01601f19169290920160200192915050565b6040815260006151ea60408301856151ab565b905082151560208301529392505050565b60208152600061362360208301846151ab565b6001600160a01b0391909116815260200190565b6001600160a01b0381168114611aee57600080fd5b6000806040838503121561524a57600080fd5b823561525581615222565b946020939093013593505050565b60006020828403121561527557600080fd5b813561362381615222565b6000806040838503121561529357600080fd5b8235915060208301356001600160401b038111156152b057600080fd5b6152bc8582860161511a565b9150509250929050565b6000806000606084860312156152db57600080fd5b83356152e681615222565b925060208401356152f681615222565b929592945050506040919091013590565b60006020828403121561531957600080fd5b813560ff8116811461362357600080fd5b6000806040838503121561533d57600080fd5b82359150602083013561534f81615222565b809150509250929050565b634e487b7160e01b600052602160045260246000fd5b602081016006831061539257634e487b7160e01b600052602160045260246000fd5b91905290565b600080604083850312156153ab57600080fd5b50508035926020909101359150565b60068110611aee57600080fd5b600080604083850312156153da57600080fd5b82359150602083013561534f816153ba565b600080604083850312156153ff57600080fd5b823561540a81615222565b9150602083013561534f81615222565b8015158114611aee57600080fd5b6000806040838503121561543b57600080fd5b823561544681615222565b9150602083013561534f8161541a565b6000806000806080858703121561546c57600080fd5b843561547781615222565b9350602085013561548781615222565b92506040850135915060608501356001600160401b038111156154a957600080fd5b8501601f810187136154ba57600080fd5b6154c9878235602084016150a5565b91505092959194509250565b6000602082840312156154e757600080fd5b5051919050565b6001600160a01b03929092168252602082015260400190565b600181811c9082168061551b57607f821691505b60208210810361553b57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115610e6757600081815260208120601f850160051c810160208610156155685750805b601f850160051c820191505b81811015611d9d57828155600101615574565b81516001600160401b038111156155a0576155a061508f565b6155b4816155ae8454615507565b84615541565b602080601f8311600181146155e957600084156155d15750858301515b600019600386901b1c1916600185901b178555611d9d565b600085815260208120601f198616915b82811015615618578886015182559484019460019091019084016155f9565b50858210156156365787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006020828403121561565857600080fd5b815161362381615222565b6020808252601190820152702737ba1030b1b1b7bab73a1037bbb732b960791b604082015260600190565b6020808252600f908201526e2737ba1030b71037b832b930ba37b960891b604082015260600190565b6020808252602b908201527f4e756d626572206f6620646967697473206f66206163636f756e744964203e2060408201526a6d61782e2064696769747360a81b606082015260800190565b6020808252601c908201527b0e5e1e0818d85b9b9bdd081899481b5a5b9d08189e4818db1a595b9d60221b604082015260600190565b6020808252604b908201527f4e6f7420616c6c6f7765642e205468652074617267657420616464726573732060408201527f68617320616e206163636f756e74206f72206f6e63652068616420616e6f746860608201526a32b91030b1b1b7bab73a1760a91b608082015260a00190565b6020808252600c908201526b2737ba1030b71030b236b4b760a11b604082015260600190565b67020b1b1b7bab73a160c51b8152600082516157f2816008850160208701615187565b9190910160080192915050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610d2a57610d2a6157ff565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6000826158635761586361583e565b500490565b8082028115828204841417610d2a57610d2a6157ff565b81810381811115610d2a57610d2a6157ff565b6000602082840312156158a457600080fd5b81516136238161541a565b60208082526022908201527f4e6f7420616e206f70657261746f722f636c69656e747374617475736368616e604082015261676560f01b606082015260800190565b602080825260149082015273151bdad95b88191bd95cc81b9bdd08195e1a5cdd60621b604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6000875160206159838285838d01615187565b8851918401916159968184848d01615187565b88519201916159a88184848c01615187565b87519201916159ba8184848b01615187565b86519201916159cc8184848a01615187565b85519201916159de8184848901615187565b919091019998505050505050505050565b600060208284031215615a0157600080fd5b8151613623816153ba565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351615a3e816017850160208801615187565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615a6f816028840160208801615187565b01602801949350505050565b600060018201615a8d57615a8d6157ff565b5060010190565b600082615aa357615aa361583e565b500690565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526023908201527f5472616e73666572206e6f7420616c6c6f77656420696e20746869732073746160408201526274757360e81b606082015260800190565b600081615b9757615b976157ff565b506000190190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090615bd2908301846151ab565b9695505050505050565b600060208284031215615bee57600080fd5b81516136238161505c565b60008251615c0b818460208701615187565b9190910192915050565b634e487b7160e01b600052603160045260246000fdfef2a163c55699a912c8908f55eafbd268811e90fb1b12c3601e6cc1cabd48a525ebb9a89f0ec4a68c7ff3381441395232db5fb2a2ec04968228ce2332afd4a5d968747470733a2f2f6170692e646566692e736170686972737465696e2e636f6d2f6d657461646174613f746f6b656e69643d97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b9299f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212202dcc41d75d0fe7fbdeffc40deff510883459672ece598f8cf96435b85945925b64736f6c63430008120033
Deployed Bytecode
0x6080604052600436106103415760003560e01c8063013e53d11461034657806301ffc9a71461037b578063023b62a2146103ab5780630264e7e9146103cd57806306fdde03146103fb578063081812fc1461041d578063095ea7b31461044a578063099d2ec81461046a5780630aebeb4e146104815780630e8477f8146104a157806310480e13146104c15780631278e2d2146104e157806318160ddd1461050857806321d39e5a1461051d57806323b872dd1461053d578063243bcfcb1461055d578063248a9ca3146105b557806324a933eb146105d55780632856784b146105ea5780632ac354851461060a5780632af047901461062a5780632f2ff15d146106585780632f745c591461067857806336568abe146106985780633ea3ab8e146106b85780633f4ba83a146106d857806340c10f19146106ed57806342842e0e1461070d57806342966c681461072d57806342d21ef71461074d5780634bedccf41461078b5780634f558e79146107ab5780634f6ccce7146107cb57806356ecb92b146107eb578063592b2051146108025780635c975abb146108225780636352211e1461083a57806368800cd31461085a5780636917574a146108885780636a183f451461089f5780636a46a1b7146108bf5780636abd75c3146108df578063701eec93146108f257806370a082311461092357806370def791146109435780637115fb42146109635780637220b199146109835780637d9b67ee1461099e57806380f669df146109be5780638129fc1c146109de57806383561e84146109f35780638456cb5914610a1357806391d1485414610a285780639397031114610a4857806395d89b4114610a695780639630571914610a7e5780639ffa6e9714610aac578063a217fddf14610ada578063a22cb46514610aef578063b51243ec14610b0f578063b88d4fde14610b2f578063b9464c9314610b4f578063c1cccc7014610b64578063c36eeea814610b84578063c7b4b68914610ba4578063c81472b414610bc4578063c87b56dd14610be4578063d539139314610c04578063d547741f14610c26578063d92af1b714610c46578063df9e739a14610c66578063e985e9c514610c86578063e9d2b1b314610ca6578063f5b541a614610cc8575b600080fd5b34801561035257600080fd5b50610368600080516020615c4c83398151915281565b6040519081526020015b60405180910390f35b34801561038757600080fd5b5061039b610396366004615072565b610cea565b6040519015158152602001610372565b3480156103b757600080fd5b506103cb6103c636600461513a565b610d30565b005b3480156103d957600080fd5b506103ed6103e836600461516e565b610e6c565b6040516103729291906151d7565b34801561040757600080fd5b50610410610f14565b60405161037291906151fb565b34801561042957600080fd5b5061043d61043836600461516e565b610fa6565b604051610372919061520e565b34801561045657600080fd5b506103cb610465366004615237565b61102e565b34801561047657600080fd5b50610368620186a081565b34801561048d57600080fd5b506103cb61049c36600461516e565b611139565b3480156104ad57600080fd5b506103cb6104bc366004615263565b61124a565b3480156104cd57600080fd5b506103cb6104dc366004615237565b611299565b3480156104ed57600080fd5b506104f6600981565b60405160ff9091168152602001610372565b34801561051457600080fd5b50609954610368565b34801561052957600080fd5b506103cb610538366004615280565b61167f565b34801561054957600080fd5b506103cb6105583660046152c6565b6116ef565b34801561056957600080fd5b5061059a61057836600461516e565b6101656020526000908152604090208054600182015460029092015490919083565b60408051938452602084019290925290820152606001610372565b3480156105c157600080fd5b506103686105d036600461516e565b611744565b3480156105e157600080fd5b50610368603781565b3480156105f657600080fd5b506103cb610605366004615307565b61175a565b34801561061657600080fd5b506103cb610625366004615307565b6117a5565b34801561063657600080fd5b50610368610645366004615263565b6101606020526000908152604090205481565b34801561066457600080fd5b506103cb61067336600461532a565b6117f6565b34801561068457600080fd5b50610368610693366004615237565b611813565b3480156106a457600080fd5b506103cb6106b336600461532a565b6118a9565b3480156106c457600080fd5b50610166546104f690610100900460ff1681565b3480156106e457600080fd5b506103cb611927565b3480156106f957600080fd5b506103cb610708366004615237565b611958565b34801561071957600080fd5b506103cb6107283660046152c6565b611a89565b34801561073957600080fd5b506103cb61074836600461516e565b611a94565b34801561075957600080fd5b5061077e61076836600461516e565b6101646020526000908152604090205460ff1681565b6040516103729190615370565b34801561079757600080fd5b506103cb6107a6366004615398565b611af1565b3480156107b757600080fd5b5061039b6107c636600461516e565b611c1f565b3480156107d757600080fd5b506103686107e636600461516e565b611c2a565b3480156107f757600080fd5b5061036862278d0081565b34801561080e57600080fd5b506103cb61081d36600461516e565b611cbd565b34801561082e57600080fd5b5060c95460ff1661039b565b34801561084657600080fd5b5061043d61085536600461516e565b611da5565b34801561086657600080fd5b5061036861087536600461516e565b6101686020526000908152604090205481565b34801561089457600080fd5b5061036861015f5481565b3480156108ab57600080fd5b506103cb6108ba36600461516e565b611e1c565b3480156108cb57600080fd5b506103cb6108da36600461516e565b6122b9565b6103cb6108ed36600461516e565b612316565b3480156108fe57600080fd5b5061039b61090d36600461516e565b6101626020526000908152604090205460ff1681565b34801561092f57600080fd5b5061036861093e366004615263565b61262c565b34801561094f57600080fd5b506103cb61095e3660046153c7565b6126b3565b34801561096f57600080fd5b506103cb61097e366004615398565b61280f565b34801561098f57600080fd5b50610166546104f69060ff1681565b3480156109aa57600080fd5b506103cb6109b93660046153ec565b612856565b3480156109ca57600080fd5b506104106109d936600461516e565b6128ce565b3480156109ea57600080fd5b506103cb612969565b3480156109ff57600080fd5b506103cb610a0e36600461516e565b612ac8565b348015610a1f57600080fd5b506103cb612b33565b348015610a3457600080fd5b5061039b610a4336600461532a565b612b62565b348015610a5457600080fd5b5061016c5461043d906001600160a01b031681565b348015610a7557600080fd5b50610410612b8e565b348015610a8a57600080fd5b50610368610a9936600461516e565b61016b6020526000908152604090205481565b348015610ab857600080fd5b50610368610ac736600461516e565b6101636020526000908152604090205481565b348015610ae657600080fd5b50610368600081565b348015610afb57600080fd5b506103cb610b0a366004615428565b612b9d565b348015610b1b57600080fd5b506103cb610b2a366004615263565b612ba8565b348015610b3b57600080fd5b506103cb610b4a366004615456565b612bff565b348015610b5b57600080fd5b506104f6600881565b348015610b7057600080fd5b50610410610b7f36600461516e565b612c31565b348015610b9057600080fd5b5061039b610b9f366004615398565b612c4b565b348015610bb057600080fd5b506103cb610bbf36600461516e565b612d4c565b348015610bd057600080fd5b506103cb610bdf366004615398565b612d86565b348015610bf057600080fd5b50610410610bff36600461516e565b612ec5565b348015610c1057600080fd5b50610368600080516020615cbe83398151915281565b348015610c3257600080fd5b506103cb610c4136600461532a565b613032565b348015610c5257600080fd5b506103cb610c61366004615280565b61304f565b348015610c7257600080fd5b506103cb610c81366004615398565b6130f8565b348015610c9257600080fd5b5061039b610ca13660046153ec565b6134f4565b348015610cb257600080fd5b50610368600080516020615c2c83398151915281565b348015610cd457600080fd5b50610368600080516020615c9e83398151915281565b60006001600160e01b031982166380ac58cd60e01b1480610d1b57506001600160e01b03198216635b5e139f60e01b145b80610d2a5750610d2a82613522565b92915050565b6040516370a0823160e01b815260009030906370a0823190610d5690339060040161520e565b602060405180830381865afa158015610d73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9791906154d5565b11610de25760405162461bcd60e51b81526020600482015260166024820152751059191c995cdcc81a185cc81b9bc81858d8dbdd5b9d60521b60448201526064015b60405180910390fd5b604051632f745c5960e01b81526000903090632f745c5990610e0a90339085906004016154ee565b602060405180830381865afa158015610e27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4b91906154d5565b600081815261016a60205260409020909150610e678382615587565b505050565b61016960205260009081526040902080548190610e8890615507565b80601f0160208091040260200160405190810160405280929190818152602001828054610eb490615507565b8015610f015780601f10610ed657610100808354040283529160200191610f01565b820191906000526020600020905b815481529060010190602001808311610ee457829003601f168201915b5050506001909301549192505060ff1682565b606060658054610f2390615507565b80601f0160208091040260200160405190810160405280929190818152602001828054610f4f90615507565b8015610f9c5780601f10610f7157610100808354040283529160200191610f9c565b820191906000526020600020905b815481529060010190602001808311610f7f57829003601f168201915b5050505050905090565b6000610fb182613547565b6110125760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610dd9565b506000908152606960205260409020546001600160a01b031690565b600061103982611da5565b9050806001600160a01b0316836001600160a01b0316036110a65760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610dd9565b336001600160a01b03821614806110c257506110c281336134f4565b61112f5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776044820152771b995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b60421b6064820152608401610dd9565b610e678383613564565b6040516331a9108f60e11b8152600481018290523090636352211e90602401602060405180830381865afa158015611175573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111999190615646565b6001600160a01b0316336001600160a01b0316146111c95760405162461bcd60e51b8152600401610dd990615663565b60056000828152610164602052604090205460ff1660058111156111ef576111ef61535a565b1461122e5760405162461bcd60e51b815260206004820152600f60248201526e139bdd081b1a5d994818db1a595b9d608a1b6044820152606401610dd9565b600090815261016460205260409020805460ff19166004179055565b611262600080516020615c9e83398151915233612b62565b61127e5760405162461bcd60e51b8152600401610dd99061568e565b6001600160a01b031660009081526101606020526040812055565b6040516370a0823160e01b815260009030906370a08231906112bf90339060040161520e565b602060405180830381865afa1580156112dc573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130091906154d5565b1161134d5760405162461bcd60e51b815260206004820152601e60248201527f4d696e74696e67206164647265737320686173206e6f206163636f756e7400006044820152606401610dd9565b604051632f745c5960e01b81526000903090632f745c599061137590339085906004016154ee565b602060405180830381865afa158015611392573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b691906154d5565b90506113c38160086135d2565b80156113dd5750600881101580156113dd57506123278111155b6114295760405162461bcd60e51b815260206004820152601f60248201527f496e636f7272656374206163636f756e7420696420666f722077616c6c6574006044820152606401610dd9565b6000818152610169602052604090206001015460ff166114895760405162461bcd60e51b815260206004820152601b60248201527a20b1b1b7bab73a103737ba103bb0b63632ba10383937bb34b232b960291b6044820152606401610dd9565b6005611494836135f9565b10156114f15760405162461bcd60e51b815260206004820152602660248201527f6d696e74427957616c6c6574206f6e6c7920666f7220352b2064696769747320604482015265746f6b656e7360d01b6064820152608401610dd9565b61016654610100900460ff16611506836135f9565b11156115245760405162461bcd60e51b8152600401610dd9906156b7565b61152f8260096135d2565b1561154c5760405162461bcd60e51b8152600401610dd990615702565b6115578260086135d2565b156115b85760405162461bcd60e51b815260206004820152602b60248201527f4d65726368616e74206163636f756e742063616e6e6f74206265206d696e746560448201526a1908189e481dd85b1b195d60aa1b6064820152608401610dd9565b6115c2838361362a565b6115de5760405162461bcd60e51b8152600401610dd990615738565b6000828152610168602090815260408083208490556101649091529020805460ff1916600217905561161083836136de565b610166546201000090046001600160a01b03166379cc67903360646040518363ffffffff1660e01b81526004016116489291906154ee565b600060405180830381600087803b15801561166257600080fd5b505af1158015611676573d6000803e3d6000fd5b50505050505050565b611697600080516020615c9e83398151915233612b62565b6116b35760405162461bcd60e51b8152600401610dd99061568e565b6000828152610169602052604090206116cc8282615587565b50506000908152610169602052604090206001908101805460ff19169091179055565b6116fa83838361380a565b60026000828152610164602052604090205460ff1660058111156117205761172061535a565b14610e67576001600160a01b03919091166000908152610160602052604090205550565b600090815261012d602052604090206001015490565b611772600080516020615c9e83398151915233612b62565b61178e5760405162461bcd60e51b8152600401610dd99061568e565b610166805460ff191660ff92909216919091179055565b6117bd600080516020615c9e83398151915233612b62565b6117d95760405162461bcd60e51b8152600401610dd99061568e565b610166805460ff9092166101000261ff0019909216919091179055565b6117ff82611744565b611809813361383b565b610e67838361389f565b600061181e8361262c565b82106118805760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610dd9565b506001600160a01b03919091166000908152609760209081526040808320938352929052205490565b6001600160a01b03811633146119195760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610dd9565b6119238282613926565b5050565b611932600033612b62565b61194e5760405162461bcd60e51b8152600401610dd9906157a9565b61195661398e565b565b611970600080516020615c9e83398151915233612b62565b8061198e575061198e600080516020615cbe83398151915233612b62565b6119d35760405162461bcd60e51b81526020600482015260166024820152752737ba1030b71037b832b930ba37b917b6b4b73a32b960511b6044820152606401610dd9565b6119dd828261362a565b611a1c5760405162461bcd60e51b815260206004820152601060248201526f1b5a5b9d081b9bdd08185b1b1bddd95960821b6044820152606401610dd9565b611a2682826136de565b600081815261016460205260409020805460ff19166002179055611a4981613a1b565b611a5281613a36565b604051602001611a6291906157cf565b60408051601f1981840301815291815260008381526101616020522090610e679082615587565b6116fa838383613b3e565b611aac600080516020615c9e83398151915233612b62565b611ac85760405162461bcd60e51b8152600401610dd99061568e565b6000818152610165602052604081208181556001810182905560020155611aee81613b59565b50565b611b09600080516020615c4c83398151915233612b62565b611b4b5760405162461bcd60e51b81526020600482015260136024820152722737ba1030903634b6b4ba16bab83230ba32b960691b6044820152606401610dd9565b61238c8210158015611b5f57506124538211155b15611b68575050565b60056000838152610164602052604090205460ff166005811115611b8e57611b8e61535a565b1480611bbd575060026000838152610164602052604090205460ff166005811115611bbb57611bbb61535a565b145b15611923576000828152610165602052604081206002810154909190611be79062278d0090615815565b905042811015611bff57426002830155828255611c19565b82826000016000828254611c139190615815565b90915550505b50505050565b6000610d2a82613547565b6000611c3560995490565b8210611c985760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610dd9565b60998281548110611cab57611cab615828565b90600052602060002001549050919050565b611cc681613bee565b61016754604051630e75722360e41b8152600481018390526000916001600160a01b03169063e757223090602401602060405180830381865afa158015611d11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d3591906154d5565b6101665460405163079cc67960e41b81529192506201000090046001600160a01b0316906379cc679090611d6f90339085906004016154ee565b600060405180830381600087803b158015611d8957600080fd5b505af1158015611d9d573d6000803e3d6000fd5b505050505050565b6000818152606760205260408120546001600160a01b031680610d2a5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610dd9565b604051632f745c5960e01b81526000903090632f745c5990611e4490339085906004016154ee565b602060405180830381865afa158015611e61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e8591906154d5565b905060056000828152610164602052604090205460ff166005811115611ead57611ead61535a565b14611eec5760405162461bcd60e51b815260206004820152600f60248201526e139bdd08131a5d994818db1a595b9d608a1b6044820152606401610dd9565b61016754600160a01b900460ff16611f425760405162461bcd60e51b8152602060048201526019602482015278546869732066756e6374696f6e20697320696e61637469766560381b6044820152606401610dd9565b6005611f4d836135f9565b10611f9a5760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c79207072656d69756d206e756d62657220666f722075706772616465006044820152606401610dd9565b611fa58260096135d2565b156120065760405162461bcd60e51b815260206004820152602b60248201527f496e7465726e616c206163636f756e7449642063616e6e6f74206265206d696e60448201526a1d08189e4818db1a595b9d60aa1b6064820152608401610dd9565b6120118260086135d2565b1561206c576120218160086135d2565b61206c5760405162461bcd60e51b815260206004820152601c60248201527b13db19081d1bdad95b881b5d5cdd0818994818481b595c98da185b9d60221b6044820152606401610dd9565b6120778160086135d2565b156120d2576120878260086135d2565b6120d25760405162461bcd60e51b815260206004820152601c60248201527b13995dc81d1bdad95b881b5d5cdd0818994818481b595c98da185b9d60221b6044820152606401610dd9565b61016754604051630e75722360e41b8152600481018490526000916001600160a01b03169063e757223090602401602060405180830381865afa15801561211d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061214191906154d5565b9050806000036121935760405162461bcd60e51b815260206004820181905260248201527f4163636f756e744964206e6f7420617661696c61626c6520666f722073616c656044820152606401610dd9565b600082815261016460205260409020805460ff191660041790556121ca6121b983611da5565b6121c4612392611da5565b84613d6e565b6121d433846136de565b6000838152610164602090815260408083208054600560ff1990911617905533808452610160835281842087905585845261016883528184205487855282852055858452610165835281842087855282852060018281015490820155815481556002808301549082015561016b9094529382902086905561016654915163079cc67960e41b8152620100009092046001600160a01b0316916379cc6790916122809187906004016154ee565b600060405180830381600087803b15801561229a57600080fd5b505af11580156122ae573d6000803e3d6000fd5b505050505050505050565b6122d1600080516020615c9e83398151915233612b62565b6122ed5760405162461bcd60e51b8152600401610dd99061568e565b60008181526101696020526040812090612307828261500e565b50600101805460ff1916905550565b61231f81613bee565b61016754604051630e75722360e41b8152600481018390526000916001600160a01b03169063e757223090602401602060405180830381865afa15801561236a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061238e91906154d5565b905060008061016c60009054906101000a90046001600160a01b03166001600160a01b031663bead08d66040518163ffffffff1660e01b8152600401602060405180830381865afa1580156123e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061240b91906154d5565b9050828110156124385761241f8184615854565b61243190670de0b6b3a7640000615868565b9150612457565b6124428382615854565b61245490670de0b6b3a7640000615854565b91505b813410156124b95760405162461bcd60e51b815260206004820152602960248201527f4e6f742073756666696369656e74206d73672e76616c756520666f722046323460448201526820707572636861736560b81b6064820152608401610dd9565b600061016c60009054906101000a90046001600160a01b03166001600160a01b031663a6f2ae3a346040518263ffffffff1660e01b815260040160206040518083038185885af1158015612511573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061253691906154d5565b61016654604051630852cd8d60e31b8152600481018790529192506201000090046001600160a01b0316906342966c6890602401600060405180830381600087803b15801561258457600080fd5b505af1158015612598573d6000803e3d6000fd5b50505050600084826125aa919061587f565b90508015611d9d57610166546201000090046001600160a01b031663a9059cbb33836040518363ffffffff1660e01b81526004016125e99291906154ee565b6020604051808303816000875af1158015612608573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116769190615892565b60006001600160a01b0382166126975760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610dd9565b506001600160a01b031660009081526068602052604090205490565b6126cb600080516020615c9e83398151915233612b62565b806126e957506126e9600080516020615c2c83398151915233612b62565b6127055760405162461bcd60e51b8152600401610dd9906158af565b60058160058111156127195761271961535a565b148015612749575060026000838152610164602052604090205460ff1660058111156127475761274761535a565b145b156127da576040516331a9108f60e11b8152600481018390528290610160906000903090636352211e90602401602060405180830381865afa158015612793573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127b79190615646565b6001600160a01b031681526020810191909152604001600020556127da82613f07565b600082815261016460205260409020805482919060ff191660018360058111156128065761280661535a565b02179055505050565b612827600080516020615c9e83398151915233612b62565b6128435760405162461bcd60e51b8152600401610dd99061568e565b6000918252610163602052604090912055565b61286e600080516020615c9e83398151915233612b62565b61288a5760405162461bcd60e51b8152600401610dd99061568e565b61016680546001600160a01b03938416620100000262010000600160b01b031990911617905561016780546001600160a81b0319169190921617600160a01b179055565b61016a60205260009081526040902080546128e890615507565b80601f016020809104026020016040519081016040528092919081815260200182805461291490615507565b80156129615780601f1061293657610100808354040283529160200191612961565b820191906000526020600020905b81548152906001019060200180831161294457829003601f168201915b505050505081565b600054610100900460ff166129845760005460ff1615612988565b303b155b6129eb5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610dd9565b600054610100900460ff16158015612a0d576000805461ffff19166101011790555b612a15613f2b565b612a636040518060400160405280600e81526020016d119a585d0c8d081058d8dbdd5b9d60921b81525060405180604001604052806006815260200165119a585d0c8d60d21b815250613f52565b612a6b613f2b565b610166805461ffff1916610505179055610167805460ff60a01b19169055620186a061015f55612a9c600033613f92565b612ab4600080516020615c9e83398151915233613f92565b8015611aee576000805461ff001916905550565b612ae0600080516020615c9e83398151915233612b62565b612afc5760405162461bcd60e51b8152600401610dd99061568e565b612b0581613547565b612b215760405162461bcd60e51b8152600401610dd9906158f1565b60009081526101656020526040812055565b612b3e600033612b62565b612b5a5760405162461bcd60e51b8152600401610dd9906157a9565b611956613f9c565b600091825261012d602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060668054610f2390615507565b611923338383614017565b612bc0600080516020615c9e83398151915233612b62565b612bdc5760405162461bcd60e51b8152600401610dd99061568e565b61016c80546001600160a01b0319166001600160a01b0392909216919091179055565b612c0933836140e1565b612c255760405162461bcd60e51b8152600401610dd99061591f565b611c19848484846141a3565b61016160205260009081526040902080546128e890615507565b6000612c5683613547565b15612d445761238c8310158015612c6f57506124538311155b15612c7c57506001610d2a565b6000838152610165602052604081206002810154909190612ca19062278d0090615815565b905060026000868152610164602052604090205460ff166005811115612cc957612cc961535a565b03612d0e574281108015612ce0575061015f548411155b80612d055750428110158015612d05575061015f548254612d02908690615815565b11155b92505050610d2a565b4281108015612d21575081600101548411155b80612d055750428110158015612d05575060018201548254612d02908690615815565b506000610d2a565b612d64600080516020615c9e83398151915233612b62565b612d805760405162461bcd60e51b8152600401610dd99061568e565b61015f55565b612d9e600080516020615c2c83398151915233612b62565b80612dbc5750612dbc600080516020615c9e83398151915233612b62565b612dd85760405162461bcd60e51b8152600401610dd99061568e565b612de182613547565b612dfd5760405162461bcd60e51b8152600401610dd9906158f1565b60026000838152610164602052604090205460ff166005811115612e2357612e2361535a565b14158015612e5357506000828152610164602052604081205460ff166005811115612e5057612e5061535a565b14155b612eaf5760405162461bcd60e51b815260206004820152602760248201527f4e6f7420696e20636f72726563742073746174757320666f72206c696d69742060448201526618dbdb9d1c9bdb60ca1b6064820152608401610dd9565b6000918252610165602052604090912060010155565b6060612ed082613547565b612f345760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610dd9565b6000612f3e6141d6565b90506000612f67604080518082019091526008815267267374617475733d60c01b602082015290565b90506000612f906040805180820190915260088152672677616c6c65743d60c01b602082015290565b90506000835111612fb05760405180602001604052806000815250613029565b82612fba86613a36565b600087815261016460205260409020548490612fe99060ff166005811115612fe457612fe461535a565b613a36565b60008981526101686020526040902054859061300490613a36565b60405160200161301996959493929190615970565b6040516020818303038152906040525b95945050505050565b61303b82611744565b613045813361383b565b610e678383613926565b6040516331a9108f60e11b8152600481018390523090636352211e90602401602060405180830381865afa15801561308b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130af9190615646565b6001600160a01b0316336001600160a01b0316146130df5760405162461bcd60e51b8152600401610dd990615663565b600082815261016160205260409020610e678282615587565b613110600080516020615c9e83398151915233612b62565b8061312e575061312e600080516020615c2c83398151915233612b62565b61314a5760405162461bcd60e51b8152600401610dd9906158af565b60026000838152610164602052604090205460ff1660058111156131705761317061535a565b146131ab5760405162461bcd60e51b815260206004820152600b60248201526a139bdd08151bdd5c9a5cdd60aa1b6044820152606401610dd9565b6040516331a9108f60e11b8152600481018390528290610160906000903090636352211e90602401602060405180830381865afa1580156131f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132149190615646565b6001600160a01b0316815260208101919091526040016000205561323782613f07565b60008281526101646020526040808220805460ff19166005179055516331a9108f60e11b815261238c60048201523090636352211e90602401602060405180830381865afa15801561328d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132b19190615646565b905073912ce59144191c1204e64559fe8253a0e49e6548670de0b6b3a76400006132dc816014615868565b6040516370a0823160e01b81526001600160a01b038416906370a082319061330890879060040161520e565b602060405180830381865afa158015613325573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061334991906154d5565b101580156133c7575060056040516342d21ef760e01b81526004810186905230906342d21ef790602401602060405180830381865afa158015613390573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133b491906159ef565b60058111156133c5576133c561535a565b145b156134c0576040516331a9108f60e11b81526004810185905261344f9084903090636352211e90602401602060405180830381865afa15801561340e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134329190615646565b61343d84600f615868565b6001600160a01b0386169291906141f6565b6040516331a9108f60e11b8152600481018690526134c09084903090636352211e90602401602060405180830381865afa158015613491573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134b59190615646565b61343d846005615868565b604051849086907fb23db0b1d644ad12d20d90a80bb43bf5ac1f29e365c6fc96137fbf19ce08b91490600090a35050505050565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b60006001600160e01b03198216637965db0b60e01b1480610d2a5750610d2a82614250565b6000908152606760205260409020546001600160a01b0316151590565b600081815260696020526040902080546001600160a01b0319166001600160a01b038416908117909155819061359982611da5565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000825b600a81106135f0576135e981600a614275565b90506135d6565b90911492915050565b600081815b81156136235761360f82600a614275565b915061361c816001614281565b90506135fe565b9392505050565b6040516370a0823160e01b815260009060019030906370a082319061365390879060040161520e565b602060405180830381865afa158015613670573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061369491906154d5565b10801561362357506001600160a01b0383166000908152610160602052604090205415806136235750506001600160a01b0391909116600090815261016060205260409020541490565b6001600160a01b0382166137345760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610dd9565b61373d81613547565b156137895760405162461bcd60e51b815260206004820152601c60248201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b6044820152606401610dd9565b6137956000838361428d565b6001600160a01b03821660009081526068602052604081208054600192906137be908490615815565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b0386169081179091559051839290600080516020615cde833981519152908290a45050565b61381433826140e1565b6138305760405162461bcd60e51b8152600401610dd99061591f565b610e67838383613d6e565b6138458282612b62565b6119235761385d816001600160a01b03166014614826565b613868836020614826565b604051602001613879929190615a0c565b60408051601f198184030181529082905262461bcd60e51b8252610dd9916004016151fb565b6138a98282612b62565b61192357600082815261012d602090815260408083206001600160a01b03851684529091529020805460ff191660011790556138e23390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6139308282612b62565b1561192357600082815261012d602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60c95460ff166139d75760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610dd9565b60c9805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b604051613a11919061520e565b60405180910390a1565b60009081526101656020526040812090815542600290910155565b606081600003613a5d5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115613a875780613a7181615a7b565b9150613a809050600a83615854565b9150613a61565b6000816001600160401b03811115613aa157613aa161508f565b6040519080825280601f01601f191660200182016040528015613acb576020820181803683370190505b5090505b8415613b3657613ae060018361587f565b9150613aed600a86615a94565b613af8906030615815565b60f81b818381518110613b0d57613b0d615828565b60200101906001600160f81b031916908160001a905350613b2f600a86615854565b9450613acf565b949350505050565b610e6783838360405180602001604052806000815250612bff565b6000613b6482611da5565b9050613b728160008461428d565b613b7d600083613564565b6001600160a01b0381166000908152606860205260408120805460019290613ba690849061587f565b909155505060008281526067602052604080822080546001600160a01b0319169055518391906001600160a01b03841690600080516020615cde833981519152908390a45050565b61016754600160a01b900460ff16613c3a5760405162461bcd60e51b815260206004820152600f60248201526e46323420697320696e61637469766560881b6044820152606401610dd9565b613c458160096135d2565b15613c625760405162461bcd60e51b8152600401610dd990615702565b61016654610100900460ff16613c77826135f9565b1115613c955760405162461bcd60e51b8152600401610dd9906156b7565b613c9f338261362a565b613d015760405162461bcd60e51b815260206004820152602d60248201527f4e6f7420616c6c6f7765642e205468652061646472657373206861732f68616460448201526c1030b737ba3432b91027232a1760991b6064820152608401610dd9565b613d0b33826136de565b600081815261016460205260409020805460ff19166002179055613d2e81613a1b565b613d3781613a36565b604051602001613d4791906157cf565b60408051601f19818403018152918152600083815261016160205220906119239082615587565b826001600160a01b0316613d8182611da5565b6001600160a01b031614613de95760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610dd9565b6001600160a01b038216613e4b5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610dd9565b613e5683838361428d565b613e61600082613564565b6001600160a01b0383166000908152606860205260408120805460019290613e8a90849061587f565b90915550506001600160a01b0382166000908152606860205260408120805460019290613eb8908490615815565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b038681169182179092559151849391871691600080516020615cde83398151915291a4505050565b600090815261016560205260408120908155620186a0600182015542600290910155565b600054610100900460ff166119565760405162461bcd60e51b8152600401610dd990615aa8565b600054610100900460ff16613f795760405162461bcd60e51b8152600401610dd990615aa8565b6065613f858382615587565b506066610e678282615587565b611923828261389f565b60c95460ff1615613fe25760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610dd9565b60c9805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258613a043390565b816001600160a01b0316836001600160a01b0316036140745760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b6044820152606401610dd9565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b60006140ec82613547565b61414d5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610dd9565b600061415883611da5565b9050806001600160a01b0316846001600160a01b031614806141935750836001600160a01b031661418884610fa6565b6001600160a01b0316145b80613b365750613b3681856134f4565b6141ae848484613d6e565b6141ba848484846149c1565b611c195760405162461bcd60e51b8152600401610dd990615af3565b6060604051806060016040528060328152602001615c6c60329139905090565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611c19908590614ac2565b60006001600160e01b0319821663780e9d6360e01b1480610d2a5750610d2a82614b94565b60006136238284615854565b60006136238284615815565b60c95460ff16156142de5760405162461bcd60e51b815260206004820152601b60248201527a1058d8dbdd5b9d081d1c985b9cd9995c9cc81cdd5cdc195b991959602a1b6044820152606401610dd9565b813b151580156142f657506001600160a01b03831615155b156143c05760026040516342d21ef760e01b81526004810183905230906342d21ef790602401602060405180830381865afa158015614339573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061435d91906159ef565b600581111561436e5761436e61535a565b146143bb5760405162461bcd60e51b815260206004820152601f60248201527f4e6f7420616c6c6f77656420746f207472616e73666572206163636f756e74006044820152606401610dd9565b61481b565b6001600160a01b038316158015906143e057506001600160a01b03821615155b1561481b576143f0612392613547565b156146a35760016144008361262c565b10801561444657506001600160a01b03821660009081526101606020526040902054158061444657506001600160a01b0382166000908152610160602052604090205481145b806144d75750614457826000611813565b6123921480156144d7575060046040516342d21ef760e01b81526004810183905230906342d21ef790602401602060405180830381865afa1580156144a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144c491906159ef565b60058111156144d5576144d561535a565b145b6144f35760405162461bcd60e51b8152600401610dd990615738565b60056040516342d21ef760e01b81526004810183905230906342d21ef790602401602060405180830381865afa158015614531573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061455591906159ef565b60058111156145665761456661535a565b14806145e2575060026040516342d21ef760e01b81526004810183905230906342d21ef790602401602060405180830381865afa1580156145ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145cf91906159ef565b60058111156145e0576145e061535a565b145b80614687575060006145f38361262c565b11801561460b5750614606826000611813565b612392145b8015614687575060046040516342d21ef760e01b81526004810183905230906342d21ef790602401602060405180830381865afa158015614650573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061467491906159ef565b60058111156146855761468561535a565b145b6143bb5760405162461bcd60e51b8152600401610dd990615b45565b60016146ae8361262c565b1080156146f457506001600160a01b0382166000908152610160602052604090205415806146f457506001600160a01b0382166000908152610160602052604090205481145b6147105760405162461bcd60e51b8152600401610dd990615738565b60056040516342d21ef760e01b81526004810183905230906342d21ef790602401602060405180830381865afa15801561474e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061477291906159ef565b60058111156147835761478361535a565b14806147ff575060026040516342d21ef760e01b81526004810183905230906342d21ef790602401602060405180830381865afa1580156147c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906147ec91906159ef565b60058111156147fd576147fd61535a565b145b61481b5760405162461bcd60e51b8152600401610dd990615b45565b610e67838383614be4565b60606000614835836002615868565b614840906002615815565b6001600160401b038111156148575761485761508f565b6040519080825280601f01601f191660200182016040528015614881576020820181803683370190505b509050600360fc1b8160008151811061489c5761489c615828565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106148cb576148cb615828565b60200101906001600160f81b031916908160001a90535060006148ef846002615868565b6148fa906001615815565b90505b6001811115614972576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061492e5761492e615828565b1a60f81b82828151811061494457614944615828565b60200101906001600160f81b031916908160001a90535060049490941c9361496b81615b88565b90506148fd565b5083156136235760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610dd9565b60006001600160a01b0384163b15614ab757604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290614a05903390899088908890600401615b9f565b6020604051808303816000875af1925050508015614a40575060408051601f3d908101601f19168201909252614a3d91810190615bdc565b60015b614a9d573d808015614a6e576040519150601f19603f3d011682016040523d82523d6000602084013e614a73565b606091505b508051600003614a955760405162461bcd60e51b8152600401610dd990615af3565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050613b36565b506001949350505050565b6000614b17826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614c569092919063ffffffff16565b805190915015610e675780806020019051810190614b359190615892565b610e675760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610dd9565b60006001600160e01b031982166380ac58cd60e01b1480614bc557506001600160e01b03198216635b5e139f60e01b145b80610d2a57506301ffc9a760e01b6001600160e01b0319831614610d2a565b614bef838383614c65565b60c95460ff1615610e675760405162461bcd60e51b815260206004820152602b60248201527f4552433732315061757361626c653a20746f6b656e207472616e73666572207760448201526a1a1a5b19481c185d5cd95960aa1b6064820152608401610dd9565b6060613b368484600085614d1d565b6001600160a01b038316614cc057614cbb81609980546000838152609a60205260408120829055600182018355919091527f72a152ddfb8e864297c917af52ea6c1c68aead0fee1a62673fcc7e0c94979d000155565b614ce3565b816001600160a01b0316836001600160a01b031614614ce357614ce38382614e45565b6001600160a01b038216614cfa57610e6781614ee2565b826001600160a01b0316826001600160a01b031614610e6757610e678282614f91565b606082471015614d7e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610dd9565b843b614dcc5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610dd9565b600080866001600160a01b03168587604051614de89190615bf9565b60006040518083038185875af1925050503d8060008114614e25576040519150601f19603f3d011682016040523d82523d6000602084013e614e2a565b606091505b5091509150614e3a828286614fd5565b979650505050505050565b60006001614e528461262c565b614e5c919061587f565b600083815260986020526040902054909150808214614eaf576001600160a01b03841660009081526097602090815260408083208584528252808320548484528184208190558352609890915290208190555b5060009182526098602090815260408084208490556001600160a01b039094168352609781528383209183525290812055565b609954600090614ef49060019061587f565b6000838152609a602052604081205460998054939450909284908110614f1c57614f1c615828565b906000526020600020015490508060998381548110614f3d57614f3d615828565b6000918252602080832090910192909255828152609a90915260408082208490558582528120556099805480614f7557614f75615c15565b6001900381819060005260206000200160009055905550505050565b6000614f9c8361262c565b6001600160a01b039093166000908152609760209081526040808320868452825280832085905593825260989052919091209190915550565b60608315614fe4575081613623565b825115614ff45782518084602001fd5b8160405162461bcd60e51b8152600401610dd991906151fb565b50805461501a90615507565b6000825580601f1061502a575050565b601f016020900490600052602060002090810190611aee91905b808211156150585760008155600101615044565b5090565b6001600160e01b031981168114611aee57600080fd5b60006020828403121561508457600080fd5b81356136238161505c565b634e487b7160e01b600052604160045260246000fd5b60006001600160401b03808411156150bf576150bf61508f565b604051601f8501601f19908116603f011681019082821181831017156150e7576150e761508f565b8160405280935085815286868601111561510057600080fd5b858560208301376000602087830101525050509392505050565b600082601f83011261512b57600080fd5b613623838335602085016150a5565b60006020828403121561514c57600080fd5b81356001600160401b0381111561516257600080fd5b613b368482850161511a565b60006020828403121561518057600080fd5b5035919050565b60005b838110156151a257818101518382015260200161518a565b50506000910152565b600081518084526151c3816020860160208601615187565b601f01601f19169290920160200192915050565b6040815260006151ea60408301856151ab565b905082151560208301529392505050565b60208152600061362360208301846151ab565b6001600160a01b0391909116815260200190565b6001600160a01b0381168114611aee57600080fd5b6000806040838503121561524a57600080fd5b823561525581615222565b946020939093013593505050565b60006020828403121561527557600080fd5b813561362381615222565b6000806040838503121561529357600080fd5b8235915060208301356001600160401b038111156152b057600080fd5b6152bc8582860161511a565b9150509250929050565b6000806000606084860312156152db57600080fd5b83356152e681615222565b925060208401356152f681615222565b929592945050506040919091013590565b60006020828403121561531957600080fd5b813560ff8116811461362357600080fd5b6000806040838503121561533d57600080fd5b82359150602083013561534f81615222565b809150509250929050565b634e487b7160e01b600052602160045260246000fd5b602081016006831061539257634e487b7160e01b600052602160045260246000fd5b91905290565b600080604083850312156153ab57600080fd5b50508035926020909101359150565b60068110611aee57600080fd5b600080604083850312156153da57600080fd5b82359150602083013561534f816153ba565b600080604083850312156153ff57600080fd5b823561540a81615222565b9150602083013561534f81615222565b8015158114611aee57600080fd5b6000806040838503121561543b57600080fd5b823561544681615222565b9150602083013561534f8161541a565b6000806000806080858703121561546c57600080fd5b843561547781615222565b9350602085013561548781615222565b92506040850135915060608501356001600160401b038111156154a957600080fd5b8501601f810187136154ba57600080fd5b6154c9878235602084016150a5565b91505092959194509250565b6000602082840312156154e757600080fd5b5051919050565b6001600160a01b03929092168252602082015260400190565b600181811c9082168061551b57607f821691505b60208210810361553b57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115610e6757600081815260208120601f850160051c810160208610156155685750805b601f850160051c820191505b81811015611d9d57828155600101615574565b81516001600160401b038111156155a0576155a061508f565b6155b4816155ae8454615507565b84615541565b602080601f8311600181146155e957600084156155d15750858301515b600019600386901b1c1916600185901b178555611d9d565b600085815260208120601f198616915b82811015615618578886015182559484019460019091019084016155f9565b50858210156156365787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006020828403121561565857600080fd5b815161362381615222565b6020808252601190820152702737ba1030b1b1b7bab73a1037bbb732b960791b604082015260600190565b6020808252600f908201526e2737ba1030b71037b832b930ba37b960891b604082015260600190565b6020808252602b908201527f4e756d626572206f6620646967697473206f66206163636f756e744964203e2060408201526a6d61782e2064696769747360a81b606082015260800190565b6020808252601c908201527b0e5e1e0818d85b9b9bdd081899481b5a5b9d08189e4818db1a595b9d60221b604082015260600190565b6020808252604b908201527f4e6f7420616c6c6f7765642e205468652074617267657420616464726573732060408201527f68617320616e206163636f756e74206f72206f6e63652068616420616e6f746860608201526a32b91030b1b1b7bab73a1760a91b608082015260a00190565b6020808252600c908201526b2737ba1030b71030b236b4b760a11b604082015260600190565b67020b1b1b7bab73a160c51b8152600082516157f2816008850160208701615187565b9190910160080192915050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610d2a57610d2a6157ff565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6000826158635761586361583e565b500490565b8082028115828204841417610d2a57610d2a6157ff565b81810381811115610d2a57610d2a6157ff565b6000602082840312156158a457600080fd5b81516136238161541a565b60208082526022908201527f4e6f7420616e206f70657261746f722f636c69656e747374617475736368616e604082015261676560f01b606082015260800190565b602080825260149082015273151bdad95b88191bd95cc81b9bdd08195e1a5cdd60621b604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6000875160206159838285838d01615187565b8851918401916159968184848d01615187565b88519201916159a88184848c01615187565b87519201916159ba8184848b01615187565b86519201916159cc8184848a01615187565b85519201916159de8184848901615187565b919091019998505050505050505050565b600060208284031215615a0157600080fd5b8151613623816153ba565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351615a3e816017850160208801615187565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615a6f816028840160208801615187565b01602801949350505050565b600060018201615a8d57615a8d6157ff565b5060010190565b600082615aa357615aa361583e565b500690565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526023908201527f5472616e73666572206e6f7420616c6c6f77656420696e20746869732073746160408201526274757360e81b606082015260800190565b600081615b9757615b976157ff565b506000190190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090615bd2908301846151ab565b9695505050505050565b600060208284031215615bee57600080fd5b81516136238161505c565b60008251615c0b818460208701615187565b9190910192915050565b634e487b7160e01b600052603160045260246000fdfef2a163c55699a912c8908f55eafbd268811e90fb1b12c3601e6cc1cabd48a525ebb9a89f0ec4a68c7ff3381441395232db5fb2a2ec04968228ce2332afd4a5d968747470733a2f2f6170692e646566692e736170686972737465696e2e636f6d2f6d657461646174613f746f6b656e69643d97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b9299f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212202dcc41d75d0fe7fbdeffc40deff510883459672ece598f8cf96435b85945925b64736f6c63430008120033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.